Skip to content

Support KeyValues with annotations when using ObservedAspect / @Observed #4030

@Saljack

Description

@Saljack

Please describe the feature request.
If you use @Observed there is no easy way to set up method parameters as high or low cardinality keys. You need to get Observation where you can set up it (for example by ObservationRegistry#getCurrentObservation()). It would be nice to add support for marking parameters as high or low cardinality keys. I would propose creating a new annotation @CardinalityKey which can be used to mark a parameter as a cardinality key (for example for HTTP requests it can create high and low cardinality keys). This annotation can be easily processed in the ObservedAspect.

@Observed(name = "something")
public void send(@CardinalityKey(name = "destination") String destinationName, Object message) {
  // ...
}

Rationale
I need to distinguish different calls of methods by parameters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions