Commit Graph

50 Commits

Author SHA1 Message Date
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 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 83d463ceba
[obsreport] deprecate test funcs/structs (#8538)
This deprecates the remaining code under the obsreport package.

Follows
bf141227c5

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-01-12 09:28:57 -08:00
Curtis Robert 5cdf27c066
[chore][receiver/scraperhelper] Enable goleak check (#9226)
**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.
2024-01-05 09:55:59 -08: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
Sean Marciniak 38ba4d5ac1
[scraper helper] improve ease of use of scraper controller settings (#7951)
- Reduce the complexity required in order to override values within
components
- Address feedback from
https://github.com/open-telemetry/opentelemetry-collector/pull/7703#discussion_r1235257542
2023-07-13 11:51:02 -07:00
Sean Marciniak ce6535092d
[scrapehelper] Make the initial scrape interval configurable (#7635)
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.
2023-06-02 10:56:52 -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 892c826cf4
Remove deprecate obsreporttest.Check*; Deprecate SetupTelemetryWithID (#6720)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-09 10:16:38 -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
Bogdan Drutu e7edb006e6
Deprecate obsreporttest.Check* in favor of TestTelemetry.Check (#6678)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-12-05 11:13:28 -08:00
Bogdan Drutu d0fe772781
Deprecate component.Config.ID(), add helper for obsreporttest (#5870)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-29 14:35:49 -08:00
Bogdan d6ed8246b6 Deprecate all types and funcs in config package
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>
2022-11-05 10:04:49 -07:00
Bogdan Drutu 35cf596fc1
Deprecate pmetric.Metric.SetDataType, in favor of empty setters (#5979)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-09-07 23:16:48 -07:00
Bogdan Drutu e6b5cd54d1
Deprecate componenterror package, move to component (#5383)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-05-17 17:18:08 -07:00
Bogdan Drutu e8dd9536f5
Enable errorlint and fix all warnings (#5364)
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>
2022-05-16 10:36:41 -07:00
Dmitrii Anoshin 734e25e8de
Split `model` by signal type and move it to the new `pdata` module (#5168)
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.
2022-04-11 16:00:26 -07:00
Alex Boten 1d5fdd1c1f
Deprecation of pdata methods following OTLP v0.15.0 (#5076)
* 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
2022-03-28 00:32:48 -07:00
Sean Marciniak d5656d6bb2
Updating methods to reflect the contribution guide's recommendations (#4865) 2022-02-18 11:12:40 -08:00
Pablo Baeyens a8ff2dd98c
Enable `errcheck` linter (#4462)
* Check or explicitly ignore all errors

* Enable errcheck

* Use `t.Cleanup` instead of `defer`

* Point to issue on `Set` ignored error
2021-11-23 12:27:32 -08:00
Alex Boten 8edb16d54b
Update Check* functions to support TestTelemetry (#4283)
The following change updates various obsreporttest methods to support TestTelemetry:
* CheckExporterMetrics, CheckExporterTraces, CheckExporterLogs
* CheckProcessorTraces, CheckProcessorMetrics, CheckProcessorLogs
* CheckReceiverLogs, CheckReceiverTraces, CheckReceiverMetrics
* CheckScraperMetrics
2021-11-01 17:19:08 -07:00
Alex Boten 1662562f1a
nit: clean up test variable names (#4281)
SetupTelemetry returns TestTelemetry, the variable set didn't reflect this.
2021-10-27 15:58:12 -07:00
Bogdan Drutu bd87fb6280
Change scraperhelper to follow the recommended append model for pdata (#4202)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-10-15 16:38:22 -07:00
Anthony Mirabella 2209f2a198
obsreport: wire up ReceiverCreateSettings for receivers using obsreport (#4149)
* 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>
2021-10-11 08:34:57 -07:00
alrex 273260a371
rename SetupRecordedMetricsTest -> SetupTelemetry (#4157)
* rename SetupRecordedMetricsTest -> SetupTelemetry

* rename TestTelemetrySettings -> TestTelemetry
2021-10-04 08:48:22 -07:00
alrex 896335f57c
SetupRecordedMetricsTest returns TelemetrySettings (#4093)
* return TelemetrySettings from SetupRecordedMetricsTest

* fix lint

* add ToExporterCreateSettings/ToReceiverCreateSetting

* replace return func with Shutdown

* pass context to shutdown
2021-09-29 11:15:15 -07:00
James 85b8094e26
Rename `config.NewID` to `config.NewComponentID` and `config.NewIDFromString` to `config.NewComponentIDFromString` (#4137)
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
2021-09-29 10:28:07 -04:00
Bogdan Drutu b39f52bfe6
Deprecate consumererror.Combine, use go.uber.org/multierr (#4123)
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>
2021-09-27 13:18:34 -07:00
alrex 10f543a9a4
obsreporttest now returns an error (#4080) 2021-09-23 20:12:11 +03:00
Bogdan Drutu 271c826106
Remove dependency on deprecated go.opentelemetry.io/otel/oteltest (#3979)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-09-08 09:56:17 +03:00
Bogdan Drutu 9c4ef33f76
Convert scraperhelper to new Number metrics (#3717)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-26 15:05:47 -07:00
Bogdan Drutu fb95c88e72
Change internal tracing to use otel trace (#3567)
For the moment we rely on the global TracerProvider, in a future PR will change that.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-08 16:53:11 -07:00
Bogdan Drutu 5544267e7d
Change MetricsSink to count data points not metrics (#3549)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-02 09:29:41 -07:00
Bogdan Drutu d1fced9688
Refactor MetricAndDataPointCount to DataPointCount (#3547)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-01 13:43:31 -07:00
Jay Camp cbee3b3948
scraperhelper: fix case when returned pdata is empty (#3520)
On error pdata.Metrics may not be initialized so guard against it. Update test
to return uninitialized object on error.
2021-06-29 11:31:46 -07:00
Jay Camp 40d6a556f1
scraperhelper: use common scraping interface (#3487)
* 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
2021-06-28 11:07:24 -07:00
Bogdan Drutu c63d0c68cd
Move pdata in the new package (#3483)
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>
2021-06-25 01:17:31 +03:00
Bogdan Drutu cbeece662b
Use config.ComponentID for obsreport receiver/scraper (#3098)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-05-05 19:01:03 -07:00
Bogdan Drutu faa78aa7f6
Use config.ComponentID for Receivers config (#2870)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-04-30 16:29:10 -07:00
Bogdan Drutu 13e45667cf
Cleanup usages of Resize(1), after PR #2970 (#2971)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-04-20 18:04:31 -07:00
Bogdan Drutu b4f495f08e
Remove suffix Views from test helper funcs, avoid correlation with OpenCensus (#2934)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-04-14 17:22:44 -07:00
Anthony Mirabella a65a5a6978
Tidy up `consumer/consumererror` package. (#2768)
* 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
2021-03-23 16:35:23 -07:00
Bogdan Drutu 0c6757ec71
Rename [Traces|Metrics|Logs]Consumer to [Traces|Metrics|Logs] (#2761)
* Rename [Traces|Metrics|Logs]Consumer to [Traces|Metrics|Logs]

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

* Update internal/testcomponents/example_exporter.go

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
2021-03-23 08:04:44 -07:00
Bogdan Drutu 65c4c4a1b3
Move scraper error outside of phase1 stable packages (#2580)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-07 19:33:10 -08:00
Bogdan Drutu 5cc0707e8a
Move CombineErrors to consumererror package (#2442)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-02-12 15:13:01 -08:00
Bogdan Drutu 47ffc511cb
Expose non-nullable metric types (#2208)
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>
2020-11-24 14:22:57 -08:00
Bogdan Drutu 7874cd5faa
Remove usage of custom init/stop in scraper and use start/shutdown from component (#2193)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-23 14:00:42 -05:00
Bogdan Drutu e365c9bfbc
Move scraper helpers to its own package scraperhelper (#2185)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-20 05:51:30 -08:00