Skip to content
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

Cannot use timeout for inputs.prometheus plugin with v1.26.0 #12859

Closed
jheinitz opened this issue Mar 14, 2023 · 3 comments · Fixed by #12864
Closed

Cannot use timeout for inputs.prometheus plugin with v1.26.0 #12859

jheinitz opened this issue Mar 14, 2023 · 3 comments · Fixed by #12864
Assignees
Labels
bug unexpected problem or unintended behavior size/s 1 day effort, great beginniner issue

Comments

@jheinitz
Copy link

jheinitz commented Mar 14, 2023

Relevant telegraf.conf

# Original Config:
# ----------------
[[inputs.prometheus]]
   urls = ["http://127.0.0.1:8779/metrics"]
   username = "*****"
   password = "*****"
   response_timeout = "10s"
   [inputs.prometheus.tags]
     component = "kafka"

# Adapted Config:
# ----------------
[[inputs.prometheus]]
   urls = ["http://127.0.0.1:8779/metrics"]
   username = "*****"
   password = "*****"
   # response_timeout = "10s"
   timeout = "10s"
   [inputs.prometheus.tags]
     component = "kafka"

Logs from Telegraf

Log for Original Config:
------------------------
2023-03-14T10:20:25Z I! Loading config file: /etc/telegraf/telegraf.d/in.jmx_prometheus-kafka.conf
2023-03-14T10:20:25Z W! DeprecationWarning: Option "response_timeout" of plugin "inputs.prometheus" deprecated since version 1.26.0 and will be removed in 2.0.0: use 'timeout' instead

Log for Adapted Config:
-----------------------
2023-03-14T10:21:40Z I! Loading config file: /etc/telegraf/telegraf.d/in.jmx_prometheus-kafka.conf
2023-03-14T10:21:40Z E! error loading config file /etc/telegraf/telegraf.d/in.jmx_prometheus-kafka.conf: error parsing prometheus, line 6: field corresponding to `timeout' in prometheus.Prometheus cannot be set through TOML

System info

Telegraf v1.26.0, RHEL 8.6 Docker 20.10.17

Docker

No response

Steps to reproduce

  1. Use original config from above
  2. Launch telegraf container
  3. see warning in log (see above)
  4. modify config to use timeout instead of response_timeout
  5. restart telegraf container
  6. see error in log (see above)
    ...

Expected behavior

Telegraf should no longer issue a warning and accept the new parameter timeout = "10s" and should start up.

Actual behavior

Telegraf complains about the parameter timeout = "10s" and does not start

Additional info

No response

@jheinitz jheinitz added the bug unexpected problem or unintended behavior label Mar 14, 2023
powersj added a commit to powersj/telegraf that referenced this issue Mar 14, 2023
* Only print deprecation warning if response_timeout is used
* Only set timeouts with response_timeout if it is set
* Allow the use of the timeout param in TOML
* Update tests

fixes: influxdata#12859
@powersj
Copy link
Contributor

powersj commented Mar 14, 2023

@jheinitz,

Thanks for the quick issue. I have put up #12864 with a fix, it seems we did not get the deprecation quite right. For now, you can continue to use response_timeout to set the timeout.

Thanks again

@powersj powersj self-assigned this Mar 14, 2023
@powersj powersj added the size/s 1 day effort, great beginniner issue label Mar 14, 2023
@jheinitz
Copy link
Author

Hello,

I just wanted to let you know that I validated the fix using the latest nightly. The deprecation warning is only shown when the response_timeout parameter is present and I was able to add the timeout: parameter.

Thanks for the quick fix and for your great work!

Kind regards

Jens

@powersj
Copy link
Contributor

powersj commented Mar 16, 2023

Thank you for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior size/s 1 day effort, great beginniner issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants