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

feat(storage): add OpenTelemetry standard metrics for Blob JSON metadata APIs by shradhakatyal · Pull Request #18942 · googleapis/google-cloud-python · GitHub

Repository navigation

feat(storage): add OpenTelemetry standard metrics for Blob JSON metadata APIs - #18942

Draft
shradhakatyal wants to merge 9 commits into
googleapis:mainfrom
shradhakatyal:feat/gcs-otel-veneer-blob-metrics
Draft

shradhakatyal wants to merge 9 commits into
googleapis:mainfrom
shradhakatyal:feat/gcs-otel-veneer-blob-metrics

Conversation

shradhakatyal commented Nov 1, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

Adds logical OpenTelemetry standard metrics instrumentation for Blob JSON metadata operations in google-cloud-storage.

Stack Overview (review isolated commit bd9260e76fb for this PR):

Key Changes

  • Blob Metadata APIs (blob.py): Instruments exists, reload, update, patch, delete, copy, rewrite, compose, restore, and storage-class update helpers, normalizing expected 404 existence checks to OK.
  • IAM & Hold Helpers (blob.py): Instruments Blob IAM policy and temporary/event-based hold operations.

…d helpers

Implement core OpenTelemetry standard metrics infrastructure for GCS:
- Add _MetricsRecorder with the 9 standard metric instruments
- Add custom latency (165 buckets) and byte-size (45 buckets) histogram views
- Add classify_error_type for low-cardinality error.type mapping
- Add normalize_url_template for bounded HTTP url.template routing
- Add start_operation ContextVar for outermost logical operation tracking and nested call suppression

[Generated-by: AI]
- Add gcp.storage.client.retries counter and rename TTFB metric to gcp.storage.client.ttfb
- Remove gcp.client.repo from _COMMON_ATTRIBUTES
- Update _build_size_buckets to generate 48 buckets matching Go and Java SDKs
- Align per-metric attributes across logical operation, RPC/HTTP attempt, error, retry, and TTFB recorders

[Generated-by: AI]
…fy CONNECTION_ERROR

- Scope histogram View registrations to meter_name="google.cloud.storage"
- Guard normalize_url_template and _extract_server_address against malformed URIs and gRPC authority schemes
- Consolidate CONNECTION_REFUSED, CONNECTION_RESET, and CONNECTIVITY error labels into CONNECTION_ERROR

[Generated-by: AI]
…port

- Wire _MetricsRecorder lifecycle, enable_metrics, and meter_provider into Client
- Instrument Connection.api_request for per-attempt HTTP duration, TTFB, retries, and errors
- Add _start_storage_operation, _PropertyMixin, and lazy HTTPIterator page metrics helpers
- Skip per-attempt HTTP metrics while queuing sub-requests into Batch
- Suppress internal background BucketMetadataCache lookups from emitting user-facing metrics
… and resource APIs

- Instrument logical operations on Client and Bucket metadata, IAM, lifecycle, and list APIs
- Record Batch.finish() logical operation metrics while deferring queued sub-requests
- Instrument BucketACL, DefaultObjectACL, ObjectACL, HMACKeyMetadata, and BucketNotification
…ata APIs

- Instrument Blob JSON metadata operations including reload, update, patch, delete, copy, rewrite, compose, and restore
- Add logical operation metrics for Blob IAM policy and temporary/event-based hold helpers

gemini-code-assist Bot left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request introduces comprehensive OpenTelemetry metrics instrumentation across the Google Cloud Storage Python client library. It adds a new _opentelemetry_metrics module to manage metric instruments, custom histogram bucket boundaries, canonical error classification, and logical operation tracking. Key components such as the HTTP connection, bucket metadata cache, ACLs, batch operations, blobs, buckets, clients, HMAC keys, and notifications have been updated to support metric recording and context-based suppression. Additionally, extensive unit tests have been added to verify the metrics collection and transport behavior. There are no review comments to address, and the implementation appears solid and well-tested.

This branch has not been deployed

No deployments
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL