Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable collection of OpenCensus metrics #550

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

DavyJ0nes
Copy link

@DavyJ0nes DavyJ0nes commented Oct 25, 2023

For some Google Cloud libraries, metrics are emitted that are useful to understanding the operation of a service but they are using the OpenCensus SDKs rather than the OpenTelemetry ones.

A notable example is GoogleCloudPlatform/cloud-sql-go-connector which is used as a proxy when connecting Cloud Run instances to Cloud SQL. There is a suite of metrics that are particularly useful in monitoring the health of the proxy.

This change allows users to enable capturing OpenCensus formatted metrics using the OpenTelemetry bridge shim. By default this will be disabled.

There is a downside to enabling this producer, mainly that since OpenCensus telemetry uses globals, installing a bridge will result in telemetry collection from all libraries that use OpenCensus, including some you may not expect, such as the telemetry exporter itself.

More info can be found in the following documentation: https://pkg.go.dev/go.opentelemetry.io/otel/bridge/opencensus#hdr-Migration_Guide

I have been able to test with a service that this configuration works as expected, in the image below we can see the cloudsqlconn metrics being exported to Google Cloud Monitoring as expected.
Screenshot 2023-10-25 at 15 08 45

@DavyJ0nes DavyJ0nes self-assigned this Oct 25, 2023
For some Google Cloud libraries, metrics are emitted that are useful to
understanding the operation of a service but they are using the
OpenCensus SDKs rather than the OpenTelemetry ones.

A notable example is GoogleCloudPlatform/cloud-sql-go-connector which is
used as a proxy when connecting Cloud Run instances to Cloud SQL. There
is a [suite of metrics](https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/blob/v1.4.5/internal/trace/metrics.go)
that are particularly useful in monitoring the health of the proxy.

This change allows users to enable capturing OpenCensus formatted metrics using
the OpenTelemetry bridge shim. By default this will be disabled.

There is a downside to enabling this producer, mainly that since OpenCensus
telemetry uses globals, installing a bridge will result in telemetry collection
from all libraries that use OpenCensus, including some you may not expect,
such as the telemetry exporter itself.

More info can be found in the following documentation:
https://pkg.go.dev/go.opentelemetry.io/otel/bridge/opencensus#hdr-Migration_Guide
@DavyJ0nes DavyJ0nes force-pushed the allow-collecting-opencensus-metrics branch from 171f9f0 to ef05a4f Compare October 25, 2023 13:10
@DavyJ0nes DavyJ0nes marked this pull request as ready for review October 25, 2023 13:11
@DavyJ0nes DavyJ0nes requested a review from a team as a code owner October 25, 2023 13:11
Copy link
Member

@odsod odsod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Not default to true?

Copy link
Member

@radhus radhus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@odsod
Copy link
Member

odsod commented Oct 25, 2023

Too many custom metrics by default?

@DavyJ0nes
Copy link
Author

@odsod yeah exactly, it's an all or nothing by the looks of it (https://pkg.go.dev/go.opentelemetry.io/otel/bridge/opencensus#hdr-Warnings) I will test out the behaviour to see the impact but depending on the other libraries people might use it could cause unforeseen costs.

@DavyJ0nes DavyJ0nes merged commit 096a749 into master Oct 25, 2023
1 check passed
@DavyJ0nes DavyJ0nes deleted the allow-collecting-opencensus-metrics branch October 25, 2023 13:17
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.

3 participants