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

[Prometheus Receiver] Add test to validate metrics renaming as per configuration #6090

Closed
2 tasks
PaurushGarg opened this issue Nov 1, 2021 · 2 comments
Closed
2 tasks
Labels
ci-cd CI, CD, testing, build issues comp:prometheus Prometheus related issues comp: receiver Receiver Stale

Comments

@PaurushGarg
Copy link
Member

PaurushGarg commented Nov 1, 2021

Is your feature request related to a problem? Please describe.
In order to verify that the Prometheus receiver is functioning as expected, a new test is needed to verify that Prometheus receiver renames the metric as per metric_relabel_configs configuration provided in scrap_configs of Prometheus Receiver configuration in OTEL collector configuration yaml file.
Create testcases for:

  • Metrics renaming using relabel.Action for replace, drop, and keep.
  • Labels renaming using relabel.Action replace, drop, keep, and hashmod.

Describe the solution you'd like
Prometheus Receiver should rename the metric and labels as per metric_relabel_configs configuration.
Create testdata for Prometheus Receiver to scrape and provide renaming configuration for each relabel.Action in Promethues Receiver configuration . For example:

receivers:
  prometheus:
    config:
      scrape_configs:
      - job_name: rename
        scrape_interval: 5s
        static_configs:
         - targets: [ "localhost: 4567" ]
        metric_relabel_configs:
        # rename otelcol_process_cpu_seconds to process_cpu_seconds by replacing the __name__ label 
          - source_labels: [ __name__ ]
            regex: "otelcol_(.*)"
            action: replace
            target_label:  __name__
            replacement: "$1"

Expected Behavior:
Prometheus Receiver renames the metrics as per the given configuration. To validate, assert that the metric name has been renamed. In addition, similar to metric_receiver_test.go validate the scrapes to ensure correct OTLP data transformation.

Additional context
Related to open-telemetry/wg-prometheus#57

Related Open Issues:
#5001
cc: @alolita @Aneurysm9

@alolita alolita added comp:prometheus Prometheus related issues ci-cd CI, CD, testing, build issues comp: receiver Receiver labels Nov 2, 2021
@PaurushGarg
Copy link
Member Author

@alolita please assign this issue to me. I would like to work on this one.

@PaurushGarg PaurushGarg changed the title Add test to validate metrics renaming as per configuration for the Prometheus Receiver [Prometheus Receiver] Add test to validate metrics renaming as per configuration Nov 22, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd CI, CD, testing, build issues comp:prometheus Prometheus related issues comp: receiver Receiver Stale
Projects
None yet
Development

No branches or pull requests

3 participants