nginxinc / nginx-prometheus-exporter

NGINX Prometheus Exporter for NGINX and NGINX Plus
Apache License 2.0
1.65k stars 342 forks source link

Use timeout flag for context cancelation #868

Open lucacome opened 1 month ago

lucacome commented 1 month ago

Proposed changes

This pull request introduces several changes to the NGINX Prometheus exporter to add context and timeout handling capabilities. The main updates include modifying the GetStubStats method to accept a context parameter, adding a timeout field to the NginxCollector and NginxPlusCollector structs, and updating the Collect methods to use context with timeout.

Context and Timeout Handling Enhancements:

Code Cleanup:

Closes #858

Checklist

Before creating a PR, run through this checklist and mark each as complete.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 3.89%. Comparing base (9cd3941) to head (487aac4).

Files with missing lines Patch % Lines
collector/nginx.go 0.00% 5 Missing :warning:
collector/nginx_plus.go 0.00% 5 Missing :warning:
exporter.go 0.00% 3 Missing :warning:
client/nginx.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #868 +/- ## ======================================== - Coverage 3.90% 3.89% -0.01% ======================================== Files 5 5 Lines 1307 1310 +3 ======================================== Hits 51 51 - Misses 1256 1259 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.