diff options
| author | Frank Ch. Eigler <fche@redhat.com> | 2020-03-26 16:44:20 -0400 |
|---|---|---|
| committer | Frank Ch. Eigler <fche@redhat.com> | 2020-03-27 10:55:50 -0400 |
| commit | 0b9eb740eb8cd86ce3bffd0278135eba98c2e8a2 (patch) | |
| tree | fcce2fa9bf21d3520e0059ff859e918d04c9b4e4 /debuginfod | |
| parent | 426a000dc59bd824de86d20b1e4d772340031067 (diff) | |
| download | platform_external_elfutils-0b9eb740eb8cd86ce3bffd0278135eba98c2e8a2.tar.gz platform_external_elfutils-0b9eb740eb8cd86ce3bffd0278135eba98c2e8a2.tar.bz2 platform_external_elfutils-0b9eb740eb8cd86ce3bffd0278135eba98c2e8a2.zip | |
PR25448: debuginfod: add transfer performance metrics
We now export metrics related to the time taken and data sent,
from which prometheus type tools can compute nice time series
with averages.
http_responses_duration_milliseconds_count{code="200"} 63
http_responses_duration_milliseconds_count{code="404"} 2
http_responses_duration_milliseconds_count{code="503"} 1
http_responses_duration_milliseconds_sum{code="200"} 66
http_responses_duration_milliseconds_sum{code="404"} 2
http_responses_duration_milliseconds_sum{code="503"} 0
http_responses_transfer_bytes_count{code="200"} 63
http_responses_transfer_bytes_count{code="404"} 2
http_responses_transfer_bytes_count{code="503"} 1
http_responses_transfer_bytes_sum{code="200"} 425177
http_responses_transfer_bytes_sum{code="404"} 18
http_responses_transfer_bytes_sum{code="503"} 37
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Diffstat (limited to 'debuginfod')
| -rw-r--r-- | debuginfod/ChangeLog | 5 | ||||
| -rw-r--r-- | debuginfod/debuginfod.cxx | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 58ba85cf..989a9029 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,5 +1,10 @@ 2020-03-26 Frank Ch. Eigler <fche@redhat.com> + * debuginfod.cxx (handler_cb): Export two families of metrics for + prometheus traffic analysis: response times and data amounts. + +2020-03-26 Frank Ch. Eigler <fche@redhat.com> + * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb after all if access(3)-able, fallback to bsdtar. diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 9e8d5560..98491c2c 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1767,6 +1767,7 @@ handler_cb (void * /*cls*/, inc_metric("http_responses_total","result","error"); e.report(clog); http_code = e.code; + http_size = e.message.size(); rc = e.mhd_send_response (connection); } @@ -1778,6 +1779,17 @@ handler_cb (void * /*cls*/, << ' ' << (int)(deltas*1000) << "ms" << endl; + // related prometheus metrics + string http_code_str = to_string(http_code); + if (http_size >= 0) + add_metric("http_responses_transfer_bytes_sum","code",http_code_str, + http_size); + inc_metric("http_responses_transfer_bytes_count","code",http_code_str); + + add_metric("http_responses_duration_milliseconds_sum","code",http_code_str, + deltas*1000); // prometheus prefers _seconds and floating point + inc_metric("http_responses_duration_milliseconds_count","code",http_code_str); + return rc; } |
