Commit Graph

103 Commits

Author SHA1 Message Date
Daniel Jaglowski 49339e80cc
[chore] Reduce complexity in processorhelper obsreport (#10693)
This PR removes the `recordData` method, which I believe is an unhelpful
abstraction for reporting internal processor metrics.

The drawbacks of the function are minor, but briefly:
1. Recording any metric requires passing in zeros for _all other
metrics_. This is cumbersome to extend because any new metric requires
updating the call to `recordData` for all metrics. It's also fragile
because if we have more than a few metrics it is easy to position the
intended metric incorrectly.
2. Every metric describes one data type, which is passed into
`recordData` but then just used as a switch to get back to code that is
specific to that data type.
3. Every call to `recordData` instantiates N variables, where N is the
number of metrics for each data type.

All of this seems unnecessary as we can just report each metric in one
unambiguous line of code.
2024-07-22 12:54:30 -07:00
Alex Boten 9ef6356835
[processorhelper] update units for metrics (#10647)
This updates units for processhelper's internal telemetry.

Related #10556

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/10651

For this PR i updated `metadata.yaml` and ran `make gogenerate`, then
`make -C processor test`

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-07-22 09:55:31 -07:00
Alex Boten 5753a58f71
update all metrics to include otelcol_ prefix (#9759)
This ensures the consistency for folks emitting metrics w/ OTLP until
the OTEP to specify pipeline telemetry is completed.

Waiting on
https://github.com/open-telemetry/opentelemetry-collector/pull/9775
before moving this forward

Fixes #9315

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-07-16 16:18:37 -07:00
Pablo Baeyens a8b5f8dbf9
[chore] Use string for unit type (#10555)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Uses string type for `unit` field in mdatagen related files.

<!-- Issue number if applicable -->
#### Link to tracking issue

Needed for #10554
2024-07-08 18:43:46 +02:00
Daniel Jaglowski ea7270caba
Add "inserted" metrics to processors (#10372)
#### Link to tracking issue

Resolves #10353

#### Testing

Added equivalent testing to other processor metrics (accepted, refused,
dropped).

#### Documentation

Metric documentation is autogenerated.

#### Open Question

My initial implementation includes a breaking change to
`componenttest.TestTelemetry` which is public facing API. If we want to
avoid an immediate breaking change in this test package, I would propose
the following, which I can submit in a prerequisite PR:
1. Deprecate all `TestTelemetry.Check*` methods.
2. Replace with more granular `TestTelemetry.CheckOneSpecificMetric`
methods.
2024-06-19 12:15:42 +02:00
Alex Boten 6888f8f7a4
[chore] removing unused loggers (#10354)
These were declared and not used anywhere. Removing them.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-06 10:44:09 -07:00
Alex Boten 9907ba50df
[processor] deprecate CreateSettings -> Settings (#10336)
This deprecates CreateSettings in favour of Settings.
NewNopCreateSettings is also being deprecated in favour of
NewNopSettings
    
Part of #9428

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-06 09:34:53 -07:00
Alex Boten 7b0c38e609
[mdatagen] make meter a struct member of telemetryBuilder (#10314)
This will be used in a follow up PR that allows initialization of
optional internal metrics which address the queue metric use-case.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-06-04 14:54:41 -07:00
Alex Boten 860632715e
[processorhelper] use mdatagen level and noop meter (#10235)
This cleans up the need to have a level in the ObsReport struct. Added
test to validate the change as none existed before

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-30 08:15:59 -07:00
Alex Boten b53ba2c2f5
[chore] remove WithOTel test wrapper (#10236)
This is no longer needed since we're not testing WithOTel and
WithOpenCensus.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-28 09:08:07 -07:00
Alex Boten 52a9520fdb
mdatagen: support setting telemetry level in telemetry builder (#10234)
This allows components to set the minimum level needed for them to
produce telemetry. By default, this is set to
`configtelemetryLevelBasic`. If the telemetry level is below that
minimum level, then the noop meter is used for metrics.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-28 08:59:50 -07:00
Alex Boten 29402267eb
[mdatagen] generate utility code to test telemetry (#10212)
This will allow components to more easily test the telemetry they should
be emitting.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-27 09:09:35 -07:00
Alex Boten e55d22aec6
[mdatagen] update mdatagen to document internal telemetry (#10170)
This allows end users to see what telemetry each component should be
emitting.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-16 14:49:28 -07:00
Alex Boten 28242fab81
[mdatagen] add support for async instruments (#10159)
This PR adds the ability to configure asynchronous (observable)
instruments via mdatagen. This requires providing a mechanism to set
options to pass in the callbacks that will be called at the time of the
observation.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-16 13:15:27 -07:00
Alex Boten 4458b43439
[chore] use mdatagen for processorhelper (#10122)
This updates the processor helper to use mdatagen for its internal
telemetry.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-09 07:03:07 -07:00
Alex Boten bc879397bb
[telemetry] emit metrics with _ instead of / (#9775)
This is addressing an issue w/ the names of the metrics generated by the
Collector for its internal metrics. Note that this change only impacts
users that emit telemetry using OTLP, which is currently still in
experimental support. The prometheus metrics already replaced `/` with
`_`.

Fixes #9774

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-04-03 14:42:27 -07:00
Antoine Toulme 08a692279c
[component] Deprecate ErrNilNextConsumer (#9526)
**Description:**
Deprecate ErrNilNextConsumer and implement nil checks in the builder
structs.
2024-02-23 13:54:46 -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 9c7177496f
[chore] remove unused opencensus code (#9108)
Follows
https://github.com/open-telemetry/opentelemetry-collector/pull/9102

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-01-30 10:19:42 -08:00
Alex Boten 834413537b
[telemetry] mark useOtelForInternalMetrics stable (#9102)
This marks the flag as stable. Leaving this as a draft until v0.92.0 is
released.

Closes https://github.com/open-telemetry/opentelemetry-collector/issues/8962
Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/816

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-01-16 15:38:21 -08: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 c64ac69dac
[chore] Enable goleak for tests failing on opencensus-go (#9210)
**Description:**
As described
[here](https://github.com/open-telemetry/opentelemetry-collector/issues/9165#issuecomment-1874732291)
and
[here](https://github.com/open-telemetry/opentelemetry-collector/issues/9165#issuecomment-1874836336),
there are quite a few packages that directly or indirectly import the
[OpenCensus-go stats
package](https://pkg.go.dev/go.opencensus.io/stats). Within the
[stats/view
package](https://pkg.go.dev/go.opencensus.io@v0.24.0/stats/view) there's
an init() function that starts goroutines that aren't cleaned up. This
causes goleak to fail.

Since the failure is caused by OpenCensus always indirectly (from what I
can tell), and OpenCensus is now read-only, I believe it's fair to
ignore leaks caused by this dependency and specific leaking situation.

**Link to tracking Issue:** <Issue number if applicable>
#9165

**Testing:**
All added tests are passing
2024-01-03 19:26:27 -08:00
Alex Boten a158ff3cfc
make useOtelForInternalMetrics as beta (#9037)
The metrics are now consistent with the metrics produced by OpenCensus.
We should move the featuregate forward.

Note that the OpenTelemetry generated metrics includes grpc
client/server metrics (for receivers/exporters that use grpc) and
`target_info` metrics

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/7454

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-12-12 13:59:41 -08:00
Alex Boten 420930365a
[obsreporttest] ensure tests validate either oc or otel (#8758)
This change adds a separate prometheus registry for testing the otel vs
the oc path through the code. Previous to this change, the
otelPrometheusChecker was using the opencensus prometheus exporter which
was really confusing and could possibly hide problems.

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-10-25 13:37:10 -07:00
Alex Boten b5635a7a90
remove workaround to ignore for errors when creating instruments (#8575)
The workaround had been put in place because of a restriction on `/`
characters in the name of the instrument. This is no longer an issue.
This PR fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/8346

Follows
https://github.com/open-telemetry/opentelemetry-collector/pull/8574

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-10-04 11:50:26 -07: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 e116f8c928
[chore] remove duplicated variable definitions (#8500)
Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-22 07:28:08 -07:00
Alex Boten 9549a14a31
deprecate processor API in obsreport (#8496)
These deprecated methods/structs have been moved to processorhelper:
- `obsreport.BuildProcessorCustomMetricName` ->
`processorhelper.BuildCustomMetricName`
  - `obsreport.Processor` -> `processorhelper.ObsReport`
  - `obsreport.ProcessorSettings` -> `processorhelper.ObsReportSettings`
  - `obsreport.NewProcessor` -> `processorhelper.NewObsReport`

Same as the change for the exporter, no functional changes just moving
code over to the
new location.

~Follows
https://github.com/open-telemetry/opentelemetry-collector/pull/8493~

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-09-20 16:51:35 -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
Alex Boten db781bc774
[chore] clean up old references in docs (#7637)
This removes the remaining references to components living in the `component` module. Fixes #6578

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-09 15:13:58 -07:00
Bogdan Drutu 7cb2d7622d
Remove deprecated comonent.Config.[ID|SetIDName]; Deprecate config.*Settings (#6718)
* Remove deprecated comonent.Config.[ID|SetIDName]; Deprecate config.*Settings

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

* Update .chloggen/rmcfgid-1.yaml

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2022-12-12 14:35:45 -08:00
Daniel Jaglowski fdef8b181a
Deprecate `Processor` related structs and functions in favor of `processor` package (#6709) 2022-12-09 08:09:27 -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 Drutu 1028e3d2a2
Deprecate special Configs for each component type, use a standard opaque Config (#6617)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-11-23 15:02:54 -08:00
Bogdan fbf1e2a09c Revert changes to config.[Receiver|Processor|Exporter|Extension]Settings
Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-11-05 10:04:50 -07: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 fef6c558ce
Remove deprecated components helpers funcs (#6006)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-31 12:48:34 -07:00
Bogdan Drutu ddc996f45a
Fix deprecation version in deprecation message (#5932)
Bogdan was back in time for 1 week :)

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

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-17 15:53:39 -07:00
Bogdan Drutu 9e90e25435
Deprecate New*ProcessorWithCreateSettings, update New*Processor to the new API (#5915)
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-15 15:25:21 -07:00
Bogdan Drutu 7a41e2f47e
Deprecate processorhelper.New*Processor in favor of New*ProcessorWithCreateSettings (#5833)
Main motivation is to ensure that Settings are passed (to enable obsreport usage which requires settings to be passed) as well as the context.

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

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-08-10 10:54:59 -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
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
Bogdan Drutu ce71309a1d
Deprecate consumerhelper, move helpers to consumer (#5006)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-03-16 05:24:33 -07:00
Bogdan Drutu b9a10cdc6e
Remove all deprecated funcs/structs from v0.46.0 (#4995)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-03-14 11:19:49 -07:00
Bogdan Drutu 004dd4da35
Move everything from processorhelper to component. (#4889)
Updates https://github.com/open-telemetry/opentelemetry-collector/issues/4681

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-02-22 14:23:40 -08:00
Bogdan Drutu c4134ba6f3
Add the StartFunc/ShutdownFunc to component directly (#4803)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-02-18 11:29:49 -08:00
Bogdan Drutu 0ef0a9ce7b
Use directly the consumer helper funcs in the other helpers packages. (#4719)
Try to understand if the Component helper is necessary, or only having the helper funcs is enough.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-01-26 10:59:26 -08:00
Pablo Baeyens 883afc505d
Remove BaseProcessorFactory, force using helper (#4175)
* Add internalinterface package

This adds a general InternalInterface to make an interface impossible
to implement.

* Use internalinterface.InternalInterface for Processor as a test

* Add Changelog note

* need to use -> must use

* Add small unit test

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-11-01 17:54:12 -07:00
José Carlos Chávez 9d3a8a4608
Adds vanity import check (#4180)
* chore: adds porto and fixes vanity imports.

* chore: fixes target overriding.

* chore: fixes install of porto.

* chore: includes porto as a tool.

* chore: upgrades porto to check internals.

* chore: rebase and update vanity import.

* chore: removes unnecessary space.

* chore: rollsback vanity import in generated files.
2021-10-12 13:47:36 -07:00