Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

feat: migrate built in metrics to OTEL - #1796

Merged
mutianf merged 40 commits into
googleapis:otelfrom
mutianf:migrate12
Feb 21, 2024
Merged

feat: migrate built in metrics to OTEL#1796
mutianf merged 40 commits into
googleapis:otelfrom
mutianf:migrate12

Conversation

@mutianf

@mutianfmutianf commented Jun 15, 2023

Copy link
Copy Markdown
Contributor

To use a custom otel instance:

/** Customer's application code */
SdkMeterProviderBuilder sdkMeterProvider = SdkMeterProvider.builder();
// resgister Builtin metrics
BuiltinViews.registerBuiltinViews("project-id", sdkMeterProvider);
OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
.setMeterProvider(sdkMeterProvider())
.setTracerProvider(..) // customer can set other providers
.build();
// pass in the openTelemetry instance
BigtableDataSettings settings = ..
.setMetricsProvider(CustomOpenTelemetryMetricsProvider.create(openTelemetry));

Under the hood, BuiltinViews.registerBuiltinViews register the BigtableCloudMonitoringExporter:

registerBuiltinViews("project-id", sdkMeterProvider) {
sdkMeterProvider
// register the metric reader
.registerMetricReader(
PeriodicMetricReader.create(
// meter reader needs to be created with a exporter
BigtableCloudMonitoringExporter.create(project, credentials)))
.registerView(OPERATION_LATENCIES_SELECTOR, OPERATION_LATENCIES_VIEW)
}

@product-auto-labelproduct-auto-labelBot added size: xl Pull request size is extra large. api: bigtable Issues related to the googleapis/java-bigtable API. labels Jun 15, 2023
@blakeli0

Copy link
Copy Markdown
Contributor

Note that we recently started doing dependency governance, you would need to create a ticket for every new dependency. Once this PR is ready, please reach out to @suztomo regarding the exact process for OpenTelemetry dependencies, see a pilot example b/266431647.

@mutianf
mutianf marked this pull request as ready for review September 1, 2023 18:20
@mutianf
mutianf requested review from a teamSeptember 1, 2023 18:20
@mutianf
mutianf requested a review from a teamJanuary 24, 2024 15:40
@mutianf
mutianf changed the base branch from main to otelJanuary 24, 2024 15:45
Comment on lines +175 to +177
// Builtin metrics will call getCredentialsProvider at which point it'll be a
// FixedCredentialProvider.
// So disabling in the test code it's fine.

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.

I think you can do this now?

@mutianf
mutianf merged commit 08e1719 into googleapis:otelFeb 21, 2024
@mutianf
mutianf deleted the migrate12 branch February 21, 2024 15:56
mutianf added a commit that referenced this pull request Apr 12, 2024
* feat: migrate to OTEL exporter (#1788)
* feat: migrate exporter to OTEL
* address comments
* filter out only bigtable metrics
* fix test
* use the bom
* update
* update
* update completeResultCode
* add a comment
* address comments
* address comments
* update pom
* small fix
* also check timestamp
* address comment
* updates
* update
* do not block on shutdown
* chore: refactor factory class (#2081)
* chore: refactor TracerFactory creation (#2102)
* feat: migrate built in metrics to OTEL (#1796)
* feat: migrate exporter to OTEL
* address comments
* filter out only bigtable metrics
* fix test
* use the bom
* update
* update
* feat: migrate builtin metrics to OTEl
* update completeResultCode
* add a comment
* udpate
* fix tests
* remove unrelated changes
* fix tests
* add documentation
* fix test
* merge exporter changes
* address comments
* rebase on otel
* revert changes in stats
* fix import
* update
* merge back the endpoint change
* refactor constants and settings
* refactor and fix tests
* remove unused dependency
* add some javadoc
* address part of the comments
* update test
* test with nano
* measure everything in nanos and publish with double histogram
* address comments
* fix test
* add toString
* merge from main
* feat: migrate per connection error count metric to otel (#2133)
* feat: migrate per connection error count metric to otel
* update test
* address comments
* remove unnecessary check
* clean up statsRecorder
* remove dependency
* address comments
* feat: migrate per connection error exporter to otel (#2152)
* chore: clean up stats package (#2163)
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* fix clirr and integration test
* fix clirr and integration test
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* log more information on test failures
* address comments
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* include version
* fix flaky test
* remove otel dependencies since they're added to shared dependencies
* backport new tests since 2.37
* set feature flag when metrics is enabled
* record metrics whenever it's registered
* record metrics whenever it's registered
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* remove stale reference
* clean up
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigtableIssues related to the googleapis/java-bigtable API.size: xlPull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mutianf@blakeli0@igorbernstein2