-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 from the Prometheus receiver #2964
Conversation
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
cc @odeke-em |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite the awesome PR!! Thank you @rakyll , LGTM!
Will fix the tests soon. |
The failing test (TestEndToEndSummarySupport) has a hard dependency on the receiver and byte to byte comparing the output. Is there a way we can remove this test and add something a bit more self contained @odeke-em? |
Please t.Skipf("@odeke-em please take a look") it and then we'll be gucci to go. |
It seems like the pull based Prometheus exporter is not exposing the job and instance labels and it seems like it's a problem itself. |
Codecov Report
@@ Coverage Diff @@
## main #2964 +/- ##
==========================================
- Coverage 91.63% 91.54% -0.09%
==========================================
Files 312 312
Lines 15445 15443 -2
==========================================
- Hits 14153 14138 -15
- Misses 883 897 +14
+ Partials 409 408 -1
Continue to review full report at Codecov.
|
I can't see why build-and-test is failed and can't reproduce it myself locally. Can someone paste the log? |
Nicely done @rakyll ty! |
cc @bogdandrutu @tigrannajaryan Can you review this? It's required for the stability. |
@@ -40,6 +40,10 @@ func TestEndToEndSummarySupport(t *testing.T) { | |||
t.Skip("This test can take a couple of seconds") | |||
} | |||
|
|||
// TODO(odeke-em): Fix this, see https://github.com/open-telemetry/opentelemetry-collector/pull/2964 | |||
// for context. | |||
t.Skipf("Not supporting instances and jobs, skipping for now. @odeke-em to take a look.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Skipf("Not supporting instances and jobs, skipping for now. @odeke-em to take a look.") | |
t.Skip("Not supporting instances and jobs, skipping for now. @odeke-em to take a look.") |
This doesn't appear to be using the formatting template to inject values, so t.Skip()
should suffice.
I don't know enough about this receiver to understand the change fully. @bogdandrutu @jrcamp maybe you can help review? |
@@ -263,12 +270,17 @@ func verifyTarget1(t *testing.T, td *testData, mds []internaldata.MetricsData) { | |||
Name: "go_threads", | |||
Description: "Number of OS threads created", | |||
Type: metricspb.MetricDescriptor_GAUGE_DOUBLE, | |||
LabelKeys: []*metricspb.LabelKey{{Key: "instance"}, {Key: "job"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should instance
and job
be part of the resource instead of labels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, working on it and will send another version.
How does this relate to #2683? |
Moving this PR to #2979. This issue requires an exporter change which populates the "instance" and "job" from resource attributes. |
@Aneurysm9, just seeing your last comment, #2683 is related to this but it seems like #2897 was doing the right thing to turn these labels into resource attributes. What was missing was to take them from the resource attributes and produce Prometheus labels in the exporters which #2979 is doing. |
This change was a part of #2964 but it's closed now. Having typed arguments make it easier to massage the arguments before comparing. Contributing this change for future maintainers.
This change was a part of open-telemetry#2964 but it's closed now. Having typed arguments make it easier to massage the arguments before comparing. Contributing this change for future maintainers.
This change was a part of open-telemetry#2964 but it's closed now. Having typed arguments make it easier to massage the arguments before comparing. Contributing this change for future maintainers.
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