Skip to content

refactor(o11y): merge SpanTracer and SpanManager#4158

Merged
blakeli0 merged 3 commits intomainfrom
observability/tracing/flatten-tracer-manager
Mar 20, 2026
Merged

refactor(o11y): merge SpanTracer and SpanManager#4158
blakeli0 merged 3 commits intomainfrom
observability/tracing/flatten-tracer-manager

Conversation

@diegomarquezp
Copy link
Contributor

No description provided.

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Mar 19, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the observability tracing components by streamlining the integration with OpenTelemetry. It removes an unnecessary abstraction layer, allowing SpanTracer and its factory to interact directly with OpenTelemetry's core tracing API. This change simplifies the codebase, reduces maintenance overhead, and aligns the tracing implementation more closely with standard OpenTelemetry practices.

Highlights

  • Tracing Abstraction Removal: The TraceManager interface and its OpenTelemetry implementation, OpenTelemetryTraceManager, have been removed, simplifying the tracing architecture.
  • Direct OpenTelemetry Integration: The SpanTracer and SpanTracerFactory now directly utilize OpenTelemetry's Tracer and Span objects, eliminating an intermediate abstraction layer.
  • Refactored Span Creation: Span creation logic within SpanTracer has been updated to directly use Tracer.spanBuilder() and startSpan() methods.
  • Updated Test Suite: Corresponding test files have been updated to reflect the direct OpenTelemetry integration, including changes to mocks and attribute assertions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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

The pull request refactors the tracing implementation by removing the custom TraceManager interface and its OpenTelemetryTraceManager implementation. The SpanTracer and SpanTracerFactory classes are updated to directly use OpenTelemetry's Tracer and Span APIs, simplifying the codebase by removing an abstraction layer. Test files have been updated accordingly. A review comment suggests improving code consistency in SpanTracerFactory.java by using String.format for attemptSpanName construction.

@diegomarquezp diegomarquezp marked this pull request as ready for review March 19, 2026 20:45
public SpanTracerFactory(TraceManager traceManager) {
this(traceManager, ApiTracerContext.empty());
public SpanTracerFactory(OpenTelemetry openTelemetry) {
this(openTelemetry.getTracer("gax-java"), ApiTracerContext.empty());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe not part of this PR, we want to create a tracer with artifact name and version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.


SpanTracer spanTracer = new SpanTracer(traceManager, this.apiTracerContext, attemptSpanName);
return spanTracer;
return new SpanTracer(tracer, this.apiTracerContext, attemptSpanName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of this PR, I think we should reconsider the need of overriding newTracer(ApiTracer parent, SpanName spanName, OperationType operationType) in all factories. Since we don't have all the info in this scenario, I think we should just return a no-op tracer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
81.1% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@blakeli0 blakeli0 merged commit e0a33f2 into main Mar 20, 2026
57 checks passed
@blakeli0 blakeli0 deleted the observability/tracing/flatten-tracer-manager branch March 20, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants