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
The input plugin http_response sets the result_type fields to "response_string_mismatch" when the plugin fails to read the body of the response when using the response_string_match option, additionally logging the error.
This is prone to cause confusion and extended debug times. It would be more appropriate to set the result_type to a dedicated value that signals a failure to process the body with a regex, something along the lines of "regex_failure" or "error_processing_body"
Additionally, if regex fails to compile the plugin raises a panic that kills Telegraf, though the way that is written suggests that it was intended, as whith a failure to read the response body, to log a message to stderr and set result_type to "response_string_mismatch".
The plugin should never cause a panic killing the server, and the "response_string_mismatch" result_type should be reserved for regex mismatches
Actual behavior:
The plugin should panic upon receiving an invalid regex, and the "response_string_mismatch" result_type is used in error states, instead of failing hard and hinting a configuration issue
Thanks for the help @mirath, I think if the regex can't be compiled then the plugin should return an error at the start of Gather, not return any metrics, and telegraf will log the error. In a future version we will refuse to start if this regex is invalid.
If the body can't be read we can report body_read_error as the result_type.
Bug report
The input plugin
http_response
sets theresult_type
fields to "response_string_mismatch" when the plugin fails to read the body of the response when using theresponse_string_match
option, additionally logging the error.This is prone to cause confusion and extended debug times. It would be more appropriate to set the
result_type
to a dedicated value that signals a failure to process the body with a regex, something along the lines of "regex_failure" or "error_processing_body"Additionally, if regex fails to compile the plugin raises a panic that kills Telegraf, though the way that is written suggests that it was intended, as whith a failure to read the response body, to log a message to stderr and set
result_type
to "response_string_mismatch".Relevant telegraf.conf:
[[inputs.http_response]]
address = "http://localhost:5000"
response_string_match = "]]"
System info:
Telegraf commit df80fa6
Expected behavior:
The plugin should never cause a panic killing the server, and the "response_string_mismatch"
result_type
should be reserved for regex mismatchesActual behavior:
The plugin should panic upon receiving an invalid regex, and the "response_string_mismatch"
result_type
is used in error states, instead of failing hard and hinting a configuration issueEDIT:
Relevant code:
The text was updated successfully, but these errors were encountered: