googleapis / googleapis/google-cloud-go

spanner: support custom meterprovider for builtin metrics

Open
#11,204 5 comments 2 reactions 1 assignee Assigned to @rahul2393 View on GitHub
api: spanner triage me
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

## Is your feature request related to a problem? Please describe.

Spanner client is sending builtin/native metrics directly to GCP by default.

For services that have no permission, the metric export results to error log and span with following message.
> Permission monitoring.timeSeries.create denied (or the resource may not exist).

For the above noise to go away, the native metrics can be disabled (SPANNER_DISABLE_BUILTIN_METRICS=true) or simply give service the missing permission. However, this is always something to keep in mind for a new service using spanner.

## Describe the solution you'd like

Use the ClientConfig.OpenTelemetryMeterProvider from the config

Code affected.
https://github.com/googleapis/google-cloud-go/blob/5b59819e2d603ef55c4cf056b70af6a08d335373/spanner/client.go#L496-L511

## Describe alternatives you've considered

- Allow a param that sends builtin metrics to the global meter provider `otel.GetMeterProvider()`

## Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.