Commit Graph

17 Commits

Author SHA1 Message Date
Matthieu MOREL 37f783308e
[chore]: enable require-error rule from testifylint (#11199)
#### Description

Testifylint is a linter that provides best practices with the use of
testify.

This PR enables
[require-error](https://github.com/Antonboom/testifylint?tab=readme-ov-file#require-error)
rule from [testifylint](https://github.com/Antonboom/testifylint)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-18 15:02:22 -07:00
Alex Boten 062d0a7ffc
[chore] remove unnecessary underscores (#9580)
As per feedback from my previous PR

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-02-13 13:34:53 -08:00
Alex Boten 4688461318
[chore] fix unused params (#9578)
Related to #9577

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-02-13 11:04:48 -08:00
Pablo Baeyens 9047c0e373
[receiver/otlp, internal, featuregate] Add featuregate to switch to localhost defaults for server-like components (#8622)
**Description:** 

- Define `component.UseLocalHostAsDefaultHost` in the
`internal/localhostgate` package.
- Define `featuregate.ErrIsAlreadyRegistered` error, returned by
`Register` when a gate is already registered.
- Adds support for the localhost gate on the OTLP receiver.

This PR does not remove the current warning in any way, we can remove
this separately.

**Link to tracking Issue:** Updates #8510

**Testing:** Adds unit tests

**Documentation:** Document on OTLP receiver template and add related
logging.
2024-01-24 13:33:50 +01:00
Pablo Baeyens 8bea0d372c
[featuregate] Validate arguments to `Register` (#8766)
**Description:**
- Validate Gate IDs: ids must be alphanumeric with dots. At a minimum we
have to disallow `,` to avoid ambiguity in the CLI, but I am being
intentionally more restrictive here
- Validate URLs: we check that a valid URL can be built from it using
the `net/url` stdlib package
- Validate versions: we check that a valid version is passed to the
`To/FromVersion` options using hashicorp's libraries and also that the
implicit version range, when defined, is not empty.

This does not change the public API types, it only adds validation.

Relates to #8220

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: Alex Boten <aboten@lightstep.com>
2023-11-07 13:28:59 +01: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
Tyler Helmuth 9b978f74f3
[featuregate] Fix issue where StageDeprecated cause an error on register (#7586)
* Update Deprecated to work like Stable but false

* Add changelog

* Fix lint

* Update README
2023-05-09 17:06:42 -07:00
Tyler Helmuth 9ef6429bd0
[featuregate] Finalizing purpose of ToVersion. (#7626)
Finalizes the purpose of `toVersion`.  `toVersion` will represent the version where the feature gate is completely removed.  Setting a `stable` gate to `true` will result in a warning log.  Setting a `stable` gate to `false` will result in an error.

Closes https://github.com/open-telemetry/opentelemetry-collector/issues/7621
2023-05-04 15:33:03 -07:00
Bogdan Drutu 884cdc5b1d
featuregate: Add deprecated Stage and to/from versions (#7484)
Fixes 2 out of the 3 tasks in https://github.com/open-telemetry/opentelemetry-collector/issues/7043

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-04-04 08:43:34 -07:00
Bogdan Drutu e769012633
Fix API to be compatible with flagset, missed the comment initially (#7148)
Not breaking change, not released yet.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-02-07 11:10:52 -08:00
Bogdan Drutu cf9c829c35
Deprecate featuregate.Registry.List in favor of Visit. (#7041)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-26 19:21:11 -08:00
Bogdan Drutu b03b04620a
Deprecate RegistryOption in favor of RegisterOption (#7012)
This is consisten with other places where we call the options as the func that applies to.

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

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-25 15:44:23 -08:00
Bogdan Drutu f616fab869
Deprecate Apply in favor of Set (#7018)
Trying to keep the API closer to some standard libraries like FlagsSet. If a getter is needed we should name it Lookup.

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

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-25 13:31:17 -08:00
Bogdan Drutu fec9cd3dda
Change featuregate.Registry to return registered Gate (#6998)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-24 12:15:11 -08:00
Bogdan Drutu 1699701fd6
Deprecate featuregate.GetRegistry in favor of GlobalRegistry (#6979)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-19 15:08:13 -08:00
Bogdan Drutu 18882f68de
[featuregate] use map of pointer to the gates, avoid re-adding to the map (#6973)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-19 10:04:43 -08:00
Bogdan Drutu 65152ee7dd
Deprecate Get prefix funcs for featuregate.Gate (#6528)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-11 14:21:48 -08:00