Repository navigation
feat(exporters): replace opencensus with opentelemetry - #1297
Conversation
|
@hakman: GitHub didn't allow me to request PR reviews from the following users: daveoy. Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
a537ec6 to
ee90453
Compare
|
/test pull-npd-e2e-test |
a12139a to
7631035
Compare
DigitalVeer
left a comment
There was a problem hiding this comment.
Thanks for this! I work with NPD at GKE and I hope I can add my two cents here.
| // Create Prometheus exporter with options to prevent automatic suffixing | ||
| promExporter, err := otelprometheus.New( | ||
| otelprometheus.WithRegisterer(reg), // Use a dedicated registry | ||
| otelprometheus.WithTranslationStrategy(otlptranslator.NoTranslation), // Don't add suffixes or escape |
There was a problem hiding this comment.
I recorded the same metric and took a diff on the output between this PR & master.
# any plain scraper w/o escaping
curl -s localhost:20257/metrics | grep uptime
# host_uptime 12345.6 (same on both branches)
# when using Prometheus 3.x
curl -s -H 'Accept: text/plain; version=1.0.0; escaping=allow-utf-8' \
localhost:20257/metrics | grep uptime
# PR head: {"host/uptime"} 12345.6 <- renamed
# master: host_uptime 12345.6 <- unchanged
We should account for users scraping with Prometheus 3.x.
Given that Prometheus 3.x supports utf-8 and has escaping=allow-utf-8 by default, we should make sure the metric sent out is the same before and after this change.
| globalMeterProvider = sdkmetric.NewMeterProvider(opts...) | ||
|
|
||
| // Set as global meter provider | ||
| otel.SetMeterProvider(globalMeterProvider) |
There was a problem hiding this comment.
We should pass option.WithTelemetryDisabled() in monitoringClientOptions.
By default, google.golang.org/api adds an otelgrpc handler to each gRPC client. Thus the exporter makes rpc.client.* metrics for its own calls. These metric names are not in NPDMetricToSDMetric.
Cloud Monitoring rejects unknown metrics on export cycles and each failed export makes more rpc.client.* metrics so this can cause a failure loop.
|
/retest |
|
/test pull-npd-build |
…ions Address review comments from kubernetes#1297: - Shut down the OTel meter provider when npdMain exits so push readers flush pending metrics. - Return an error from AddMetricReader/AddResourceAttributes when the meter provider is already initialized, instead of silently ignoring the registration.
All done and rebased, thanks for taking another pass. |
|
/lgtm Thanks a lot for the work! Feel free to unhold to merge. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman, wangzhen127 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thanks, @wangzhen127! I think this has been open long enough for anyone interested in the topic to provide feedback. Let’s merge it and continue improving it from there. /unhold |
|
🔥 |
Dave Young is now a Kubernetes org member, see kubernetes/org#6866 Notable contributions to the project: - Started and tested the OpenCensus to OpenTelemetry migration (kubernetes#1141), which landed as kubernetes#1297 - Configurable C compiler for cross-architecture builds (kubernetes#986) - Dependency updates fixing high severity CVEs (kubernetes#1035)
Based on @daveoy's #1141, adding remaining fixes.
Closes #1008
/cc @SergeyKanzhelev @wangzhen127