-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Handling of compressed HTTP responses #684
Comments
I don't think it's the responsibility of this exporter to try to decode arbitrary opaque data that a server sends back based on hand-configured headers. |
I can understand the argument, but I still think there's something that needs changing.
Is adding something like "ValidContentEncodings" (similar to ValidResponseCodes) a solution here? What I mean is instead of making BBE transparently handle Content-Encoding, have the user specify which encodings should be handled (out of a specific set)? It would be the user's responsibility to pass whatever Accept-Encoding header is appropriate and set up header validations to verify the responses). Or should BBE simply handle a known set of encodings (without something like ValidContentEncodings, since the user has a way to set up the headers), maybe with an option to disable this? |
I disagree that they're known, a server can return in principle any arbitrary encoding it wants to.
The user can already check response headers, so I don't see what having a 2nd way to do that would gain us. |
While that is true, RFC 7231 does say:
Current browsers support "br" in addition to these, but I'm fine supporting only what the RFC lists. That said,
The question is more about which values should be automatically handled by BBE. As an example, if the user sets |
I was not aware, that changes things a bit. Are implementations required to support these though?
I'm still not getting your point here, why would you need to configure the blackbox exporter to tell the exporter what features the blackbox exporter has? |
Sorry I didn't come back to this issue in a timely manner... RFC 7231 says:
In order to be able apply validations like If I can restate the original issue, I think there's are two things to consider:
What I was trying to say in later responses is that some users might actually want to verify that the response is compressed (by looking at the data as returned from the server), by writing a regular expression that matches the compressed data by using something like The other point that I think is relevant is that we do have a metric |
@roidelapluie I would appreciate your take on this. |
I think that if we support that, we should do it in a way that we do not let the user specify the headers, but that we specify the compression ourseves, e.g. |
That sounds good to me. If the user is trying to verify that including Braindump: Adding The user can still add Can the user verify that the server is behaving as expected in the absence of Yeah, that sounds good to me. |
If the module configuration specifies the "compression" option blackbox_exporter will try to decompress the response using the specified algorithm. If the response is not compressed using that algorithm, the probe will fail. It validates that the "Accept-Encoding" header is either absent, or that it specifies the same algorithm as the "compression" option. If the "Accept-Encoding" header is present but it specifies a different algorithm, the probe will fail. If the compression option is *not* used, probe_http_content_length and probe_http_uncompressed_body_length will have the same value corresponding to the original content length. If the compression option is used and the content can be decompressed, probe_http_content_length will report the original content length as it currently does, and probe_http_uncompressed_body_length will report the length of the body after decompression as expected. Fixes #684 Signed-off-by: Marcelo E. Magallon <[email protected]>
If the module configuration specifies the "compression" option blackbox_exporter will try to decompress the response using the specified algorithm. If the response is not compressed using that algorithm, the probe will fail. It validates that the "Accept-Encoding" header is either absent, or that it specifies the same algorithm as the "compression" option. If the "Accept-Encoding" header is present but it specifies a different algorithm, the probe will fail. If the compression option is *not* used, probe_http_content_length and probe_http_uncompressed_body_length will have the same value corresponding to the original content length. If the compression option is used and the content can be decompressed, probe_http_content_length will report the original content length as it currently does, and probe_http_uncompressed_body_length will report the length of the body after decompression as expected. Fixes #684 Signed-off-by: Marcelo E. Magallon <[email protected]>
If the module configuration specifies the "compression" option blackbox_exporter will try to decompress the response using the specified algorithm. If the response is not compressed using that algorithm, the probe will fail. It validates that the "Accept-Encoding" header is either absent, or that it specifies the same algorithm as the "compression" option. If the "Accept-Encoding" header is present but it specifies a different algorithm, the probe will fail. If the compression option is *not* used, probe_http_content_length and probe_http_uncompressed_body_length will have the same value corresponding to the original content length. If the compression option is used and the content can be decompressed, probe_http_content_length will report the original content length as it currently does, and probe_http_uncompressed_body_length will report the length of the body after decompression as expected. Fixes #684 Signed-off-by: Marcelo E. Magallon <[email protected]>
Host operating system: output of
uname -a
Linux clara 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
blackbox_exporter version: output of
blackbox_exporter -version
What is the blackbox.yml module config.
What is the prometheus.yml scrape config.
None.
What logging output did you get from adding
&debug=true
to the probe URL?What did you do that produced an error?
See configuration above. Target is https://prometheus.io/
What did you expect to see?
probe_success 0
What did you see instead?
probe_success 1
By adding:
the server is correctly returning a compressed response. The uncompressed body matches the specified regular expression, and my expectation is that the probe fails.
BBE is not decompressing the response and the regular expression is being applied to the compressed response, and therefore does not match.
The text was updated successfully, but these errors were encountered: