Skip to content

@Observed #3221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 23, 2022
Merged

@Observed #3221

merged 20 commits into from
Jun 23, 2022

Conversation

jonatan-ivanov
Copy link
Member

No description provided.

* Low cardinality key values.
* @return an array of low cardinality key values.
*/
String[] lowCardinalityKeyValues() default {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we allowing to set highCardinalityKeyValues ?

Also, shouldn't we give an option to provide a KeyValuesProvider class ? It would have to have a default constructor (when someone doesn't want to calculate the tags from the annotated method arguments) or (maybe) a constructor that takes in Object[] where the array would be mapped to methods arguments? Or even maybe also a Method argument? Does it make any sense? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@jonatan-ivanov jonatan-ivanov merged commit e7faf55 into micrometer-metrics:main Jun 23, 2022
@jonatan-ivanov jonatan-ivanov deleted the observed branch June 23, 2022 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants