-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
When the AWS X-Amzn-Trace-Id header is being parsed, the code assumes the presence of at least two - separators inside the Root= field. If the header is malformed or missing expected parts, this results in:
IndexError
index 1 outside of array bounds: -1...1 (IndexError)
This occurs at:
prometheus_exporter/lib/prometheus_exporter/middleware.rb
Lines 127 to 130 in 15e9d47
| # get the content of the x-amzn-trace-id header | |
| # see also: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-request-tracing.html | |
| value = env["HTTP_X_AMZN_TRACE_ID"] | |
| value&.split("Root=")&.last&.split("-")&.fetch(1)&.to_i(16) |
This exception breaks metric collection and causes a 500 response
Would it be possible for the parser to return nil (or otherwise skip parsing) when the header is not a valid AWS trace header?
rabinshr
Metadata
Metadata
Assignees
Labels
No labels