feat(inputs.prometheus): Add new internal stats on Prometheus gathers#18944
feat(inputs.prometheus): Add new internal stats on Prometheus gathers#18944nlgotz wants to merge 3 commits into
Conversation
|
Thanks so much for the pull request! |
|
!signed-cla |
| urlStr := u.url.String() | ||
| connectStat := selfstat.Register("prometheus", "connection_status", map[string]string{"url": urlStr}) | ||
| gatherSuccess := selfstat.Register("prometheus", "gathers_total", map[string]string{"url": urlStr, "status": "success"}) | ||
| gatherFailure := selfstat.Register("prometheus", "gathers_total", map[string]string{"url": urlStr, "status": "failure"}) |
There was a problem hiding this comment.
This will strip all global tags (e.g. alias). Please implement TSD-011 instead. See `ouputs.influxdb for an example...
There was a problem hiding this comment.
Will work on that. I was using the inputs.gnmi as a reference
| gatherSuccess := selfstat.Register("prometheus", "gathers_total", map[string]string{"url": urlStr, "status": "success"}) | ||
| gatherFailure := selfstat.Register("prometheus", "gathers_total", map[string]string{"url": urlStr, "status": "failure"}) |
There was a problem hiding this comment.
I don't see how this is better than using the existing statistics and enable per_plugin in the internal input plugin...
There was a problem hiding this comment.
When using the per_plugin it still groups all of the URLs together into a single instance which makes it harder when using service discovery (in our case Consul) to determine which url's are working/not working.
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
Summary
Adds 2 new internal metrics to the Prometheus input plugin.
connection_statussets the value to either 0 (connection failed) or 1 (connection succeeded).gathers_totalwhich has astatustag of eithersuccessorfailurethat increments on each gather.Checklist
Related issues
resolves #18943