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

[exporter/prometheusremotewrite] - add_metric_suffixes not respected for counters / gauge #26380

Closed
StarpTech opened this issue Sep 2, 2023 · 5 comments

Comments

@StarpTech
Copy link
Contributor

StarpTech commented Sep 2, 2023

Component(s)

exporter/prometheusremotewrite

What happened?

Description

The property add_metric_suffixes is not respected for counters and gauge metrics.

Steps to Reproduce

  1. Create a counter and call it my_counter
  2. Export it to the collector endpoint.
  3. Navigate to your local Prometheus instance and check the metrics. The name is my_counter

add_metric_suffixes should be enabled by default so no configuration is necessary.

Expected Result

The name of the metric should my_counter_total in prometheus

Actual Result

The name is my_counter

Collector version

0.84.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Pop!_OS 22.04 LTS
Compiler(if manually compiled): (e.g., "go 14.2") go1.20.4 linux/amd64

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      http:
        endpoint: '0.0.0.0:4318'

exporters:
  prometheusremotewrite:
    endpoint: "${PROMETHEUS_REMOTE_ENDPOINT}"
    namespace: "test"
    add_metric_suffixes: true
    auth:
      authenticator: basicauth/prw
    retry_on_failure:
      enabled: true
      initial_interval: 10s
      max_interval: 30s
      max_elapsed_time: 300s
    remote_write_queue:
      # Maximum number of batches kept in memory before dropping;
      queue_size: 2000
      # Number of consumers that dequeue batches
      num_consumers: 10
    timeout: 5s
    target_info:
      enabled: true

extensions:
  basicauth/prw:
    client_auth:
      username: ${PROMETHEUS_USERNAME}
      password: ${PROMETHEUS_PASSWORD}

service:
  extensions: [basicauth/prw]
  pipelines:
    metrics:
      receivers: [otlp]
      # Order is important here. Otherwise, the attributes processor will not be able to read the attributes from the auth context.
      exporters: [prometheusremotewrite]

Log output

No response

Additional context

No response

@StarpTech StarpTech added bug Something isn't working needs triage New item requiring triage labels Sep 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

crobert-1 commented Sep 7, 2023

Hello @StarpTech, to get this functionality working you also need to enable the pkg.translator.prometheus.NormalizeName feature gate. The logic checking both variables is found here.

Also as an FYI, #26489 is an open PR that will enable this feature gate by default once it's merged and released. #26488 is the tracking issue for this effort.

@StarpTech
Copy link
Contributor Author

Nice, ty for the update. Can I enable this in the exporter or do I need to wait for the PR to be released?

@crobert-1
Copy link
Member

You can enable it via CLI when running the collector.

@StarpTech
Copy link
Contributor Author

Thank you worked!

@crobert-1 crobert-1 removed bug Something isn't working needs triage New item requiring triage labels Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants