caas-team / sparrow

A monitoring tool to gather infrastructure network information
Apache License 2.0
6 stars 4 forks source link

feat: fix dangaling metrics regading status code #146

Closed y-eight closed 3 weeks ago

y-eight commented 3 weeks ago

Motivation

Referes to https://github.com/caas-team/sparrow/issues/133

Changes

The metric sparrow_latency_duration_seconds will now be clear before the new duration with label status is exposed. Dangling metrics that do not show the current status are cleared up.

Additionally, I have introduced two new metrics like @puffitos suggested.

For additional information look at the commits.

Tests done

First run:

# TYPE sparrow_latency_duration_seconds gauge
sparrow_latency_duration_seconds{status="200",target="https://gitlab.devops.telekom.de"} 0.222653973
sparrow_latency_duration_seconds{status="200",target="https://httpstat.us/random/200,500-504"} 0.711660485
sparrow_latency_duration_seconds{status="418",target="https://yam.telekom.de"} 0.214198665

Second run:

# TYPE sparrow_latency_duration_seconds gauge
sparrow_latency_duration_seconds{status="200",target="https://gitlab.devops.telekom.de"} 0.24624422
sparrow_latency_duration_seconds{status="418",target="https://yam.telekom.de"} 0.212984192
sparrow_latency_duration_seconds{status="502",target="https://httpstat.us/random/200,500-504"} 0.69023805

TODO

puffitos commented 3 weeks ago

@y-eight I've added a simple hint, which metric will replace the deprecated one.