FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(Spanner): migrate the metrics exporter from a custom one to a native OTLP one. by Hectorhammett · Pull Request #9505 · googleapis/google-cloud-php · GitHub

feat(Spanner): migrate the metrics exporter from a custom one to a native OTLP one. - #9505

Open
Hectorhammett wants to merge 3 commits into
mainfrom
otel-migration
Open

feat(Spanner): migrate the metrics exporter from a custom one to a native OTLP one.#9505
Hectorhammett wants to merge 3 commits into
mainfrom
otel-migration

Conversation

Copy link
Copy Markdown
Collaborator

Summary

In the past when we introduced client metrics, we implemented a custom exporter (MetricServiceClient) to translate metrics into Google Cloud Monitoring TimeSeries objects because GCP did not yet support the native OTLP protocol.

Google Cloud now natively supports OTLP metric ingestion at https://telemetry.googleapis.com/v1/metrics. This PR updates the Spanner PHP SDK built-in metrics exporter to use standard OTLP HTTP export and adds support for configurable metrics credentials.

Key Changes

  • OTLP Exporter Migration: Replaced legacy MetricServiceClient GCM translation in MetricsExporter with standard OTLP HTTP exporter (OpenTelemetry\Contrib\Otlp\MetricExporter) targeting https://telemetry.googleapis.com/v1/metrics.
  • Configurable & Re-scoped Credentials:
    • Added support for dedicated $options['metricsCredentials'] in SpannerClient.
    • Automatically re-scopes credentials to https://www.googleapis.com/auth/monitoring.write and https://www.googleapis.com/auth/cloud-platform using CredentialsWrapper to prevent OAuth scope mismatch errors.
    • Falls back gracefully to main client credentials or Application Default Credentials (ADC).
  • Guzzle Authorization Middleware: Dynamically attaches Authorization: Bearer <token> and x-goog-user-project headers to outgoing OTLP HTTP requests via Guzzle middleware.

Hectorhammett requested a review from a team as a code owner August 19, 2026 02:10
Hectorhammett added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 19, 2026
product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 Spanner API. do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL