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

OpenTelemetryModule is experimental #10591

Open
DNVindhya opened this issue Oct 5, 2023 · 4 comments · Fixed by #11173
Open

OpenTelemetryModule is experimental #10591

DNVindhya opened this issue Oct 5, 2023 · 4 comments · Fixed by #11173
Assignees
Labels
experimental API Issue tracks stabilizing an experimental API
Milestone

Comments

@DNVindhya
Copy link
Contributor

No description provided.

@DNVindhya DNVindhya added the experimental API Issue tracks stabilizing an experimental API label Oct 5, 2023
@DNVindhya DNVindhya self-assigned this Oct 5, 2023
@ejona86 ejona86 added this to the Next milestone Oct 6, 2023
@ejona86
Copy link
Member

ejona86 commented May 7, 2024

Notes from API review on 2024-05-02:

  • Rename to GrpcOpenTelemetry
  • Prefer keeping the current API that requires passing the channel/server builders to GrpcOpenTelemetry. We could have an additional indirection to power channelBuilder.addPlugin(openTelemetryPlugin), but we preferred the existing clear-but-less-pretty approach. It can always be done in the future

ejona86 added a commit to ejona86/grpc-java that referenced this issue May 7, 2024
OpenTelemetryModule is renamed to GrpcOpenTelemetry. The Builder is now
`final`, although that should only impact mocks as it had a private
constructor.

Fixes grpc#10591
ejona86 added a commit that referenced this issue May 8, 2024
OpenTelemetryModule is renamed to GrpcOpenTelemetry. The Builder is now
`final`, although that should only impact mocks as it had a private
constructor.

Fixes #10591
ejona86 added a commit to ejona86/grpc-java that referenced this issue May 9, 2024
OpenTelemetryModule is renamed to GrpcOpenTelemetry. The Builder is now
`final`, although that should only impact mocks as it had a private
constructor.

Fixes grpc#10591
ejona86 added a commit that referenced this issue May 9, 2024
OpenTelemetryModule is renamed to GrpcOpenTelemetry. The Builder is now
`final`, although that should only impact mocks as it had a private
constructor.

Fixes #10591
@ejona86
Copy link
Member

ejona86 commented May 14, 2024

Reopening for GrpcOpenTelemetry.registerGlobal(), which at least needs documentation updates. But I think there's some details still to work out with how the global works.

@ejona86 ejona86 reopened this May 14, 2024
@surbhigarg92
Copy link

@ejona86 I am trying to use GrpcOpenTelemetry.registerGlobal() and I am getting error java.lang.IllegalStateException: Configurators are already set . I am using it with Spanner Client library and registering the GrpcOpenTelemetry before instantiating Spanner Client .
Please refer the code below.

SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
        .registerMetricReader(
            PeriodicMetricReader.builder(GoogleCloudMetricExporter.createWithDefaultConfiguration())
                .build())
        .build();

    OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
        .setMeterProvider(sdkMeterProvider)
        .build();

    GrpcOpenTelemetry grpcOpenTelemetry = GrpcOpenTelemetry.newBuilder().enableMetrics(new HashSet<>(
        Arrays.asList("grpc.client.attempt.duration"))).sdk(openTelemetry).build();
    grpcOpenTelemetry.registerGlobal();
    
    SpannerOptions options = SpannerOptions.newBuilder()
        .setOpenTelemetry(openTelemetry)
        .build();
    Spanner spanner = options.getService();

@Kresshy
Copy link

Kresshy commented Oct 3, 2024

I'm running into this but instead of the Spanner client we have this issue with the logging appender, StackdriverAppender.

Logger is a static field in our codebase and it is getting initialized before everything else. Logging is happening through gRPC and as far as I can tell when it creates the ManagedChannelImplBuilder it calls into the InternalConfiguratorRegistry.configureChannelBuilder(), which obviously will freeze the config when iterating through the existing configurators via ConfiguratorRegistry.getDefaultRegistry().getConfigurators().

I think this is expected but all these problems make it hard to use this library with other Google Cloud Libraries. By the time you get to initialize the OTEL SDK and GrpcOpenTelemetry and you have to call grpcOpenTelemetry.registerGlobal(); potentially when you do this the configurators are already set or frozen.

Is there any other way to initialize grpc opentelemetry and still collect the metrics plus the traces from the grpc service endpoints?

Would it be possible to make the configurators mutable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental API Issue tracks stabilizing an experimental API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants