Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

weblog: Correctly parse multiple values in nginx upstream_response_time #711

Merged
merged 1 commit into from Jul 12, 2022

Conversation

kralewitz
Copy link
Contributor

This commit changes the way how the upstream_response_time field is
parsed in nginx access logs. The field can contain multiple time values
if the request got processed by multiple upstream servers, or if it
passed through an internal redirect between multiple server groups (i.e.
by using the X-Accel-Redirect header).

Previously, only the first encountered value was processed by weblog
plugin, and it only accounted for the ',' separator. If the field contained
the ':' separator, the value was not parsed correctly. With this commit
applied, both of these cases will be handled correctly. Additionaly, the
value reported will be the sum of times from all upstream servers that
handled the request, i.e. the total time the request spent upstream.

This commit changes the way how the upstream_response_time field is
parsed in nginx access logs. The field can contain multiple time values
if the request got processed by multiple upstream servers, or if it
passed through an internal redirect between multiple server groups (i.e.
by using the X-Accel-Redirect header).

Previously, only the first encountered value was processed by weblog
plugin, and it only accounted for the ',' separator. If the field contained
the ':' separator, the value was not parsed correctly. With this commit
applied, both of these cases will be handled correctly. Additionaly, the
value reported will be the sum of times from all upstream servers that
handled the request, i.e. the total time the request spent upstream.
@ilyam8
Copy link
Member

ilyam8 commented Jul 12, 2022

Thanks, @kralewitz 👍

@ilyam8 ilyam8 merged commit 94850bc into netdata:master Jul 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants