Skip to content

Conversation

@shakuzen
Copy link
Member

@shakuzen shakuzen commented Feb 3, 2022

Adds a new concept and API for Observation which has the behavior that was previously retrofitted onto Timer.Sample. That retrofitting has been reverted and the relevant API introduced as Observation. We reached the limits of expanding what Timer.Sample meant. Hopefully Observation will be reduce any confusion by offering a new API without any historical meaning.

TODO: Add more description and linked issues.

jonatan-ivanov and others added 7 commits January 28, 2022 14:06
* We moved out all the getters - this API will provide a nice way to set things ON THE CONTEXT
* We've added additionalLowCardinality and high cardinliaty tags on the context, tagsprovider is immutable
* We removed timing information - there's no gain in unifying the time (e.g. same time for metrics & spans). It's up to the handlers
to take control of doing measurements. If a handler is buggy we will see that in its timing information.
* We removed the throwable getter to explicitly pass the throwable to the handler - that's the only parameter that will never change (onError - you have to have an error there)
…aning up (fixing imports, checkstyle issues, license, etc.)
Keeps only one registry implementation while still providing a specific type for ObservationRegistry where Observation-specific concerns can be defined. Forces instantiation of Observation through its static methods so there is no direct instantiation by users. This provides fewer ways to do the same thing and exposes API, which should help guide users and hide implementation details.
MeterRegistry implements ObservationRegistry, static factory methods
@shakuzen shakuzen added this to the 2.0.0-M2 milestone Feb 3, 2022
private final More more = new More();
private final ThreadLocal<Timer.Sample> localSample = new ThreadLocal<>();

private final ThreadLocal<Observation> localObservation = new ThreadLocal<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

ThreadLocalUsage: ThreadLocals should be stored in static fields (details)
(at-me in a reply with help or ignore)

@marcingrzejszczak marcingrzejszczak merged commit f93d808 into micrometer-metrics:2.0.x Feb 3, 2022
@jonatan-ivanov jonatan-ivanov deleted the observation-api-more-stateful branch February 3, 2022 17:05
@jonatan-ivanov jonatan-ivanov restored the observation-api-more-stateful branch February 11, 2022 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants