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

Metrics SDK spec skeleton #1673

Merged
merged 13 commits into from
May 20, 2021

Conversation

reyang
Copy link
Member

@reyang reyang commented May 6, 2021

Changes

Added the metrics SDK specification skeleton

Related issues #1116

Related oteps OTEP146

@reyang reyang requested review from a team May 6, 2021 17:18

## MeasurementProcessor

`MeasurementProcessor` is an interface which allows hooks when a Measurement is
Copy link
Member

Choose a reason for hiding this comment

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

Are Aggregators expected to be implemented as MeasurementProcessor?

Copy link
Member Author

Choose a reason for hiding this comment

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

At this stage we can implement aggregators as SDK internal components that can be used in a MeasurementProcessor, and we have better understanding, we can decide if we want to expose Aggregator as an interface.

+------------------+
| MeterProvider | +----------------------+
| Meter A | Measurements... | | Metrics... +-----------------+
| Instrument X |-----------------> MeasurementProcessor +------------> |
Copy link
Member Author

Choose a reason for hiding this comment

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

@jkwatson mentioned during the SIG meeting that we need a way to make composite processors.

Copy link

Choose a reason for hiding this comment

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

Related to this

There are a few different aspects of concern for me as it relates to both the MetricProcessors and Measurement Processors.

I have a few questions:
Would we want to allow for "parallel processes" on a singular stream? Or more clearly maybe is there a possibility that a split may occur where two separate processors operate on a measurement/metric to then join back later to be combined.
Are separate measurements coming in allowed to be joined into a single metric?

Copy link
Member Author

Choose a reason for hiding this comment

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

Inside the SDK, the data will not join back.

It is possible that the data get forked and sent via multiple exporters (e.g. one exporter push at every 1 second, another export push every 1 minute), and the exporters send data to the same collector/backend. In this case the data might join back and cause problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

@hdost The data model specifies what "overlapping streams" look like. You could consider the parallel streams of your example intentionally overlapping points.

We may want to explain that the kind of parallel data you are describing should be renamed as a new metric name. I do not want to have to specify anything about parallel streams of data that are aggregated differently but carry duplicate meaning, for example.

@reyang reyang added area:sdk Related to the SDK spec:metrics Related to the specification/metrics directory labels May 6, 2021
@reyang reyang force-pushed the reyang/metrics-sdk branch from 8f67dfa to 52c570c Compare May 6, 2021 22:26
+------------------+
```

## MetricProcessor
Copy link
Contributor

Choose a reason for hiding this comment

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

@reyang

Your current pipeline is...

[API/SDK] -> measurement -> [1. MeasurementProcessor] -> [2. MetricProcessor <-> [**In-Memory-State**]] -> metric -> [3. MetricExporter]

Maybe we can fully expand to...

[API/SDK] -> measurement -> [1. MeasurementProcessor]* -> measurement -> [2. MetricProcessor <-> [**In-Memory-State**]] -> [MetricCollector] -> metric -> [MetricEnricher] -> metric -> [3. MetricExporter]

MeasurementProcessor: Allows adjustment to attributes. Can be chained/composed.

MetricCollector: Collect aggregated metrics from In-Memory-State. This is likely build-in/internal to SDK.

MetricEnricher: Allows custom adjustment to metrics. Can be chained/composed.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is something I intended to avoid 😃

I think the goal is to start from a small set of essential (ideally must-have) LEGO pieces, and depending on what we've learned while building the SDKs we can decide to introduce more if there is a strong reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on avoiding this kind of strictness until there's a strong reason (thinking about mistakes I've made) 🤣

Push Metric Exporter sends the data on its own schedule. Here are some examples:

* Sends the data based on a user configured schedule, e.g. every 1 minute.
* Sends the data when there is a severe error.
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that this is declared as a use case.

specification/metrics/sdk.md Show resolved Hide resolved
specification/metrics/sdk.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

Thanks! Looks like a good start!

protocol-dependent telemetry exporters. The protocol exporter is expected to be
primarily a simple telemetry data encoder and transmitter.

Metric Exporter has access to the [pre-aggregated metrics
Copy link
Contributor

@victlu victlu May 14, 2021

Choose a reason for hiding this comment

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

Can you clarify a bit on how Metric Exporter gain access to pre-aggregated metrics? Is it that it has access to the "in-memory state" or is it passed those via the MetricProcessor?

What is the "input" to MetricExporter? Is it metrics (pre/post aggregation?) or is it some batch / "exportable representation" format?

It may be helpful to label the arrows (like you did for input to in-memory state) between In-memory state, MetricProcessor, and MetricExporter.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the diagram to clarify that exporters don't have direct access to the "in-memory-state", and it receives (whether pulls from, or being pushed) pre-aggregated metrics from the processor.

Copy link
Member Author

Choose a reason for hiding this comment

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

The "input" should be a batch of "exportable representation", similar to the tracing SDK spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#exportbatch. These are the meats that we'll need to add in subsequent PRs.

@arminru
Copy link
Member

arminru commented May 19, 2021

@reyang Changelog please :-)

@reyang reyang force-pushed the reyang/metrics-sdk branch from 06d7869 to 6be59bd Compare May 19, 2021 16:54
@reyang
Copy link
Member Author

reyang commented May 19, 2021

@arminru I've been struggling if I should add changelog right now or later (e.g. when we remove the banner "language clients should not start the implementation unless we explicitly communicated").

If we put the changelog now, it might be too noisy? (I'm thinking that we have one changelog entry at late May saying "Added the experimental version of Metrics SDK Spec (a long list of PRs...)")

Please let me know your suggestion.

@SergeyKanzhelev SergeyKanzhelev self-assigned this May 20, 2021
@SergeyKanzhelev
Copy link
Member

Looks like the PR is OK to merge - enough approvals, cool off period completed, and comments were addressed.

@SergeyKanzhelev SergeyKanzhelev merged commit f0fe061 into open-telemetry:main May 20, 2021
@reyang reyang deleted the reyang/metrics-sdk branch October 4, 2021 17:33
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* skeleton of metrics SDK spec

* add more design questions

* finish the skeleton

* fix CI

* add more links and clarification

* nits

* improve the wording for contex/baggage/trace interaction with metrics

* fix typo

* update the diagram to show logical in-memory state

* update the diagram

* update the wording

* update the wording

Co-authored-by: Sergey Kanzhelev <S.Kanzhelev@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:sdk Related to the SDK spec:metrics Related to the specification/metrics directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants