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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hakman 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 |
a537ec6 to
ee90453
Compare
|
/test pull-npd-e2e-test |
8284a46 to
a12139a
Compare
* feat(exporters): replace opencensus with opentelemetry * fix(stackdriver_exporter): use metrics util constants * chore: use global meter and init * feat(exporters): add resource info, use global meter * chore: update deps * fix: use a gauge directly, narrow scope info * cleanup: deps * fix: try initOnce pattern for global problem metrics * fix(problemmetrics): init is being called too late * fix(gauge): remove _ratio suffix * fix: clean up after rebase * fix: cleanup after rebase * fix: cleanup after rebase * fix: cleanup after rebase * fix: remove nodename * fix(test): remove instance id check * fix(test): add attr values * fix(test): unexported resources * fix(test): initialize global problem metrics manager * fix(lint): make the linter happy
disk_percent_used declared only device_name but recorded four labels (device_name, fs_type, mount_option, state). With per-metric label validation, Record now rejects the undeclared labels and the metric is dropped from the export (caught by the metriconly e2e). Record only device_name, preserving the schema NPD has exported since the metric was introduced: the OpenCensus view aggregated by device_name and dropped the other tags, so on the wire this metric has always had a single label. It also maps to the Google-owned compute.googleapis.com/guest/disk/percent_used descriptor, which can reject writes carrying undeclared label keys. Add a regression test pinning the schema.
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.
Based on @daveoy's #1141, adding remaining fixes.
Closes #1008
/cc @SergeyKanzhelev @wangzhen127