Commit Graph

10 Commits

Author SHA1 Message Date
David Ashpole dc411e37b8
Give NoOp create settings a unique name (#9637)
Long story, but i'm working on updating the prometheus dependency:
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/30934

As part of that update, we need to adapt to a change that makes the
prometheus servers' self-observability metrics independent. See
https://github.com/prometheus/prometheus/issues/13507 and
https://github.com/prometheus/prometheus/pull/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
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/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
https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30883

cc @Aneurysm9

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-03-12 12:17:11 -07:00
Antoine Toulme e108a6125d
[chore] change a few comments in receivertest (#9542) 2024-02-09 08:15:43 -08:00
Pablo Baeyens 26c157e3bf
[component] Add MustNewType constructor for component.Type (#9414)
**Description:** 

- Adds `component.MustNewType` to create a type. This function panics if
the type has invalid characters. Add similar functions
`component.MustNewID` and `component.MustNewIDWithName`.
- Adds `component.Type.String` to recover the string
- Use `component.MustNewType`, `component.MustNewID`,
`component.MustNewIDWithName` and `component.Type.String` everywhere in
this codebase. To do this I changed `component.Type` into an opaque
struct and checked for compile-time errors.

Some notes:

1. All components currently on core and contrib follow this rule. This
is still breaking for other components.
2. A future PR will change this into a struct, to actually validate this
(right now you can just do `component.Type("anything")` to bypass
validation). I want to do this in two steps to avoid breaking contrib
tests: we first introduce this function, and after that we change into a
struct.

**Link to tracking Issue:** Updates #9208
2024-02-02 17:33:03 +01:00
Alex Boten 2f72949334
remove NewCreateSettings funcs (#8508)
follow up on #8501. As per the suggestion, the code in NewCreateSettings
is pretty small and not needed as a separate function.

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-25 09:12:42 -07:00
Alex Boten 921b6125f0
deprecate To*CreateSettings methods in `obsreporttest.TestTelemetry` (#8501)
These methods create an import cycle when trying to move obsreporttest
to
componenttest. Deprecating these methods will allow us to remove them in
the next version and move the remaining code into componenttest

Fixes #8492

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-22 10:51:19 -07:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Bogdan Drutu bc870f854e
Remove deprecated funcs from componenttest (#6836)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-19 21:42:31 -08:00
Bogdan Drutu e63aed8fef
Improve service Config types name (#6787) (#6803)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-15 12:43:00 -08:00
Bogdan Drutu 42c7b20c31
Remove deprecated componenttest.NewNop*CreateSettings (#6761)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-12 17:04:07 -08:00
Daniel Jaglowski a470d8a8f3
Deprecate component.Receiver* in favor of new receiver.* (#6687)
* Deprecate component.Receiver* in favor of new receiver.*

* Update component/receiver.go

Co-authored-by: Bogdan Drutu <lazy@splunk.com>

* Update component/receiver.go

Co-authored-by: Bogdan Drutu <lazy@splunk.com>

* Update component/receiver.go

Co-authored-by: Bogdan Drutu <lazy@splunk.com>

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
2022-12-08 14:26:14 -08:00