-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MeasurementProcessor specification to Metrics SDK #4318
base: main
Are you sure you want to change the base?
Changes from 1 commit
3f3186a
a8f5de3
1ce9e4d
4b0a58d
449d2fb
60adbd3
9d60b12
17f650c
4cbc0ec
01bcc0a
d28e993
90d331d
ee72e3f
225000a
8fbc341
f57fe00
66c6926
e585028
83a81a5
dbaffa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ linkTitle: SDK | |
- [MeasurementProcessor](#measurementprocessor) | ||
* [MeasurementProcessor operations](#measurementprocessor-operations) | ||
+ [OnMeasure](#onmeasure) | ||
* [Built-in processors](#built-in-processors) | ||
+ [SimpleProcessor](#simpleprocessor) | ||
- [Exemplar](#exemplar) | ||
* [ExemplarFilter](#exemplarfilter) | ||
+ [AlwaysOn](#alwayson) | ||
|
@@ -993,6 +995,8 @@ series and the topic requires further analysis. | |
|
||
`MeasurementProcessor` is an interface which allows hooks when a `Measurement` is recorded by an `Instrument`. | ||
|
||
Built-in measurement processors are responsible for [Measurement Processing](#measurement-processing). | ||
|
||
`MeasurementProcessors` can be registered directly on SDK `MeterProvider` and they are invoked in the same order as they were registered. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Unclear how is this part works with the later wording "The SDK MUST inject the Who is invoking the MeasurementProcessors in the order? Is that MeterProvider/SDK ? Or is it the responsibility of each There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I have changed the wording around the That being said, every processor is able to decide whether it wants to invoke a chain of processors that follow it (by calling |
||
|
||
SDK MUST allow users to implement and configure custom processors. | ||
|
@@ -1032,6 +1036,16 @@ For a `MeasurementProcessor` registered directly on SDK `MeterProvider`, the `me | |
|
||
A `MeasuremenetProcessor` may freely modify `measurement` for the duration of the `OnMeasure` call. | ||
Blinkuu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A `MeasurementProcessor` MUST invoke `OnMeasure` on the next registered processor. | ||
Blinkuu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Built-in processors | ||
|
||
The standard OpenTelemetry SDK MUST implement simple processor as described below. | ||
|
||
#### SimpleProcessor | ||
|
||
This is an implementation of `MeasurementProcessor` which calculates an in-memory state from incoming `Measurements`. | ||
reyang marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should the SDK ensure that this is the last processor in the chain? |
||
|
||
## Exemplar | ||
|
||
**Status**: [Stable](../document-status.md) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the context of tracing, a processor is somewhat of a different thing (it's not a filterer of data, it sits on top of exporters).
Should we name this differently than
Processor
to differenciate the two?Or should we make both behaviors similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
MeasurementProcessor
is more than a filter of data. It can modify the measurement, decide to drop it, or even emit it multiple times.To me, they are semantically similar. The difference is in the architecture of the Metrics SDK, which makes it hard to fit and connect the new processor pipeline directly with exporters. We could revisit this in the future and try to align the behavior between Logs, Traces, and Metrics SDKs. To keep an open door for such ideas, I'm purposefully specifying that:
Built-in measurement processors are responsible for Measurement Processing.
Where
Measurement Processing
is currently vaguely defined in this spec by using the wordSHOULD
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support @Blinkuu's reasoning above. In my thinking, we can use "processor" across OpenTelemetry when a component in a program receives and outputs the same type of data. Trace SDK processors input/output span data. Collector processors input/output pipeline data. Things that are not processors (e.g., Metric reader, Trace sampler, Exporters, Receivers) generally have different types of input and output.
Here, MeasurementProcessor is appropriate because the input and the output types are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1