-
Notifications
You must be signed in to change notification settings - Fork 1k
Labels
Milestone
Description
Applying KeyValue
s conditionally can lead into issues for example Prometheus require that all time-series (observation) with the same name have the same set of labels (low cardinality key names).
For example this can cause an error on if both branches (color = null
and color = "red"
) are executed.
if (color != null) {
observation.lowCardinalityKeyValue("color", color);
}
Instead of it, users should do something like this:
observation.lowCardinalityKeyValue("color", color != null ? color : "unknown");
We should make this easier for the users and harder to make this mistake.
See:
- Provide fallback for Observation KeyValues spring-projects/spring-data-mongodb#5020 (comment)
- https://gist.github.com/mp911de/6729ca327326d072820a1a0eb225c4a6
Validation could be also added: main...jonatan-ivanov:micrometer:validate-keyvalues
yybmion