From 81219ba5408e1c67f5eaed3c7e566ede42da88d4 Mon Sep 17 00:00:00 2001 From: Aleksey Kashapov Date: Tue, 16 Apr 2024 16:18:20 +0300 Subject: [PATCH] TD-788: Fixes 'host' labels values in hackney metrics (#34) * TD-788: Fixes 'host' labels values in hackney metrics * Temporarily disables codecov report upload --- .github/workflows/erlang-checks.yml | 1 + src/woody_hackney_prometheus.erl | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/erlang-checks.yml b/.github/workflows/erlang-checks.yml index 300ca08..f29549f 100644 --- a/.github/workflows/erlang-checks.yml +++ b/.github/workflows/erlang-checks.yml @@ -36,3 +36,4 @@ jobs: rebar-version: ${{ needs.setup.outputs.rebar-version }} use-thrift: true thrift-version: ${{ needs.setup.outputs.thrift-version }} + upload-coverage: false diff --git a/src/woody_hackney_prometheus.erl b/src/woody_hackney_prometheus.erl index 310a381..193b011 100644 --- a/src/woody_hackney_prometheus.erl +++ b/src/woody_hackney_prometheus.erl @@ -90,15 +90,15 @@ increment_counter([hackney, nb_requests], Value) -> increment_counter([hackney, total_requests], Value) -> prometheus_counter:inc(registry(), ?TOTAL_REQUESTS, [], Value); increment_counter([hackney, Host, nb_requests], Value) -> - prometheus_gauge:inc(registry(), ?HOST_NB_REQUESTS, [{host, Host}], Value); + prometheus_gauge:inc(registry(), ?HOST_NB_REQUESTS, [Host], Value); increment_counter([hackney, Host, connect_timeout], Value) -> - prometheus_counter:inc(registry(), ?HOST_CONNECT_TIMEOUT, [{host, Host}], Value); + prometheus_counter:inc(registry(), ?HOST_CONNECT_TIMEOUT, [Host], Value); increment_counter([hackney, Host, connect_error], Value) -> - prometheus_counter:inc(registry(), ?HOST_CONNECT_ERROR, [{host, Host}], Value); + prometheus_counter:inc(registry(), ?HOST_CONNECT_ERROR, [Host], Value); increment_counter([hackney_pool, Host, new_connection], Value) -> - prometheus_counter:inc(registry(), ?HOST_NEW_CONNECTION, [{host, Host}], Value); + prometheus_counter:inc(registry(), ?HOST_NEW_CONNECTION, [Host], Value); increment_counter([hackney_pool, Host, reuse_connection], Value) -> - prometheus_counter:inc(registry(), ?HOST_REUSE_CONNECTION, [{host, Host}], Value); + prometheus_counter:inc(registry(), ?HOST_REUSE_CONNECTION, [Host], Value); increment_counter(_Name, _Value) -> ok. @@ -110,7 +110,7 @@ decrement_counter(Name) -> decrement_counter([hackney, nb_requests], Value) -> prometheus_gauge:dec(registry(), ?NB_REQUESTS, [], Value); decrement_counter([hackney, Host, nb_requests], Value) -> - prometheus_gauge:dec(registry(), ?HOST_NB_REQUESTS, [{host, Host}], Value); + prometheus_gauge:dec(registry(), ?HOST_NB_REQUESTS, [Host], Value); decrement_counter(_Name, _Value) -> ok.