Commit Graph

40 Commits

Author SHA1 Message Date
Chao Weng 6de29ce169 Add `component.Type` parameter to `NewNopSettings` And deprecate `NewNopSettingsWithType` (#12452)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add `component.Type` parameter to `NewNopSettings` And deprecate
`NewNopSettingsWithType` cc @mx-psi

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

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Updated

<!--Describe the documentation added.-->
#### Documentation
Added

<!--Please delete paragraphs that you did not use before submitting.-->
2025-02-21 11:17:45 +00:00
Pablo Baeyens a4ae175111
[*test] Add NewNopSettingsWithType everywhere (#12357)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Creates `NewNopSettingsWithType` function on test modules and deprecates
the `NewNopSettings` functions on those modules. Replace all usages of
`NewNopSettings` with `NewNopSettingsWithType`.

Part of #12305 but applied to all component kinds.

#### Link to tracking issue
Updates #12221
2025-02-13 16:56:20 +00:00
Bogdan Drutu abdfdc8d5f
[chore] Remove unused private funcs from generated code with mdatagen (#12339)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-02-11 00:25:13 +00:00
Bogdan Drutu 9b5208a53a
[chore] Remove dead code from mdatagen. (#12336)
Missed by
https://github.com/open-telemetry/opentelemetry-collector/pull/12304,
this variables can no longer be initialized so this becomes dead code.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-02-10 20:29:26 +00:00
Alex Boten 7d603aa46b
Remove deprecated funcs (#12304)
Removing all v0.119.0 deprecated funcs.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2025-02-06 03:57:26 +00:00
Bogdan Drutu 0a40b4e00b
Deprecate metadatatest.Telemetry in favor of componenttest.Telemetry (#12218)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-31 21:31:34 +00:00
Bogdan Drutu d9b97ffb43
[metadatatest] Generate NewSettings that accepts componenttest.Telemetry (#12216)
This is the last functionality needed to replace
`metadatatest.Telemetry` with `componenttest.Telemetry`.

The `metadatatest.Telemetry` will be deprecated next release to give
time to change contrib since it is a large change.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-30 21:42:20 +00:00
Bogdan Drutu fb8bb93121
Add helper to get a metric for componentest.Telemetry (#12215)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-30 19:04:27 +00:00
Bogdan Drutu 3203167e9a
Make registration of callback for async metric always optional (#12204)
This PR also solves one more issues with the new interface, which is the
ability to record multiple observations for a single async metric using
one callback.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-29 23:58:43 +00:00
Chao Weng c2f1599df9
Generate assert function for each metric in mdatagen (#12179)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Completion of #12167 , cc @bogdandrutu 

Updated one test to verify the change, will update the rest ones after
this PR merges.
<!-- Issue number if applicable -->
#### Link to tracking issue
n/a

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added

<!--Describe the documentation added.-->
#### Documentation
Added
<!--Please delete paragraphs that you did not use before submitting.-->
2025-01-25 16:52:04 +00:00
Bogdan Drutu 7db2f90d79
Allow passing trace/metric SDK options to componenttest.Telemetry (#12166)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-23 10:54:13 +00:00
Bogdan Drutu c6a0986813
Extract componenttest.Telemetry as generic struct for telemetry testing (#12151)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-22 20:27:45 +00:00
Pablo Baeyens b844bb7146
[cmd/mdatagen] Remove level field from metrics (#12145)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
<!-- Issue number if applicable -->

Removes `level` field. This will be added back in the future once #11754
is completed.

#### Link to tracking issue

Updates #11061
2025-01-22 14:09:03 +00:00
Chao Weng c14d4f96d6
Add tracing support in metadatatest (#12106)
#### Description
Add tracing support in metadatatest

cc @bogdandrutu  
#### Documentation
Added
2025-01-17 08:52:24 +00:00
Bogdan Drutu 306c939415
Deprecate component_test in favor of metadatatest (#11812)
The main idea behind this is that the test helpers were generated in the
main package, hard to find and understand and also impossible to use
outside the main package, see the
[service/internal/proctelemetry/process_telemetry_test.go](https://github.com/open-telemetry/opentelemetry-collector/compare/main...bogdandrutu:opentelemetry-collector:dep-comp-test?expand=1#diff-ed642eb1c968a9308a07e87292f77af1e0830a7af2d87111c5abacde4fc87446).

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-01-06 18:06:46 +00:00
Bogdan Drutu 9ea2f531f5
Remove deprecated LeveledMeter from the generated code (#11696)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-19 10:50:15 -08:00
Bogdan Drutu 8e522ad950
Revert public API changes in #10931, preserve logic (#11415)
This PR removes APIs that expose `configtelemetry.Level`. Internal
functionality still uses the Level, but will be soon changed to use the
new Instrument.Enabled.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-11-15 16:49:51 -08:00
Bogdan Drutu 2748e5358d
[chore] Use NopTelemetrySettings instead of mock providers (#11539)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-10-25 14:57:43 -07:00
Bogdan Drutu f9e73e209c
[chore] fix small indentation issue with metrics builder in mdatagen (#11300)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-09-30 11:39:58 -07:00
Bogdan Drutu 8a070097ec
[mdatagen] Avoid public APIs with internal params (#11040)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2024-09-13 09:37:43 -07:00
Alex Boten 7da6b618a7
[service] deprecate TelemetrySettings.MeterProvider (#10912)
This is replaced by a LeveledMeterProvider method on the struct instead.
This
reduces the complexity from the view of component authors, in that
there's no need
to check the level before invoking the meter to record a metric.

Closes
https://github.com/open-telemetry/opentelemetry-collector/issues/9510

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
2024-08-29 12:05:54 -07:00
Alex Boten 2d6cb025d0
[mdatagen] mark Meter as deprecated (#10939)
This is split from
https://github.com/open-telemetry/opentelemetry-collector/pull/10912

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-08-21 09:59:16 -07:00
Alex Boten 070e85522e
[mdatagen] add LeveledMeter method (#10933)
This will use the LeveledMeterProvider in TelemetrySettings.
    
Split from
https://github.com/open-telemetry/opentelemetry-collector/pull/10912,
follows #10931

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-08-21 08:05:13 -07:00
Curtis Robert 3f4f0d082d
[batchprocessor] Update metric units (#10658)
#### Description
`1` isn't an informative metric unit. I've made a best-guess attempt at
updating metric units, f**eedback is very necessary here**, the units
are not very clear here. I attempted to match the unit with metric
descriptions.

[Semantic conventions for
reference](https://opentelemetry.io/docs/specs/semconv/general/metrics/).

#### Link to tracking issue
Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/10652
2024-08-13 10:50:27 -07:00
Alex Boten ef07ea0735
[mdatagen] move ScopeName to generated_status (#10848)
This will make it available to most components, as the
generated_telemetry is only generated for components that have internal
telemetry configured. Arguably the scope name should be moved to its own
file, but i'd rather not add yet another file if possible.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-08-09 12:10:11 -07:00
Alex Boten 7638bb2981
[mdatagen] export ScopeName in internal/metadata package (#10845)
This can be used by components that need to set their scope name
manually. Will save component owners from having to store a variable,
which may diverge from the scope name used by the component for emitting
its own telemetry. There are about a dozen components in contrib that
could use this today.

Alternatively, I could just update the scope name strings in the
components manually.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-08-09 08:12:05 -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
Dmitrii Anoshin 4d57f5e0b8
[mdatagen] Remove WithAttributes from the telemetry builder constructor (#10608)
Attribute sets for async instruments now can be set as options to
callback setters and async instruments initializers. This allows each
async instrument to have its own attribute set.

Unblocks
https://github.com/open-telemetry/opentelemetry-collector/pull/10593
2024-07-16 10:36:35 -07:00
Dmitrii Anoshin d545fb6a10
[exporterhelper] Fix incorrect deduplication of exporter queue metrics (#10550)
Fix incorrect deduplication of otelcol_exporter_queue_size and
otelcol_exporter_queue_capacity metrics if multiple exporters are used.

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

The registered callbacks are ignored for now, which is the same behavior
as before. Ideally, we would need to unregister them properly.
2024-07-08 08:23:16 -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 567a175ed9
[batchprocessor] ensure attributes are set on metadata metric (#10245)
Fixing this bug required a change in mdatagen to ensure attributes could
be passed in to the telemetry builder.
    
Fixes #9674

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-29 09:10:01 -07:00
Alex Boten 1d8c53ff0f
[batchprocessor] use mdatagen for async metric (#10233)
Follows
https://github.com/open-telemetry/opentelemetry-collector/pull/10232,
use mdatagen for async counter

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-28 11:15:55 -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 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 d73235fc91
[mdatagen] use mdatagen to produce component internal telemetry (#10054)
#### Description

This updates mdatagen to generate internal telemetry for components
based on metadata.yaml configuration.

#### Testing

Added tests to mdatagen and updated the batch processor to use this as
well for synchronous counters and histogram

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-05-06 14:01:35 -07:00
Alex Boten ce09d9773a
[mdatagen] move telemetry into its own file (#10037)
This is in preparation for using mdatagen for component telemetry.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-04-29 12:11:55 -07:00
Dmitrii Anoshin 78692b78c3
[chore] [cmd/mdatagen] Update status.go template (#9713)
To produce the same output as mdatagen in contrib. It makes it easy to
compare the diff for the mdatagen migration.
2024-03-05 13:35:54 -08:00
Alex Boten aa764826e1
[mdatagen] produce scope name with full url (#9556)
This is part of #9494

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2024-02-14 07:49:56 -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 36bdd22601
[chore] use mdatagen for batch processor (#9183)
Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-12-22 11:12:32 -08:00