opentracing-contrib / java-metrics

Apache License 2.0
31 stars 9 forks source link

Identifying when metrics should be reported #18

Open objectiser opened 7 years ago

objectiser commented 7 years ago

Currently when metric labels result in a null value, it is used to indicate the metric should not be recorded (reported).

However there is also a requirement to support 'optional' labels in #6 so that not all labels need to be reported for a particular sampled metric (although Prometheus requires a fixed set of labels).

Therefore may be better to have an explicit predicate used to determine whether a metric should be reported. The default could be based on the same behavour as now, i.e. if the 'span.kind' tag has been defined.

The predicate could be explicitly specified when building the reporter.

For prometheus, if the predicate indicates that a metric should be reported, but one or more of the labels result in null values, then an empty string should be used as the value.