Open lucacome opened 1 month ago
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: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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 theNginxCollector
andNginxPlusCollector
structs, and updating theCollect
methods to use context with timeout.Context and Timeout Handling Enhancements:
client/nginx.go
: Modified theGetStubStats
method to accept acontext.Context
parameter, enabling more flexible request handling.collector/nginx.go
:context
andtime
imports to support context with timeout.timeout
field to theNginxCollector
struct and updated theNewNginxCollector
function to accept a timeout parameter.Collect
method to use a context with timeout for fetching stub stats.collector/nginx_plus.go
:time
import to support context with timeout.timeout
field to theNginxPlusCollector
struct and updated theNewNginxPlusCollector
function to accept a timeout parameter. [1] [2] [3] [4]Collect
method to use a context with timeout for fetching NGINX Plus stats.Code Cleanup:
exporter.go
:registerCollector
function signature and removed theTimeout
field from thehttp.Client
configuration. [1] [2] [3]Closes #858
Checklist
Before creating a PR, run through this checklist and mark each as complete.