Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update the wording
  • Loading branch information
Blinkuu committed Jan 7, 2025
commit 90d331d4c546b8420a109136d09bc5f4b739b6fd
4 changes: 2 additions & 2 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,9 @@ The following diagram shows `MeasurementProcessor`'s relationship to other compo

For a `MeasurementProcessor` registered directly on SDK `MeterProvider`, the `measurement` mutations MUST be visible in next registered processors.

A `MeasuremenetProcessor` may freely modify `measurement` for the duration of the `OnMeasure` call.
A `MeasuremenetProcessor` MAY freely modify `measurement` for the duration of the `OnMeasure` call.

A `MeasurementProcessor` MUST invoke `OnMeasure` on the next registered processor.
A `MeasurementProcessor` SHOULD invoke `OnMeasure` on the next registered processor. A `MeasurementProcessor` MAY decide to drop the `Measurement` by not invoking the next processor.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would a MeasurementProcessor do that? For example, if it needs to invoke OnMeasure (which requires "next"), how would it figure out all the arguments?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible by making the SDK "bind" arguments such that calling next does not require a reference to the processor itself, e.g., https://go.dev/play/p/wPZRm5xk3nO.

This makes the API easy to implement and doesn't require users to store any state inside the processor (although they still can if they want).


### Built-in processors

Expand Down