Skip to content

Use appropriate context to call NGINX Plus API #858

@lucacome

Description

@lucacome

https://github.com/nginxinc/nginx-plus-go-client/releases/tag/v2.0.0 now supports passing a context to the API calls, so we need to pass a context to c.nginxClient.GetStats()

https://github.com/nginxinc/nginx-prometheus-exporter/blob/262228e3d7e89c88433a627b0c5df779fa08b876/collector/nginx_plus.go#L621-L625

Figure out if we want to pass a context or a timeout. We already have a timeout that users can set for scraping metrics
https://github.com/nginxinc/nginx-prometheus-exporter/blob/262228e3d7e89c88433a627b0c5df779fa08b876/exporter.go#L95
it probably makes sense to use the same value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions