Skip to content

feat(v2): add callctx telemetry helpers#472

Merged
quartzmo merged 4 commits intogoogleapis:mainfrom
quartzmo:telemetry-context
Mar 5, 2026
Merged

feat(v2): add callctx telemetry helpers#472
quartzmo merged 4 commits intogoogleapis:mainfrom
quartzmo:telemetry-context

Conversation

@quartzmo
Copy link
Copy Markdown
Member

@quartzmo quartzmo commented Mar 4, 2026

Replace gRPC metadata Context management with new telemetry Context helpers.

Replace gRPC metadata Context management with new telemetry Context helpers.
@quartzmo quartzmo requested a review from a team as a code owner March 4, 2026 18:20
quartzmo added a commit to quartzmo/gapic-generator-go that referenced this pull request Mar 4, 2026
Replace gRPC metadata Context management with new telemetry Context helpers.

refs: googleapis#1690
refs: googleapis/gax-go#472
Copy link
Copy Markdown
Contributor

@westarle westarle left a comment

Choose a reason for hiding this comment

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

One thing to consider is a test after Invoke that only known fields are set (by calling some test helper like callctx.ValidateTelemetryAttributesForTests)

// telemetryKey is a private type used to store/retrieve telemetry context values.
type telemetryKey string

// WithTelemetryContext injects telemetry attributes values (like resource name
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.

nit

Suggested change
// WithTelemetryContext injects telemetry attributes values (like resource name
// WithTelemetryContext injects telemetry attribute values (like resource name

@quartzmo
Copy link
Copy Markdown
Member Author

quartzmo commented Mar 5, 2026

One thing to consider is a test after Invoke that only known fields are set (by calling some test helper like callctx.ValidateTelemetryAttributesForTests)

Because the Go context package deliberately hides its internal state and does not provide an iterator or reflection mechanism over its linked list of values, we cannot inspect the context to see what other keys might be present. We can only test for specific keys.

@quartzmo quartzmo merged commit fa319ff into googleapis:main Mar 5, 2026
5 checks passed
@quartzmo quartzmo deleted the telemetry-context branch March 5, 2026 21:50
quartzmo added a commit to quartzmo/google-cloud-go that referenced this pull request Mar 5, 2026
Enable grpctransport and httptransport to inject static attributes,
capture dynamic attributes from context, and enforce error semantics.

refs: googleapis/gax-go#472
refs: googleapis/gapic-generator-go#1706
quartzmo added a commit to quartzmo/google-cloud-go that referenced this pull request Mar 5, 2026
Enable grpctransport and httptransport to inject static attributes,
capture dynamic attributes from context, and enforce error semantics.

refs: googleapis/gax-go#472
refs: googleapis/gapic-generator-go#1706
quartzmo added a commit to quartzmo/google-cloud-go that referenced this pull request Mar 5, 2026
Enable grpctransport and httptransport to inject static attributes,
capture dynamic attributes from context, and enforce error semantics.

refs: googleapis/gax-go#472
refs: googleapis/gapic-generator-go#1706
quartzmo added a commit to quartzmo/google-cloud-go that referenced this pull request Mar 5, 2026
Enable grpctransport and httptransport to inject static attributes,
capture dynamic attributes from context, and enforce error semantics.

refs: googleapis/gax-go#472
refs: googleapis/gapic-generator-go#1706
quartzmo added a commit to googleapis/google-cloud-go that referenced this pull request Mar 12, 2026
…14133)

Enable grpctransport and httptransport to inject static attributes,
capture dynamic attributes from context, and enforce error semantics.

refs: googleapis/gax-go#472
refs: googleapis/gapic-generator-go#1706
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