**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
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Add `goleak` to detect leaks in tests. Leaking goroutines were detected
that were caused by a dependency that we can ignore
(`go.opencensus.io/stats/view.(*worker).start`), a `Shutdown` call was
also added that was missing.
**Link to tracking Issue:** <Issue number if applicable>
#9165
**Testing:** <Describe what testing was performed and which tests were
added.>
Added check is passing as well as existing tests.
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>
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>
This change will allow scrapers to start gather values on scrape controller start instead of having to wait for scrape controller duration to perform the initial scrape.
This is particularly useful for components such as hostmetrics receiver that generate utilization metrics that require an initial state to compute that value. With this change, it means that this metrics will start being sent from Start + Duration instead of Start + 2*Duration which for scrape durations like 30s means that this value won't be sent til a minute has elapsed.
* [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>
The main reason is to remove the circular dependency between the config (including sub-packages) and component. Here is the current state:
* component depends on config
* config/sub-package[grpc, http, etc.] depends on config & component
Because of this "circular" dependency, we cannot split for example "config" into its own module, only if all the other config sub-packages are also split.
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
On top of the errorlint errors, also changes `fmt.Errorf("string literal")` with `errors.New("string literal")`.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Split all `pdata` related code by type and move it from `model` to the new module `pdata`.
- `model/pdata` and `model/otlp` are moved to `pdata/plog`, `pdata/pmetric` and `pdata/ptrace`.
- `model/otlpgrpc` is moved to `pdata/plogotlp`, `pdata/pmetricotlp` and `pdata/ptraceotlp`.
Now all the API in `model` except for `model/semconv` is deprecated.
* Deprecation of pdata methods following OTLP v0.15.0
Adding deprecation methods for the following pdata methods:
- InstrumentationLibrary is now Scope
- InstrumentationLibrarySpans is now ScopeSpans
- InstrumentationLibraryLogs is now ScopeLogs
- InstrumentationLibraryMetrics is now ScopeMetrics
* update changelog
* add deprecated method on resource spans/metrics/logs
* add InstrumentationLibrary deprecation method
The following change updates various obsreporttest methods to support TestTelemetry:
* CheckExporterMetrics, CheckExporterTraces, CheckExporterLogs
* CheckProcessorTraces, CheckProcessorMetrics, CheckProcessorLogs
* CheckReceiverLogs, CheckReceiverTraces, CheckReceiverMetrics
* CheckScraperMetrics
* obsreport: wire up ReceiverCreateSettings for receivers using obsreport
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* obsreport: wire up ReceiverCreateSettings for scrapers using obsreport
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* pass ReceiverCreateSettings through scraper controller
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fix lint issue
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Ensure TracerProvider is available to scraper receiver for now
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Fix test failures
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
This PR is to rename `config.NewID` to `config.NewComponentID` and `config.NewIDFromString` to `config.NewComponentIDFromString` for naming consistency.
**Link to tracking Issue:**
Fixes#4105
The functionality was added before the support for errors.Is/As was added to golang,
right now this is no longer needed and generic packages like go.uber.org/multierr are more user friendly.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* scraperhelper: use common scraping interface
This removes the MetricsScraper and ResourceMetricsScraper interfaces in favor
of a single Scraper interface that scrapes and returns pdata.Metrics. There
were already helper wrappers that allow users to return MetricSlices and
ResourceMetricSlices. These helpers package those results into pdata.Metrics
for the base interface.
Resolves#3085: This also removes the multiMetricScraper which wrapped multiple
scrapers to appear as a single scraper but then functions like scraper.ID()
would be empty. This was evident when trying to log errors and you couldn't
figure out what scraper made the error because it was wrapped in the
multiscraper.
* review updates
The new module go.opentelemetry.io/collector/model will be created later when the internal data will
also be moved.
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Tidy up `consumer/consumererror` package.
* Updated docblocks for grammar and consistency
* Added `IsPartial()` predicate to match `IsPermanent()`
* Ensured tests for `PartialError` test the public interface
Remove `PartialError` and replace with individual signal error types
Refactor consumererror signal extraction to simplify exporterhelper request interface
* Rename consumererror signal error types to align with rest of codebase
* Rename `onPartialError` to `onError` in `exporterhelper.request` interface
* Provide conversion methods to consumererror signal error types.
This moves the accessors for signal data to methods on the individual error types
and provides As<Signal>() package functions that behave as targeted versions of
the errors.As() function.
* Avoid unnecessary allocation, fixup docs
This is possible because:
* Gogo proto (and protobuf) will not unmarshal any nil element in a oneof;
* Set type will initialize the oneof wrapper as well as the element;
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>