feat(storage): OpenTelemetry client metrics infrastructure and configuration - #14398
Open
nidhiii-27 wants to merge 4 commits into
Open
nidhiii-27 wants to merge 4 commits into
nidhiii-27 wants to merge 4 commits into
Conversation
…nfiguration - Add configuration options to StorageOptions, GrpcStorageOptions, and HttpStorageOptions (enableOtelMetrics, enableOtelDebugMetrics, meterProvider, metricInterval). - Add development gate checking system properties and environment variables in StorageMetricsConfig. - Implement package-private instrument registry in StorageClientMetrics. - Update OpenTelemetryBootstrappingUtils to register client views with custom histogram boundaries and create client meter provider. - Add comprehensive unit tests in StorageOptionsTest, StorageClientMetricsTest, and OpenTelemetryBootstrappingUtilsTest.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces OpenTelemetry client metrics support for Google Cloud Storage, allowing standard and debug metrics to be configured and recorded for both HTTP and gRPC transports. It adds configuration options to StorageOptions, GrpcStorageOptions, and HttpStorageOptions for enabling metrics, setting custom meter providers, and defining export intervals, supported by a new StorageMetricsConfig utility and StorageClientMetrics registry. Feedback on the changes suggests importing java.time.Duration to avoid using fully qualified class names throughout GrpcStorageOptions.java and OpenTelemetryBootstrappingUtils.java, which will improve code readability and consistency.
Apply spotify fmt-maven-plugin formatting to StorageMetricsConfig, StorageClientMetrics, StorageOptionsTest, and StorageClientMetricsTest. [Generated-by: AI]
Use simple class name Duration instead of fully qualified java.time.Duration in GrpcStorageOptions and OpenTelemetryBootstrappingUtils. [Generated-by: AI]
…trappingUtils Apply spotify fmt-maven-plugin formatting to OpenTelemetryBootstrappingUtils. [Generated-by: AI]
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements PR 1 of the OpenTelemetry Client Metrics feature in the Java Cloud Storage SDK (
google-cloud-storage).Key Changes
Configuration & Development Gate:
StorageOptions(andGrpcStorageOptions,HttpStorageOptions):isEnableOtelMetrics()(default:false)isEnableOtelDebugMetrics()(default:false)getMeterProvider()(default:null)getMetricInterval()(default:Duration.ofSeconds(60))@BetaApi.StorageMetricsConfigdevelopment gate checking system properties:com.google.cloud.storage.enable_otel_metricscom.google.cloud.storage.enable_otel_debug_metricsand environment variables:
GCP_STORAGE_JAVA_ENABLE_OTEL_METRICS(with fallbackGCP_STORAGE_ENABLE_OTEL_METRICS)GCP_STORAGE_JAVA_ENABLE_OTEL_DEBUG_METRICSInstrument Registry:
StorageClientMetricsregistry holding all standard and debug instruments with exact OpenTelemetry specification names and units.OpenTelemetry Bootstrapping:
OpenTelemetryBootstrappingUtils:latencyHistogramBoundariesandsizeHistogramBoundaries).createClientMeterProviderwith"storage.googleapis.com/Client"monitored resource.Testing:
StorageOptionsTest,StorageClientMetricsTest, and updatedOpenTelemetryBootstrappingUtilsTest.