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.
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>
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>
<!--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
#### 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.
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>
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>
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>
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>
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>
This allows end users to see what telemetry each component should be
emitting.
---------
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
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>
This updates the processor helper to use mdatagen for its internal
telemetry.
---------
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
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>
**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
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>
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>
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>
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>
* [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>
This removes the remaining references to components living in the `component` module. Fixes#6578
---------
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>
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>
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.
* 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>
* 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.