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

Don't drop instance and job labels in the Prometheus Remote Write Exporter #2979

Merged
merged 1 commit into from
Apr 22, 2021
Merged

Don't drop instance and job labels in the Prometheus Remote Write Exporter #2979

merged 1 commit into from
Apr 22, 2021

Conversation

rakyll
Copy link
Contributor

@rakyll rakyll commented Apr 21, 2021

This is a follow up to #2897. Even though the instance and job labels are scraped, we were not using them during the export. This change makes sure that the remote write exporter is labelling the outgoing samples with "job" and "instance".

Fixes #575
Fixes #2499
Fixes #2363
Fixes open-telemetry/prometheus-interoperability-spec#37
Fixes open-telemetry/prometheus-interoperability-spec#39

Passing compliance tests:

$ go test --tags=compliance -run "TestRemoteWrite/otelcollector/Job.+" -v ./
=== RUN TestRemoteWrite
=== RUN TestRemoteWrite/otelcollector
=== RUN TestRemoteWrite/otelcollector/JobLabel
=== PAUSE TestRemoteWrite/otelcollector/JobLabel
=== CONT TestRemoteWrite/otelcollector/JobLabel
--- PASS: TestRemoteWrite (10.02s)
--- PASS: TestRemoteWrite/otelcollector (0.00s)
--- PASS: TestRemoteWrite/otelcollector/JobLabel (10.02s)
PASS
ok github.com/prometheus/compliance/remote_write 10.382s
$ go test --tags=compliance -run "TestRemoteWrite/otelcollector/Instance.+" -v ./
=== RUN TestRemoteWrite
=== RUN TestRemoteWrite/otelcollector
=== RUN TestRemoteWrite/otelcollector/InstanceLabel
=== PAUSE TestRemoteWrite/otelcollector/InstanceLabel
=== CONT TestRemoteWrite/otelcollector/InstanceLabel
--- PASS: TestRemoteWrite (10.01s)
--- PASS: TestRemoteWrite/otelcollector (0.00s)
--- PASS: TestRemoteWrite/otelcollector/InstanceLabel (10.01s)
PASS
ok github.com/prometheus/compliance/remote_write 10.291s

@codecov
Copy link

codecov bot commented Apr 21, 2021

Codecov Report

Merging #2979 (62bbea0) into main (d10b842) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2979   +/-   ##
=======================================
  Coverage   91.65%   91.65%           
=======================================
  Files         312      312           
  Lines       15427    15438   +11     
=======================================
+ Hits        14139    14150   +11     
  Misses        881      881           
  Partials      407      407           
Impacted Files Coverage Δ
exporter/prometheusremotewriteexporter/exporter.go 89.40% <100.00%> (+0.07%) ⬆️
exporter/prometheusremotewriteexporter/helper.go 99.57% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d10b842...62bbea0. Read the comment docs.

@rakyll rakyll marked this pull request as ready for review April 21, 2021 19:13
@rakyll rakyll requested a review from a team April 21, 2021 19:13
@rakyll
Copy link
Contributor Author

rakyll commented Apr 21, 2021

@rakyll
Copy link
Contributor Author

rakyll commented Apr 21, 2021

Contrib tests are failing for Kafka which doesn't seem to be relevant to this change.

…orter

This is a follow up to #2897.

Fixes #575
Fixes #2499
Fixes #2363
Fixes open-telemetry/prometheus-interoperability-spec#37
Fixes open-telemetry/prometheus-interoperability-spec#39
Fixes open-telemetry/prometheus-interoperability-spec#44

Passing compliance tests:

$ go test --tags=compliance -run "TestRemoteWrite/otelcollector/Job.+" -v ./
=== RUN TestRemoteWrite
=== RUN TestRemoteWrite/otelcollector
=== RUN TestRemoteWrite/otelcollector/JobLabel
=== PAUSE TestRemoteWrite/otelcollector/JobLabel
=== CONT TestRemoteWrite/otelcollector/JobLabel
--- PASS: TestRemoteWrite (10.02s)
--- PASS: TestRemoteWrite/otelcollector (0.00s)
--- PASS: TestRemoteWrite/otelcollector/JobLabel (10.02s)
PASS
ok github.com/prometheus/compliance/remote_write 10.382s
$ go test --tags=compliance -run "TestRemoteWrite/otelcollector/Instance.+" -v ./
=== RUN TestRemoteWrite
=== RUN TestRemoteWrite/otelcollector
=== RUN TestRemoteWrite/otelcollector/InstanceLabel
=== PAUSE TestRemoteWrite/otelcollector/InstanceLabel
=== CONT TestRemoteWrite/otelcollector/InstanceLabel
--- PASS: TestRemoteWrite (10.01s)
--- PASS: TestRemoteWrite/otelcollector (0.00s)
--- PASS: TestRemoteWrite/otelcollector/InstanceLabel (10.01s)
PASS
ok github.com/prometheus/compliance/remote_write 10.291s
$ go test --tags=compliance -run "TestRemoteWrite/otelcollector/RepeatedLabels.+" -v ./
=== RUN TestRemoteWrite
=== RUN TestRemoteWrite/otelcollector
--- PASS: TestRemoteWrite (0.00s)
--- PASS: TestRemoteWrite/otelcollector (0.00s)
testing: warning: no tests to run
PASS
@rakyll
Copy link
Contributor Author

rakyll commented Apr 22, 2021

@bogdandrutu TestTraceNoBackend10kSPS|TestTrace1kSPSWithAttrs is failing independent of this change. Please feel free to review.

@bogdandrutu bogdandrutu merged commit 33f9a24 into open-telemetry:main Apr 22, 2021
@rakyll rakyll deleted the exporter-job-instance branch April 22, 2021 23:31
@etiennejournet
Copy link

etiennejournet commented Aug 16, 2021

Hello !

Is this solved ? I still dont have "instance" or "job" shipped to my LogzIo account, but have no idea how to debug it because "loglevel: debug" doesn't give the metrics labels.

My conf for info:

  receivers:
      prometheus:
        config:
          scrape_configs:
          - job_name: k8s
            kubernetes_sd_configs:
            - role: pod
            relabel_configs:
            - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
              regex: "true"
              action: keep
            metric_relabel_configs:
            - source_labels: [__name__]
              regex: "(request_duration_seconds.*|response_duration_seconds.*)"
              action: keep
    service:
      extensions: [health_check]
      pipelines:
        metrics:
          exporters:
          - prometheusremotewrite
          - logging
          receivers:
          - prometheus
    exporters:
      logging:
        logLevel: debug
      prometheusremotewrite:
        endpoint: "https://listener.logz.io:8053"

Thanks,

hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
…ent (open-telemetry#2979)

* Bump github.com/onsi/gomega from 1.26.0 to 1.27.6 in /pkg/signalfx-agent

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.26.0 to 1.27.6.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.26.0...v1.27.6)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment