-
Notifications
You must be signed in to change notification settings - Fork 935
OTEP: Allow multiple Resources in an SDK #4665
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
af08c2e
e89d849
55921a8
e6f8df0
ebea8e8
d2fbffb
85d8c92
ce3056b
2fadb5c
a67c14b
2a60981
fec2972
86a710a
0f3fd88
04ca4c5
6a0c6e1
bc30cfe
573c68f
8cdc98d
62f6385
aa7d98b
d19c3d4
a728f69
680f7db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Scope and Entities | ||
|
|
||
| Define the relationship between `InstrumentationScope` and `Entity`. | ||
|
|
||
| ## Motivation | ||
|
|
||
| OpenTelemetry needs to address two fundamental problems: | ||
|
|
||
| - Reporting data against "mutable" or "changing" entities, where `Resource` | ||
| is currently defined as an "immutable" identity in the data model. | ||
| - Providing true multi-tenant capabilities, where, e.g. metrics about one tenant | ||
|
||
| will be implicitly separated from metrics about another tenant. | ||
|
|
||
| The first problem is well outlined in (not accepted) [OTEP 4316](https://github.com/open-telemetry/opentelemetry-specification/pull/4316). | ||
| Fundamentally, while we need an immutable identity, the reality is that `Resource` | ||
| in today's OpenTelemetry usage is not strong enough to support key use cases. For example, | ||
| OpenTelemetry JS, in the node.js environment, cannot guarantee that all identifying | ||
| attributes for Resource are discovered prior to SDK startup, leading to an "eventual identity" situation | ||
| that must be addressed in the Specification. Additionally, our Client/Browser SIG has been | ||
| trying to model the notion of "User Session" which has a much shorter lifespan than the SDK itself, so | ||
| requiring a single identity that is both immutable and matches the SDK lifetime prevents any good mechanism of reporting user session. | ||
|
|
||
| However, [OTEP 4316](https://github.com/open-telemetry/opentelemetry-specification/pull/4316) explores | ||
| relaxing the immutability restriction vs. providing a new mechanism. During prototyping, | ||
| initially this seemed to be easily accomplished, but ran into major complications both in interactions | ||
| with OpAmp (where a stable idenitity for the SDK is desired), and in desinging a Metrics SDK, where | ||
| changes in Resource mean a dynamic and divergent storage strategy, without a priori knowledge of whether these resource mutations are | ||
| relevant to the metric or not. | ||
|
|
||
| Additionally, today when reporting data from one "process" about mulitple resources, the only recourse available is to instantiate | ||
| multiple SDKs and define different resources in each SDK. This absolute separation can be highly problematic with the notion of | ||
| "built-in" instrumentation, where libraries (e.g. gRPC) come with an out-of-the-box OpenTelemetry support and it's unclear how | ||
| to ensure this instrumentation is use correctly in the presence of multiple SDKs. | ||
|
|
||
| ## Explanation | ||
|
|
||
| We proposes these new fundamental concepts in OpenTelemetry: | ||
|
|
||
| - `Resource` *remains immutable* | ||
| - Building on [OTEP 264`](0264-resource-and-entities.md), identifying attirbutes | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| are clearly outlined in Resource going forward, addressing unclear real world usage of Resource attributes ([e,g, identifying attributes in OpAMP](https://github.com/open-telemetry/opamp-spec/blob/main/specification.md#agentdescriptionidentifying_attributes)). | ||
| - SDK will be given an explicit initialization stage where `Resource` is not in a complete state, addressing OpenTelemetry JS concerns around async resource detection. | ||
|
||
| - `InstrumentationScope` is enhanced with `Entity` similar to `Resource`. | ||
|
||
| - When using `Get a Meter` or `Get a Tracer` operations in OpenTelemetry, we can already optionally specific a set of `Attributes`. Now | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| we can specify a full `Entity`. | ||
| - When an `Entity` X exists on `InstrumentationScope`, this now means "observing X in the context of the current `Resource`". For example, | ||
| on a Mobile device. An immutable `Resource` that idnetifies the device would be constructed. "Session" now becomes an Entity | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| attached to the `InstrumentationScope`, meaning events, spans and metrics generated are against the "sesion in the context of the device". | ||
|
|
||
| ## Internal details | ||
|
|
||
| TODO | ||
|
|
||
| ## Trade-offs and mitigations | ||
|
|
||
| TODO | ||
|
|
||
| ## Prior art and alternatives | ||
|
|
||
| OpenCensus previously allowed contextual tags to be specified dynamically and used everywhere metric | ||
| measurements were reported. Users were then required to select which of these were useful to them via | ||
| the definition of "Views". OpenTelemetry has aimed for a simpler solution where every | ||
| metric has an implicit View definition, and we leverage metric advice to allow sending attributes | ||
| than is naturally used when reporting the metric. | ||
|
|
||
| As called out in the description, [OTEP 4316](https://github.com/open-telemetry/opentelemetry-specification/pull/4316) | ||
| proposes making resource fully mutable, which comes with its won set of tradeoffs. | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Open questions | ||
|
|
||
| Allowing a multi-tenant agency in the OpenTelemetry SDK has a set of known issues we must resolve. | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### How do we Garbage collecting "stale" scopes | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| As seen in [Issue #3062](https://github.com/open-telemetry/opentelemetry-specification/issues/3062), | ||
| systems observing multiple tenants need to ensure that tenant which are only observed briefly do not | ||
jsuereth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| continue to consume resources (particularly memory) for long periods of time. There needs to be | ||
| some level of control (either direct or implicit) in allowing new "Scope with Entity" to be created. | ||
|
|
||
| ## Prototypes | ||
|
|
||
| **In Progress** | ||
|
|
||
| ## Future possibilities | ||
|
||
|
|
||
| This proposal brings strong multi-tenant capabilities to the OpenTelemetry SDK. One possibility | ||
| is to improve the interaction between dynamic `Context` and `IntrumentationScope`, e.g. allowing | ||
| some level of interaction between `InstrumentationScope`'s entity set and `Context`. | ||
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 am confused by the usage of word "tenant" here. Do you refer to instrumentation libraries as tenants here?
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.
No, a tenant would be something beyond that.
E.g. let's look at older Java Application Servers. One AppServer may have multiple Applications.
The instrumentation library may be for "jboss" or "tomcat" or whatever the app server is. The tenant would be the application itself. I'd instantiate one scope for each tenant vs. one for the entire app server in this world.