@Observed by jonatan-ivanov · Pull Request #3221 · micrometer-metrics/micrometer (original) (raw)

Why aren't we allowing to set highCardinalityKeyValues ?

Because attribute values of annotations must be constants, you can't have dynamic values since you can't even call a method there, only literals and constants are allowed.

Does it make any sense?

It makes sense to me. I did write a PoC and also proposed a PR for a pretty similar feature for @Timed years ago 😄, see #1586

Check out the issue (there is also a PR), the PoC tries to do two things:

  1. Add an @ExtraTag annotation which is like @SpanTag in Sleuth and somewhat can cover the Object[]/Method/JointPont scenario that you mentioned above.
  2. An ExtraTagsPropagation class which is similar to Sleuth 2's ExtraFieldPropagation.

I think if we want to do something like this (I think it would be a nice feature) we should keep @Timed and @Observed in feature parity to a degree.
Also, I think we should discuss about two things in terms of @Observed:

  1. Setting keyvalues based on the jointpoint/method/params (an extra annotation can cover that, see above)
  2. Setting keyvalues based on the context

Can we move this to a separate issue/PR?