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

Migrate collector self-observability from OpenCensus to OpenTelemetry #885

Merged
merged 13 commits into from
Aug 27, 2024

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Aug 26, 2024

Fixes #797

Changes

This migrates two uses of OpenCensus:

  • go.opencensus.io/plugin/ocgrpc -> google.golang.org/grpc/stats/opentelemetry
  • Custom instrumentation:
    • googlecloudmonitoring/point_count
    • googlecloudmonitoring/exemplar_attachments_dropped

This includes:

  • Update gRPC v1.64.1 -> v1.65.0
  • [breaking] Accepting a MeterProvider in our New* functions, and plumbing this MeterProvider to our instrumentation
  • Change fixture generation and validation to use our Go in-process exporter to export self-observability metrics to GCM.
  • Update fixture normalization to normalize new grpc metric names, and to normalize a label value to ensure they don't change during each run of fixture tests.

This PR additionally includes extending self-observability fixtures to the log and trace exporters for additional coverage.

Notes to reviewers

It is probably easiest to review each commit. Most of the diff is from generated fixture changes.

Alternatives considered:

We could have used otelgrpc instead (go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc). This PR uses the grpc instrumentation because we expect the native instrumentation to eventually replace the opentelemetry-provided library.

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 50.72464% with 34 lines in your changes missing coverage. Please review.

Project coverage is 62.85%. Comparing base (4caace7) to head (2402708).
Report is 37 commits behind head on main.

Files Patch % Lines
...llector/integrationtest/cmd/recordfixtures/main.go 0.00% 22 Missing ⚠️
...er/collector/integrationtest/protos/fixtures.pb.go 0.00% 10 Missing ⚠️
.../collector/integrationtest/inmemoryotelexporter.go 92.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #885      +/-   ##
==========================================
+ Coverage   61.03%   62.85%   +1.82%     
==========================================
  Files          56       57       +1     
  Lines        5903     6004     +101     
==========================================
+ Hits         3603     3774     +171     
+ Misses       2143     2068      -75     
- Partials      157      162       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -266,7 +266,7 @@ func generateClientOptions(ctx context.Context, clientCfg *ClientConfig, cfg *Co
// option.WithGRPCConn option takes precedent over all other supplied options so the
// following user agent will be used by both exporters if we reach this branch
dialOpts := []grpc.DialOption{
grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
// TODO: use meterProvider for gRPC instrumentation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aabmass @damemi The only thing left for this PR is to choose to use either the gRPC or go-contrib library here. I tried to use the gRPC version, but it hasn't actually been released yet: https://pkg.go.dev/google.golang.org/grpc/stats/opentelemetry (notice the tag is just a commit).

@zasweq do you know if the grpc OpenTelemetry metrics plugin is ready to be used by other projects, or when you expect the first release to be tagged?

@dashpole dashpole marked this pull request as ready for review August 27, 2024 13:26
@dashpole dashpole requested a review from a team as a code owner August 27, 2024 13:26
@dashpole dashpole requested review from damemi and aabmass August 27, 2024 13:27
@dashpole
Copy link
Contributor Author

This is ready for review

Copy link
Contributor

@damemi damemi left a comment

Choose a reason for hiding this comment

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

looks good, couple nits

exporter/collector/metrics.go Show resolved Hide resolved
exporter/collector/metrics.go Outdated Show resolved Hide resolved
exporter/collector/metrics.go Show resolved Hide resolved
@dashpole dashpole merged commit 051c551 into GoogleCloudPlatform:main Aug 27, 2024
28 of 29 checks passed
@dashpole dashpole deleted the fix_collector_selfobs branch August 27, 2024 20:16
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.

Migrate collector exporter self-observability from OpenCensus to OpenTelemetry
2 participants