You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any config that enables the prometheus input plugin with k8s discovery enabled
[[inputs.prometheus]]
monitor_kubernetes_pods = true
System info
Telegraf 1.20
Docker
No response
Steps to reproduce
A bit tricky as it requires a k8s environment with k8s pod autodiscovery
bring up a k8s cluster with at least one k8s pod that is a scrape target and requires query parameters in the scrape url annotation
bring up a telegraf k8s pod configured to autodiscover scrape targets
scrape by the plugin will fail because the query parameters are encoded incorrectly
...
Expected behavior
scraping should succeed by using properly formatted URL to scrape targets that require query parameters
Actual behavior
the scrape url used by the plugin is incorrect because the "?" character is incorrectly encoded as "%3F",
as a result the scrape fails.
Additional info
This bug manifests only when telegraf runs in a k8s pod, is configured to auto discover scrape target pods and when a scrape target requires query parameters in the scrape URL.
Example of target pod annotation with query parameters in the scrape URL (here a "passcode" variable):
Relevent telegraf.conf
System info
Telegraf 1.20
Docker
No response
Steps to reproduce
A bit tricky as it requires a k8s environment with k8s pod autodiscovery
...
Expected behavior
scraping should succeed by using properly formatted URL to scrape targets that require query parameters
Actual behavior
the scrape url used by the plugin is incorrect because the "?" character is incorrectly encoded as "%3F",
as a result the scrape fails.
Additional info
This bug manifests only when telegraf runs in a k8s pod, is configured to auto discover scrape target pods and when a scrape target requires query parameters in the scrape URL.
Example of target pod annotation with query parameters in the scrape URL (here a "passcode" variable):
The plugin will issue an error scraping such target:
2021-12-07T17:12:00Z E! [inputs.prometheus] Error in plugin: error making HTTP request to http://10.42.0.143:9102/metrics%3Fpasscode=secret: Get "http://10.42.0.143:9102/metrics%3Fpasscode=secret": ...
The question mark character has been incorrectly converted to "%3F"
The text was updated successfully, but these errors were encountered: