Repository navigation
refactor: use per-adapter SdkMeterProvider with bounded lifecycle cleanup - #439
Closed
sakthivelmanii wants to merge 1 commit into
Closed
sakthivelmanii wants to merge 1 commit into
sakthivelmanii wants to merge 1 commit into
Conversation
…anup - Added BuiltInMetricsProvider.createMetricsRecorder(...) (@internalapi) to create a dedicated per-adapter SdkMeterProvider with a unique client_uid and matching client_hash per adapter, lazily caching GCP resource attribute detection while retaining getOrCreateOpenTelemetry(...) for binary compatibility. - Added an idempotent, 2-second bounded close() lifecycle method to BuiltInMetricsRecorder and wired cleanup into Adapter.stop(), Adapter.start() failure paths, SpannerCqlSessionBuilder, and Launcher. - Updated Launcher.shutdown() to catch Exception per adapter so partial startup failures still stop all healthy listeners cleanly while letting fatal JVM Errors propagate.
Contributor
Author
|
Superseded by #440 (opened directly from the main repository so integration CI checks can run). |
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.
Problem Statement
SdkMeterProvidersingleton initialized with the first adapter's project and instance ID and closed only via a JVM shutdown hook.client_uid/client_hashcollisions, or flush and release exporter threads when individual adapters stopped or failed to start.Launcher.shutdown()only caughtIOExceptionper adapter, allowing anIllegalStateExceptionfrom stopping a never-started adapter to skip stopping remaining healthy listeners.Solution
BuiltInMetricsProvider.createMetricsRecorder(...)(@InternalApi) to create a dedicated per-adapterSdkMeterProviderwith a uniqueclient_uidand matchingclient_hashper adapter, lazily caching GCP resource attribute detection so per-adapter creation does not re-probe the metadata server, while retaininggetOrCreateOpenTelemetry(...)for binary compatibility.close()lifecycle method toBuiltInMetricsRecorderand wired cleanup intoAdapter.stop(),Adapter.start()failure paths,SpannerCqlSessionBuilder, andLauncher.Launcher.shutdown()to catchExceptionper adapter so partial startup failures still stop all healthy listeners cleanly while letting fatal JVMErrors propagate.