Skip to content

OpenTelemetry Semantic Conventions for JVM metrics #5286

Closed

Description

@lenin-jaganathan

Please describe the feature request.
In open-telemetry/semantic-conventions#569, OpenTelemetry has made JVM metrics stable. It makes sense to adopt the stable semantic convention for OTLPMeterRegistry to keep in line with the OTEL Semantic Convention.

Additional context
Related links,

Activity

  1. shakuzen commented on Jul 4, 2024

    @shakuzen
    Member

    Since in Micrometer we consider changing existing meter names and tags a breaking change, I'm not sure how we would do this outside a new major version. Any ideas?

    It makes sense to adopt the stable semantic convention for OTLPMeterRegistry to keep in line with the OTEL Semantic Convention.

    I also wouldn't tie a wire format (OTLP) to a semantic convention - I think they should be separate decisions. It should be valid to use OpenTelemetry semantic conventions with a format other than OTLP and it should be valid to use OTLP without using the OpenTelemetry semantic conventions.

  2. ntkoopman commented on Jul 17, 2024

    @ntkoopman

    Add additional OTEL specific MeterBinder implementations in addition to the JVM ones?
    Or add an option to the current ones to output the updated OTEL conventions and leave it to the user to set it?

  3. lenin-jaganathan commented on Jul 17, 2024

    @lenin-jaganathan
    ContributorAuthor

    I am working on something within our organization. It is a bit of hybrid approach with using MeterFilter for renaming existing things and an additional MeterBinder for missing pieces. I can create a follow-up PR if we agree on the approach in this issue.

    Yeah, this should be a opt-in thing for the reason @shakuzen mentioned above.

  4. jonatan-ivanov commented on Jul 17, 2024

    @jonatan-ivanov
    Member

    As an alternative to the MeterFilter, I think using a mechanism that is somewhat similar to ObservationConvention might work too but's that is a bigger change and it includes new public API components.

  5. changed the title [-]Adopt Stable OTEL Semantic Conventions for JVM metrics[/-] [+]Option to configure OTEL Semantic Conventions for JVM metrics[/+] on Dec 16, 2024
  6. added
    enhancement
    module: micrometer-core
    instrumentation
    and removed on Dec 16, 2024
  7. added this to the 1.x milestone on Dec 16, 2024
  8. shakuzen commented on Dec 16, 2024

    @shakuzen
    Member

    I've updated the labels and issue title. I suppose the most basic implementation might be to add a constructor argument (boolean?) to the relevant MeterBinder implementations so users can choose whether to use the otel semantic conventions for the relevant metrics provided by the MeterBinder. A concern I have is around future changes to the semantic conventions and how we could support that. We are planning to work on addressing that with ObservationConventions, but metrics (not through the Observation API) are outside of the scope of that. Making a MeterFilter is another option, but I think that might be more brittle than something in the MeterBinders themselves - it might depend on being configured in a certain order relative to other MeterFilters. So, I think we're still up for discussing options if anyone has ideas.

  9. alexgenon commented on Apr 16, 2025

    @alexgenon

    Hi,
    @shakuzen last comment summarizes really well the situation.
    Not only updating the relevant MeterBinder will be more robust than going for the MeterFilter option, it will also be easier to understand and reduce the cognitive load.

    As for the question about the future changes in the semantic convention, why don't we adopt the same approach than the opentelemetry-java project, where a version of the project relies on a set version of the semantic convention ?

  10. jonatan-ivanov commented on Apr 16, 2025

    @jonatan-ivanov
    Member

    As for the question about the future changes in the semantic convention, why don't we adopt the same approach than the opentelemetry-java project, where a version of the project relies on a set version of the semantic convention ?

    I think that would be the way to go but I'm not sure I see what question you are replying to.
    If it is this one:

    Since in Micrometer we consider changing existing meter names and tags a breaking change, I'm not sure how we would do this outside a new major version. Any ideas?

    I'm afraid what you are suggesting does not help, changing the existing meter names is still a breaking change.

  11. alexgenon commented on Apr 17, 2025

    @alexgenon

    I was trying to answer the question about how keeping up with the changes in the semantic convention and keep Micrometer aligned.

    I'm afraid what you are suggesting does not help, changing the existing meter names is still a breaking change.

    I understand this as changing from Micrometer original names to the Semantic Convention being a breaking change. If we consider the idea of using the semantic convention as an opt-in feature (by default keep the Micrometer original names for metrics and attributes) then does it still need to be a breaking change?

  12. jonatan-ivanov commented on Apr 17, 2025

    @jonatan-ivanov
    Member

    The feature being opt-in would definitely work but today we don't have a mechanism for this (assuming OTel does not break things in stable releases).
    This mechanism is what we were discussing above in #5286 (comment) and #5286 (comment)

  13. shakuzen commented on Apr 21, 2025

    @shakuzen
    Member

    keeping up with the changes in the semantic convention and keep Micrometer aligned.

    The issue comes down to expectations. While some users may expect the instrumentation to keep up with changes in conventions, others will expect their metrics dashboards and alerts don't stop working because they upgraded the version of Micrometer. Unlike an API/ABI incompatible change, the compiler/JVM can't warn them about convention breaking changes and it's easy to deploy to production and only realize the consequences afterward. That is why I suggest a better solution would account for the possibility of future breaking changes and make the choice more clear to users in some way. What way is the hard part.

  14. shakuzen commented on Sep 2, 2025

    @shakuzen
    Member

    I'm working on a proposal in #6682. Feedback is welcome.

  15. modified the milestones: 1.x, 1.16.0-M3 on Sep 9, 2025
  16. changed the title [-]Option to configure OTEL Semantic Conventions for JVM metrics[/-] [+]OpenTelemetry Semantic Conventions for JVM metrics[/+] on Sep 9, 2025
  17. shakuzen commented on Sep 9, 2025

    @shakuzen
    Member

    Note that #6682 did not include supporting the OTel semconv for GC time, as there were some things to figure out and we ran out of time for M3. We can follow-up with this, depending on demand for it.

  18. shakuzen commented on Sep 18, 2025

    @shakuzen
    Member

    A solution for this was released in 1.16.0-M3. We're looking for feedback on this to make sure what we have makes sense for the upcoming GA release. The sooner we can get feedback the better. Anyone who was looking for this feature, please try it out in the milestone and let us know if it works well for you or could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementinstrumentationmodule: micrometer-core

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions