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

Give NoOp create settings a unique name #9637

Merged
merged 4 commits into from
Mar 12, 2024

Conversation

dashpole
Copy link
Contributor

Description:

Long story, but i'm working on updating the prometheus dependency: open-telemetry/opentelemetry-collector-contrib#30934

As part of that update, we need to adapt to a change that makes the prometheus servers' self-observability metrics independent. See prometheus/prometheus#13507 and prometheus/prometheus#13610

One way to adapt to this change is by adding a label to each receivers' metrics to differentiate one Prometheus receiver from another. I've tried taking that approach in open-telemetry/opentelemetry-collector-contrib#30934, but the current issue is that the NoOp components all have the same name, which causes the self-observability metrics to collide.

I can work around this in the prometheus receiver's own tests, but I can't work around the issue in the generated_component_test.go tests, since those are generated.

This PR makes the ID returned by NewNopCreateSettings unique by giving it a unique name.

Link to tracking Issue:

Part of open-telemetry/opentelemetry-collector-contrib#30883

cc @Aneurysm9

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.98%. Comparing base (0c10f56) to head (6e875a5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9637   +/-   ##
=======================================
  Coverage   90.98%   90.98%           
=======================================
  Files         349      349           
  Lines       18572    18572           
=======================================
  Hits        16897    16897           
  Misses       1348     1348           
  Partials      327      327           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dashpole
Copy link
Contributor Author

This breaks a few tests in contrib, but it should be easy to fix those when we bump the dependency.

Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally looks good to me, but it should have a changelog entry as it may confound test expectations.

@dashpole
Copy link
Contributor Author

Added a changelog.

@dashpole dashpole changed the title Give NoOp components a unique name Give NoOp create settings a unique name Mar 6, 2024
@dashpole
Copy link
Contributor Author

dashpole commented Mar 6, 2024

I'll need to update contrib first to fix the failing tests.

@dashpole dashpole marked this pull request as draft March 6, 2024 17:45
dmitryax pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Mar 7, 2024
**Description:**

This should fix failures in
open-telemetry/opentelemetry-collector#9637

This unit test was relying on the ID from
`exportertest.NewNopCreateSettings` always being the same. This change
makes the test use the same create settings when storing the telemetry
registry, and when creating the trace exporter to avoid that problem.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637
codeboten pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Mar 11, 2024
#31659)

Follow-up to
#31640

I didn't realize the contrib test stopped after the first failure, so
there were a few more failures for
open-telemetry/opentelemetry-collector#9637.

I verified that this passes the contrib-tests check for the core repo
locally, so this should be the rest of them.

For the splunkhec exporter, the exporter actually uses `ID.String()`:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/4c5b5e934484ae3084565abbd3746a98e7f27721/exporter/splunkhecexporter/client.go#L71

The filelog receiver was assuming that `NewNopCreateSettings` returned
the same ID, so I re-used the create settings in the test.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637

@dmitryax @Aneurysm9 @codeboten
@dashpole dashpole marked this pull request as ready for review March 11, 2024 13:15
@dashpole
Copy link
Contributor Author

dashpole commented Mar 11, 2024

seems like the changelog check is broken?

/usr/local/lib/node_modules/markdown-link-check/markdown-link-check:97
                    if (program.opts().ignore.some((ignorePath) => resolved.includes(ignorePath))) {

TypeError: Cannot read properties of undefined (reading 'some')
    at Command.<anonymous> (/usr/local/lib/node_modules/markdown-link-check/markdown-link-check:97:46)
    at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/markdown-link-check/node_modules/commander/lib/command.js:482:17)
    at /usr/local/lib/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1283:65
    at Command._chainOrCall (/usr/local/lib/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1[17](https://github.com/open-telemetry/opentelemetry-collector/actions/runs/8233460550/job/22512960811?pr=9637#step:10:18)7:12)
    at Command._parseCommand (/usr/local/lib/node_modules/markdown-link-check/node_modules/commander/lib/command.js:1283:27)
    at Command.parse (/usr/local/lib/node_modules/markdown-link-check/node_modules/commander/lib/command.js:909:10)
    at getInputs (/usr/local/lib/node_modules/markdown-link-check/markdown-link-check:108:7)
    at main (/usr/local/lib/node_modules/markdown-link-check/markdown-link-check:252:[20](https://github.com/open-telemetry/opentelemetry-collector/actions/runs/8233460550/job/22512960811?pr=9637#step:10:21))

@codeboten
Copy link
Contributor

Looks like it resolved :)

@codeboten codeboten merged commit dc411e3 into open-telemetry:main Mar 12, 2024
47 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 12, 2024
DougManton pushed a commit to DougManton/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
…lemetry#31640)

**Description:**

This should fix failures in
open-telemetry/opentelemetry-collector#9637

This unit test was relying on the ID from
`exportertest.NewNopCreateSettings` always being the same. This change
makes the test use the same create settings when storing the telemetry
registry, and when creating the trace exporter to avoid that problem.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637
DougManton pushed a commit to DougManton/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
open-telemetry#31659)

Follow-up to
open-telemetry#31640

I didn't realize the contrib test stopped after the first failure, so
there were a few more failures for
open-telemetry/opentelemetry-collector#9637.

I verified that this passes the contrib-tests check for the core repo
locally, so this should be the rest of them.

For the splunkhec exporter, the exporter actually uses `ID.String()`:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/4c5b5e934484ae3084565abbd3746a98e7f27721/exporter/splunkhecexporter/client.go#L71

The filelog receiver was assuming that `NewNopCreateSettings` returned
the same ID, so I re-used the create settings in the test.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637

@dmitryax @Aneurysm9 @codeboten
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
…lemetry#31640)

**Description:**

This should fix failures in
open-telemetry/opentelemetry-collector#9637

This unit test was relying on the ID from
`exportertest.NewNopCreateSettings` always being the same. This change
makes the test use the same create settings when storing the telemetry
registry, and when creating the trace exporter to avoid that problem.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
open-telemetry#31659)

Follow-up to
open-telemetry#31640

I didn't realize the contrib test stopped after the first failure, so
there were a few more failures for
open-telemetry/opentelemetry-collector#9637.

I verified that this passes the contrib-tests check for the core repo
locally, so this should be the rest of them.

For the splunkhec exporter, the exporter actually uses `ID.String()`:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/4c5b5e934484ae3084565abbd3746a98e7f27721/exporter/splunkhecexporter/client.go#L71

The filelog receiver was assuming that `NewNopCreateSettings` returned
the same ID, so I re-used the create settings in the test.

**Link to tracking Issue:**

Blocking
open-telemetry/opentelemetry-collector#9637

@dmitryax @Aneurysm9 @codeboten
tomasmota pushed a commit to tomasmota/opentelemetry-collector that referenced this pull request Mar 14, 2024
Long story, but i'm working on updating the prometheus dependency:
open-telemetry/opentelemetry-collector-contrib#30934

As part of that update, we need to adapt to a change that makes the
prometheus servers' self-observability metrics independent. See
prometheus/prometheus#13507 and
prometheus/prometheus#13610

One way to adapt to this change is by adding a label to each receivers'
metrics to differentiate one Prometheus receiver from another. I've
tried taking that approach in
open-telemetry/opentelemetry-collector-contrib#30934,
but the current issue is that the NoOp components all have the same
name, which causes the self-observability metrics to collide.

I can work around this in the prometheus receiver's own tests, but I
can't work around the issue in the `generated_component_test.go` tests,
since those are generated.

This PR makes the ID returned by `NewNopCreateSettings` unique by giving
it a unique name.

**Link to tracking Issue:**

Part of
open-telemetry/opentelemetry-collector-contrib#30883

cc @Aneurysm9

---------

Co-authored-by: Alex Boten <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants