Skip to content

Uninformative error message 'error getting stats' #1184

@AlexKorsakov

Description

@AlexKorsakov

Is your feature request related to a problem? Please describe.
I scrape metrics from few nginx instances at the same time. Instances passes by few arguments '--nginx.scrape-uri=some_nginx/metrics'. And I get infinite messages in logs:

time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"
time=... level=ERROR source=nginx.go:57 msg="error getting stats" error="expected 200 response, got 502"

Likely the cause in one or few of my nginx instances, but I don't see from log which exactly. And this is the problem. And even log level change doesn't show more information.

Describe the solution you'd like
NginxCollector contains field nginxClient, which contains apiEndpoint. And I suggest to log apiEndpoint to error message at error log level.

Describe alternatives you've considered
Or log apiEndpoint to error message at debug log level.

Additional context
Found on nginx-prometheus-exporter:1.4.0. Used in docker container in docker swarm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityIssues or PRs opened by an external contributorhelp wantedIssues identified as good community contribution opportunities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions