Skip to content
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

Polishing Observation API #3425

Merged

Conversation

jonatan-ivanov
Copy link
Member

@jonatan-ivanov jonatan-ivanov commented Sep 20, 2022

  • DocumentedObservation.createNotStarted -> observation (to make it consistent with others)
  • ObservationRegistry.observationConvention: removed varargs
  • Make getObservationConvention and isObservationEnabled package-private in the ObservationRegistry (should not be used)
  • Make getError return Throwable

default <T extends Observation.Context> Observation createNotStarted(
@Nullable ObservationConvention<T> customConvention, @NonNull ObservationConvention<T> defaultConvention,
@NonNull Supplier<T> contextSupplier, @NonNull ObservationRegistry registry) {
default <T extends Observation.Context> Observation observation(@Nullable ObservationConvention<T> customConvention,
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's discuss if we want to rename this class.
@shakuzen Did you get some feedback on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we rename existing observation to createNotStarted?
Either way, it is better to be unified.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yepp, that's why the let's discuss comment.
I think:

  1. If we want to keep the class name as-is: it is better to rename everything to createNotStarted
  2. If we want to rename the class to ObservationDocumentation (or similar): it is better to rename everything to observation
  3. If we want to keep changes minimal: what I did

I think the best would be # 2 but it is also the most invasive.

Copy link
Member

Choose a reason for hiding this comment

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

I think ObservationDocumentation better expresses what the interface is for and makes it clear that it is not an Observation itself. The feedback I got so far was that they agreed with that. I think it will be easier to consider that change in a separate pull request, though, so we don't block making the rest of these changes.

@jonatan-ivanov jonatan-ivanov requested review from marcingrzejszczak, shakuzen and ttddyy and removed request for marcingrzejszczak and shakuzen September 20, 2022 22:09
@jonatan-ivanov jonatan-ivanov added polish A general improvement (naming things, fixing minor issues, etc.) breaking-change labels Sep 20, 2022
@jonatan-ivanov jonatan-ivanov added this to the 1.10.0-RC1 milestone Sep 20, 2022
@marcingrzejszczak
Copy link
Contributor

BTW if we're chaning the DocumetedObservation to ObservationDocumentation we also need to change the DocumentedMeter to MeterDocumentation and in tracing the DocumentedSpan to SpanDocumentation. Also the code in micrometer-docs-generator needs to be updated

@sonatype-lift
Copy link
Contributor

sonatype-lift bot commented Sep 26, 2022

⚠️ 10 God Classes were detected by Lift in this project. Visit the Lift web console for more details.

@jonatan-ivanov jonatan-ivanov changed the title Polishing Observability API Polishing Observation API Sep 26, 2022
@shakuzen shakuzen merged commit e85b1a6 into micrometer-metrics:main Sep 27, 2022
@jonatan-ivanov jonatan-ivanov deleted the observability-api-polish branch September 27, 2022 06:04
shakuzen added a commit to micrometer-metrics/tracing that referenced this pull request Sep 27, 2022
The return type is no longer an Optional, but the Throwable directly or null.

See micrometer-metrics/micrometer#3425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change module: micrometer-observation polish A general improvement (naming things, fixing minor issues, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants