Skip to content

Send zeros for failure false and true #24

@dirkjot

Description

@dirkjot

I think the plugin needs to send zero values in some cases. Specifically, when the first observation (value) for metric{sampler_name="spam", failure="false"} is created, a matching observation metric{sampler_name="spam", failure="true"} 0 should be emitted.

Sending zero seems not a common thing in Prometheus, usually we send nothing to indicate that no observations have been made. That is correct for (for example) sampler_name because having observations on sampler spam does not imply that sampler ham exists.

However, assertion success and failure are related in the human mind: with a for assertions, we expect the total assertions a_t to be the sum of successes a_s and failures a_f. Unlike the samplers, having any number of successes implies that we also have failures (possibly 0), and vice versa.

Currently, the expectation is correct most of the time, iff a_s > 0 & a_f > 0. If no failures have been found yet: a_t != a_s + <undefined> The solution is to set a_f = 0 if a_s is set/modified and a_f has not been set yet.

Use case: I have a Grafana panel with the number of failures in my nightly tests, based on metric{failures="true"}. If all goes very well, the number shows up as "n/a" because no failures have been found. Switching to display the number of successes will go wrong when all tests fail.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions