Skip to content

refactor: remove the usages of SpanName constructor of TracedUnaryCallable - #12948

Merged
blakeli0 merged 7 commits into
mainfrom
remove-span-name-constructor
Apr 30, 2026
Merged

refactor: remove the usages of SpanName constructor of TracedUnaryCallable#12948
blakeli0 merged 7 commits into
mainfrom
remove-span-name-constructor

Conversation

@blakeli0

@blakeli0blakeli0 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

This PR removes the usages of SpanName constructor of TracedUnaryCallable, and migrates all usages to use ApiTracerContext instead.

The constructor is now marked as @ObsoleteApi and it should be removed once the usages in downstream libraries (java-bigtable) are removed.

@blakeli0
blakeli0 requested a review from a team as a code ownerApril 29, 2026 02:48

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

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 refactors the tracing logic to make ApiTracerContext mandatory for TracedUnaryCallable and TracedOperationInitialCallable, replacing the previous reliance on SpanName. The changes simplify the futureCall method and update associated tests to align with the new context-based tracing. Feedback suggests further cleanup by removing the now-unused spanName field and SPAN_NAME constants, and recommends adding a convenience constructor to TracedUnaryCallable to avoid passing explicit nulls for the resource name extractor.

Comment on lines 57 to 59


public TracedUnaryCallable(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding a 3-argument constructor for TracedUnaryCallable that omits the ResourceNameExtractor. This would simplify usage in cases where an extractor is not needed, such as in TracedOperationInitialCallable and various test cases.

publicTracedUnaryCallable(
UnaryCallable<RequestT, ResponseT> innerCallable,
ApiTracerFactorytracerFactory,
ApiTracerContextapiTracerContext) {
this(innerCallable, tracerFactory, apiTracerContext, null);
}

@blakeli0blakeli0 changed the title refactor: remove SpanName constructor from TracedUnaryCallablerefactor: remove the usages of SpanName constructor of TracedUnaryCallableApr 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate FailedQuality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate FailedQuality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@blakeli0
blakeli0 merged commit a125829 into mainApr 30, 2026
205 of 210 checks passed
@blakeli0
blakeli0 deleted the remove-span-name-constructor branch April 30, 2026 17:38
lqiu96 pushed a commit that referenced this pull request Apr 30, 2026
…lable (#12948)
This PR removes the usages of SpanName constructor of
TracedUnaryCallable, and migrates all usages to use ApiTracerContext
instead.
The constructor is now marked as `@ObsoleteApi` and it should be removed
once the usages in downstream libraries (java-bigtable) are removed.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for freeto 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.

2 participants

@blakeli0@diegomarquezp