-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input variables carry over to other input files #14954
Comments
Here are the results in the same file: $ ./telegraf --config config.toml
2024-03-08T14:38:02Z I! Loading config: config.toml
2024-03-08T14:38:02Z I! Starting Telegraf 1.30.0-4664b6d0 brought to you by InfluxData the makers of InfluxDB
2024-03-08T14:38:02Z I! Available plugins: 233 inputs, 9 aggregators, 31 processors, 24 parsers, 60 outputs, 6 secret-stores
2024-03-08T14:38:02Z I! Loaded inputs: http_response (2x)
2024-03-08T14:38:02Z I! Loaded aggregators:
2024-03-08T14:38:02Z I! Loaded processors:
2024-03-08T14:38:02Z I! Loaded secretstores:
2024-03-08T14:38:02Z I! Loaded outputs: file
2024-03-08T14:38:02Z I! Tags enabled:
2024-03-08T14:38:02Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"", Flush Interval:10s
2024-03-08T14:38:02Z D! [agent] Initializing plugins
2024-03-08T14:38:02Z D! [agent] Connecting outputs
2024-03-08T14:38:02Z D! [agent] Attempting connection to [outputs.file]
2024-03-08T14:38:02Z D! [agent] Successfully connected to outputs.file
2024-03-08T14:38:02Z D! [agent] Starting service inputs
2024-03-08T14:38:12Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:38:22Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:38:32Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:38:42Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:38:52Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
ReproCase,method=GET,result=success,server=https://www.google.com,status_code=200 response_time=0.18107593,http_response_code=200i,content_length=20438i,result_type="success",result_code=0i 1709908740000000000
ReproCase,ViaHeader=Fri\,\ 08\ Mar\ 2024\ 14:39:00\ GMT,method=GET,result=success,server=https://www.microsoft.com/en-us/,status_code=200 result_code=0i,response_time=0.210224188,http_response_code=200i,content_length=1020i,result_type="success" 1709908740000000000 And in different files as in the example telegraf.conf: ./telegraf --config config.toml --config config2.toml
2024-03-08T14:41:13Z I! Loading config: config.toml
2024-03-08T14:41:13Z I! Loading config: config2.toml
2024-03-08T14:41:13Z I! Starting Telegraf 1.30.0-4664b6d0 brought to you by InfluxData the makers of InfluxDB
2024-03-08T14:41:13Z I! Available plugins: 233 inputs, 9 aggregators, 31 processors, 24 parsers, 60 outputs, 6 secret-stores
2024-03-08T14:41:13Z I! Loaded inputs: http_response (2x)
2024-03-08T14:41:13Z I! Loaded aggregators:
2024-03-08T14:41:13Z I! Loaded processors:
2024-03-08T14:41:13Z I! Loaded secretstores:
2024-03-08T14:41:13Z I! Loaded outputs: file
2024-03-08T14:41:13Z I! Tags enabled:
2024-03-08T14:41:13Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"", Flush Interval:10s
2024-03-08T14:41:13Z D! [agent] Initializing plugins
2024-03-08T14:41:13Z D! [agent] Connecting outputs
2024-03-08T14:41:13Z D! [agent] Attempting connection to [outputs.file]
2024-03-08T14:41:13Z D! [agent] Successfully connected to outputs.file
2024-03-08T14:41:13Z D! [agent] Starting service inputs
2024-03-08T14:41:23Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:41:33Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:41:43Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2024-03-08T14:41:53Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
ReproCase,ViaHeader=Fri\,\ 08\ Mar\ 2024\ 14:42:00\ GMT,method=GET,result=success,server=https://www.microsoft.com/en-us/,status_code=200 response_time=0.152207514,http_response_code=200i,content_length=1020i,result_type="success",result_code=0i 1709908920000000000
ReproCase,method=GET,result=success,server=https://www.google.com,status_code=200 content_length=20483i,result_type="success",result_code=0i,response_time=0.483155715,http_response_code=200i 1709908920000000000
2024-03-08T14:42:03Z D! [outputs.file] Wrote batch of 2 metrics in 79.421µs
2024-03-08T14:42:03Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics So as-is that config is not reproducing the issue.
Your allude to a "outputs.prometheus_client.conf", might be worth sharing your entire config in the event that this is an output issue and not input. I did try briefly using the prometheus format and file output, however, that continues to look correct:
|
This is the content of the last config file in conf.d, the outputs-config. I tried to alter the config files by removing unneeded tagging and also used the default telegraf.conf to no avail. The empty value still appears. |
Are you sure you are not setting or adding this tag by accident? (e.g. processor or setting tags?) Nothing in that output appears to be doing something special. I will need a way to reproduce in order to further assist. |
I successfully reproduced your example by creating a new output-config which uses [output.file]. In my metrics.out-file the empty value is not present. But in the output on localhost:9273/metrics which is generated by my original config with [output.prometheus_client] the empty value is still present. Please try again with [output.prometheus_client], I believe that's where the issue is originating from. In your last example you used Prometheus format, but your agent only connected to outputs.file, not outputs.prometheus_client. |
I do now see this:
This issue has nothing to do with different configuration files or even the inputs themselves. It only occurs when using the It has to do with #2857 change where it was declared that lables cannot differ within a metric. #2822 was the original issue filed. I don't see us changing this behavior. You can use metric_version 2 as a workaround, but I wonder if that is even wise. Looking at prometheus/client_java#696 there were suggestions that having different labels is unwise and should be avoided. I'm inclinced to close this as working as expected then, but will think through metric version 2. |
Thank you for the clarification. As this behaviour is as intended I think my issue can be closed. Thank you for your assistance, I will look for a way around. |
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.29.5, Windows 10 22H2
Docker
No response
Steps to reproduce
Expected behavior
The added http_header_tag will be applied to the metric with the respective URL.
Actual behavior
The added http_header_tag is applied to all metrics across all config files where [[inputs.http_response]] is defined.
The added tags have empty values and clutter the metrics where it is not required.
Additional info
View the screenshots for additional info and how the metrics turn out.
I used two separate config files with two random URLs for reproducing the issue. There are no other config files present.
The "ViaHeader" is requesting a HTTP header thats always returned by a website, in this case the date and time.
The value is filled into the metric of the URL where it is defined, like expected. The tag is also present in the metric of the URL where it wasn't defined also without value.
The text was updated successfully, but these errors were encountered: