Skip to content

fix(o11y): create noop tracer when artifact ID is not set#12307

Merged
blakeli0 merged 2 commits intomainfrom
observability/fix/noop-when-no-artifact
Mar 30, 2026
Merged

fix(o11y): create noop tracer when artifact ID is not set#12307
blakeli0 merged 2 commits intomainfrom
observability/fix/noop-when-no-artifact

Conversation

@diegomarquezp
Copy link
Copy Markdown
Contributor

@diegomarquezp diegomarquezp commented Mar 30, 2026

Description

This PR ensures that fallback logic is consistently applied across observability tracers when the client library metadata—specifically the artifactName—is omitted or invalid. If the artifactName is missing, the factories will safely return a no-op (base) tracer.

Key Changes

  • Added an early return in GoldenSignalsMetricsTracerFactory.withContext() to fallback to BaseApiTracerFactory when the ApiTracerContext or artifactName is missing, mirroring SpanTracerFactory.
  • Increased testing coverage in SpanTracerFactoryTest and GoldenSignalsMetricsTracerFactoryTest to explicitly validate tracer initialization under empty and null metadata conditions.

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 introduces validation logic to GoldenSignalsMetricsTracerFactory.withContext to ensure that the ApiTracerContext and its associated LibraryMetadata (specifically the artifact name) are present and valid before initializing the metrics recorder. It also adds corresponding unit tests. Review feedback suggests reordering the validation logic in GoldenSignalsMetricsTracerFactory to prevent partial state updates when validation fails. Additionally, it was pointed out that new tests for SpanTracerFactory were added without the necessary implementation updates to handle null or empty artifact names, which will likely cause test failures.

@diegomarquezp diegomarquezp marked this pull request as ready for review March 30, 2026 15:54
@diegomarquezp diegomarquezp requested a review from a team as a code owner March 30, 2026 15:54
@blakeli0 blakeli0 merged commit 630d83d into main Mar 30, 2026
107 of 108 checks passed
@blakeli0 blakeli0 deleted the observability/fix/noop-when-no-artifact branch March 30, 2026 16:00
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.

2 participants