prometheus_metric_types config option invalid in 1.28.1
Relevant telegraf.conf
[[outputs.prometheus_client]]
alias = "service"
namepass = ["service.*"]
namedrop = []
fielddrop = []
listen = ":9273"
metric_version = 2
export_timestamp = true
path = "/metrics"
expiration_interval = "60s"
string_as_label = true
[outputs.prometheus_client.prometheus_metric_types]
counter = [
"service.server.requests",
]
Logs from Telegraf
$ /telegraf/telegraf --version
Telegraf 1.28.1 (git: HEAD@3ea9ffbe)
$ /telegraf/telegraf --config /etc/configs/telegraf.conf --test
2023-09-26T17:49:56Z I! Loading config: /etc/configs/telegraf.conf
2023-09-26T17:49:56Z E! error loading config file /etc/configs/telegraf.conf: plugin outputs.prometheus_client: line 98: configuration specified the fields ["prometheus_metric_types"], but they weren't used
System info
Linux 5.15.X
Docker
No response
Steps to reproduce
- Update to Telegraf v1.28.1
- Verify binary running telegraf --version
- Verify prom endpoint exposed w/ relevant metrics
- Add
[outputs.prometheus_client.prometheus_metric_types] - Run config check w/
telegraf --config /etc/configs/telegraf.conf --test - Verify error
Expected behavior
Telegraf should recognize the prometheus_metric_types block and categorize each metric listed as counter or gauge.
Actual behavior
Telegraf fails to start, failing the config check.
Additional info
Binary pulled from GH.
telegraf-1.28.1_linux_amd64.tar.gz shasum 256: 12bba32a6041efab0ca1b2877d943f7bf877cfd81cc295964b75f93ee455c143
@srebhan is this suppose to be:
- [outputs.prometheus_client.prometheus_metric_types]
+ [outputs.prometheus_client.metric_types]
Docs will need to get updated, and should this also be in the serializer registry?
Thanks
Thanks, adjusting the config to metric_types resolves the issue. 🙏
no prob. Let me get @srebhan to confirm that is what is expected and we can update all the docs to match.