Skip to content

Add support for Micrometer's new Observation API #1734

@jonatan-ivanov

Description

@jonatan-ivanov

Micrometer introduces a new set of APIs in its next minor version (1.10.0).
From the high level perspective this API is somewhat similar to a Timer in the sense that it measures elapsed time and you can start/stop your measurements.

The advantage of making measurements using the Observation API over the Timer is that you can attach arbitrary handlers (listeners) who can react to events during your observations, e.g.: an observation was started/stopped and error happened, etc. This makes possible not only recording metrics (delegating to a Timer) but also creating Spans (distributed tracing), attaching logs (audit, trace, perf, etc.) or doing any arbitrary thing that you want.

Basically you instrument your code once and you can get multiple things out of this instrumentation, you don't need multiple instrumentations.

We have a migration guide that can give more information and also examples for migrating from a Timer-based instrumentation to the Observation API.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalProposed Specification or API change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions