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][misc] PIP-264: Copy OpenTelemetry resource attributes to Prometheus labels #23005

Conversation

dragosvictor
Copy link
Contributor

@dragosvictor dragosvictor commented Jul 4, 2024

PIP-264

Motivation

The OpenTelemetry collector can be configured to expose the metrics as a Prometheus server, simplifying the deployment and migration of the telemetry pipeline. Pulsar supports this feature out of the box.

There is a catch though: the Prometheus exporter did not copy the OpenTelemetry resource attributes over to corresponding Prometheus labels, so vital information was lost in this process. This limitation is described in open-telemetry/opentelemetry-java#6108, which has since been fixed. The present PR leverages this improvement, instructing the OpenTelemetry SDK to migrate all resource attributes over to Prometheus as labels.

Modifications

  • During OpenTelemetry SDK initialization in OpenTelemetryService, configure any Prometheus exporters to copy all resource attributes as labels. Caveat: At the time this happens, the Prometheus server is already initialized and listening. Reconfiguring it on-the-go is not possible, so the server is closed and recreated with the desired configuration.

Verifying this change

  • Make sure that the change passes the CI checks.

This change modified tests and can be verified as follows:

  • Updated integration test OpenTelemetrySanityTest#testOpenTelemetryMetricsPrometheusExport to validate the labels are attached to the metrics exposed by the Prometheus exporter.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics: As described above
  • Anything that affects deployment

Documentation

Matching PR in forked repository

PR in forked repository: dragosvictor#38

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 4, 2024
@dragosvictor dragosvictor marked this pull request as ready for review July 4, 2024 20:22
@merlimat merlimat added this to the 3.4.0 milestone Jul 5, 2024
@merlimat merlimat merged commit dd1b579 into apache:master Jul 5, 2024
58 of 59 checks passed
@dragosvictor dragosvictor deleted the dmisca-pip-264-prometheus-allowed-resource-attribute branch July 5, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants