nginxinc / nginx-prometheus-exporter

NGINX Prometheus Exporter for NGINX and NGINX Plus
Apache License 2.0
1.57k stars 341 forks source link

Allow using the latest version with older versions of NGINX Plus #629

Open lucacome opened 6 months ago

lucacome commented 6 months ago

I want to be able to use the exporter with older versions of NGINX Plus and not have the latest version of the API hardcoded.

Depends on https://github.com/nginxinc/nginx-plus-go-client/issues/222

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] commented 3 months ago

This issue was closed because it has been stalled for 10 days with no activity.

alitoufighi commented 2 weeks ago

My assumption is we won't be able to fix this with the given solution for https://github.com/nginxinc/nginx-plus-go-client/issues/222 as it needs an already connected client.

lucacome commented 2 weeks ago

@alitoufighi yes we need a connection to get the API versions from NGINX. One of the options that I was thinking about was to check the version every time we collect the metrics, but that might be a little bit expensive.

I'm open to suggestions 🙂

alitoufighi commented 2 weeks ago

Hmm maybe beginning the connection in a minimal way (is finding the lowest compatible api version any easier? i.e. 1?) and then promoting it to a higher version? (I mean in the client)

Also I don't think the call to get API versions is over a specific API version, so it could be doable to communicate over to find the max compatible API version during initialization as well (in the nginx client repo, could be a breaking change?). It might not be the cleanest way either. (might actually give this a shot)

mpstefan commented 2 weeks ago

Blocked until nginx-plus-go-client 1.3.0 is release. When it is, @alitoufighi would you be open to creating a PR for this?