Skip to content

Conversation

surbhigarg92
Copy link
Contributor

@surbhigarg92 surbhigarg92 commented Sep 24, 2025

Fixes #2420

This PR addresses an issue where the project ID for metrics export was not being correctly determined when not explicitly provided.

Specifically, this PR introduces the following changes:

Infers Project ID from Credentials: When a Spanner instance is created without a projectId in the spanner options, the project ID is now fetched from the authentication credentials. This ensures that metrics are correctly exported to the appropriate project, resolving an issue where a placeholder {{project_id}} was being used.

This PR also makes the projectId attribute to be non-optional in MetricsTracerFactory.getInstance method

@surbhigarg92 surbhigarg92 requested review from a team as code owners September 24, 2025 10:47
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/nodejs-spanner API. labels Sep 24, 2025
@surbhigarg92 surbhigarg92 changed the title fix: Metrics Export with projectId from Credentials fix: Correctly determine project ID for metrics export Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics fail to be reported with INVALID_ARGUMENT error
1 participant