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

MeterProvider that delegates to Micrometer MeterRegistry #328

Merged
merged 21 commits into from
May 24, 2022

Conversation

HaloFour
Copy link
Contributor

@HaloFour HaloFour commented May 6, 2022

Description:

Feature addition - Adds an implementation of OpenTelemetry Metrics MeterProvider which wraps and delegates metrics to Micrometer 1.x MeterRegistry. This is to allow an existing project with an investment in Micrometer to iteratively migrate to OpenTelemetry without having to replace existing infrastructure code.

Existing Issue(s):

N/A

Outstanding items:

  • Tests
  • Documentation

@HaloFour HaloFour changed the title Initial commit of OTel MeterProvider that delegates to Micrometer MeterRegistry MeterProvider that delegates to Micrometer MeterRegistry May 6, 2022
@HaloFour HaloFour marked this pull request as ready for review May 6, 2022 23:41
@HaloFour HaloFour requested a review from a team May 6, 2022 23:41
@trask
Copy link
Member

trask commented May 13, 2022

Thanks @HaloFour!

Are you able to be a component owner for this? If so, can you update https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/.github/component_owners.yml in this PR?

I'd suggest renaming the top-level directory from micrometer-metrics to micrometer-meter-provider just to help avoid confusion from the "recommended" interop solution which is the micrometer shim in the core repo.

@HaloFour
Copy link
Contributor Author

Hey @trask!

I wouldn't mind being a component owner for this at all. I've updated the component_owners file and renamed the module as suggested.

Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

Sorry for a late review, it took me a while to find some time to sit down and read through this PR. Left a couple of comments; but overall it looks like a very nice addition to the contrib repo 👍

import io.opentelemetry.contrib.metrics.micrometer.internal.state.MeterSharedState;
import javax.annotation.Nullable;

abstract class AbstractInstrumentBuilder<BuilderT extends AbstractInstrumentBuilder<BuilderT>> {
Copy link
Member

Choose a reason for hiding this comment

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

We're usually using UPPERCASE names for type parameters:

Suggested change
abstract class AbstractInstrumentBuilder<BuilderT extends AbstractInstrumentBuilder<BuilderT>> {
abstract class AbstractInstrumentBuilder<BUILDER extends AbstractInstrumentBuilder<BUILDER>> {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's my preferred format as well, either spotless or checkstyle disagreed and required this format.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting... looks like we might have inconsistent errorprone configs between this repo and instrumentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the warning:

warning: [TypeParameterNaming] Type Parameter BUILDER must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter 'T'.
abstract class AbstractInstrumentBuilder<BUILDER extends AbstractInstrumentBuilder<BUILDER>> {

                                         ^
    (see https://google.github.io/styleguide/javaguide.html#s5.2.8-type-variable-names)
  Did you mean 'abstract class AbstractInstrumentBuilder<BuilderT extends AbstractInstrumentBuilder<BuilderT>> {' or 'abstract class AbstractInstrumentBuilder<B extends AbstractInstrumentBuilder<B>> {'?
error: warnings found and -Werror specified

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in #348

@trask trask closed this in #348 May 20, 2022
@trask
Copy link
Member

trask commented May 20, 2022

oh, that was unexpected, re-opening

@trask trask reopened this May 20, 2022
@HaloFour HaloFour force-pushed the micrometer-metrics branch from 0b88d25 to befdef4 Compare May 20, 2022 20:54
Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! 👍

@trask trask merged commit 29f5ce1 into open-telemetry:main May 24, 2022
@trask
Copy link
Member

trask commented May 24, 2022

thx @HaloFour!

@HaloFour HaloFour deleted the micrometer-metrics branch May 24, 2022 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants