Fix prometheus passthrough for existing value types #3351
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternative pull request to #3337, I added the setting of metric types in the prometheus input, and use that in the prometheus output to adjust the output format. I think this will have less potential for side effects.
I also included @jdoupe suggestion to use the promhttp package, as well as adding his configurable disabling of the built in collectors. It would be nicer to disable them by default, since outputs shouldn't really create metrics, but for now they default on.
I added the
ErrorHandling: promhttp.ContinueOnError
option which seems to prevents conflict if the help message is different. This will reduce the visibility of errors, but it seems it may be necessary. In the long term I would like to add metadata support to our metrics struct, so that help info can be passed through this way, but this requires more consideration.Unlike #3337, I did not add histogram or summary support, these types need to be added as first class
telegraf.ValueType
types and then they can be wired up like counters/gauges.closes #2950
Required for all PRs:
Associated README.md updated.