Skip to content

chore(o11y): remove beta api from observability classes#12747

Open
blakeli0 wants to merge 2 commits intomainfrom
refactor-otel-metrics-factory
Open

chore(o11y): remove beta api from observability classes#12747
blakeli0 wants to merge 2 commits intomainfrom
refactor-otel-metrics-factory

Conversation

@blakeli0
Copy link
Copy Markdown
Contributor

@blakeli0 blakeli0 commented Apr 10, 2026

This PR remove @BetaApi from observability classes. @InternalApi annotations are also removed because they are either package private or need to be used externally.

@blakeli0 blakeli0 requested a review from a team as a code owner April 10, 2026 14:40
…ervability classes and make factory mutable
@blakeli0 blakeli0 force-pushed the refactor-otel-metrics-factory branch from 1038937 to 5a29bdb Compare April 10, 2026 14:41
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request promotes OpenTelemetryMetricsFactory to the public API and refactors its unit tests to use concrete objects instead of mocks. The review identifies a potential thread-safety issue with the clientLevelTracerContext field and suggests caution when removing API stability annotations. Additionally, the reviewer noted that the test refactoring removed a verification step for context merging, which should be restored to maintain adequate test coverage.

I am having trouble creating individual review comments. Click here to see my feedback.

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/OpenTelemetryMetricsFactory.java (41-42)

high

Removing @InternalApi and @BetaApi promotes this class to the public stable API. Avoid introducing breaking changes to public APIs, even if they have not been part of a public release. Additionally, the clientLevelTracerContext field is not volatile, which can lead to thread-safety issues if the factory is shared across threads. Please ensure the field is volatile or that access is properly synchronized.

References
  1. Avoid introducing breaking changes to public APIs, even if they have not been part of a public release.

sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/tracing/OpenTelemetryMetricsFactoryTest.java (82)

medium

The test coverage has been weakened by removing the verify call. The current assertion only checks that the returned object is an instance of OpenTelemetryMetricsTracer, but it no longer verifies that the clientLevelTracerContext and methodLevelTracerContext are correctly merged. Please restore the verification logic to ensure the merging logic is correctly exercised.

@blakeli0 blakeli0 changed the title refactor(o11y): make OpenTelemetryMetricsFactory mutable and remove internal annotations chore(o11y): remove beta api from observability classes Apr 10, 2026
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.

1 participant