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 Attributes to Instrumentation Scope #2450

Closed
tigrannajaryan opened this issue Mar 28, 2022 · 9 comments
Closed

Add Attributes to Instrumentation Scope #2450

tigrannajaryan opened this issue Mar 28, 2022 · 9 comments
Labels
help wanted Extra attention is needed spec:miscellaneous For issues that don't match any other spec label

Comments

@tigrannajaryan
Copy link
Member

The Instrumentation Scope currently is defined as a pair of (name,version).

This is a proposal to add ability to associate Attributes with the Scope. There are currently 2 known use cases:

  • Add support for Meter "short_name", represented as an attribute of Meter's Scope.
  • Add support for differentiating the type of data emitted from the scopes that belong to different data domains, e.g. profiling data emitted as log records or client-side data emitted as log records needs to be differentiated so that it can be easily routed and processed differently in the backends. We don't have a good way to handle this today. The type of the data can be recorded as an attribute Logger's Scope.

There are probably other use cases possible for the Scope attributes. Please comments on this issue if you have a use case.

cc @bogdandrutu @dashpole @jmacd

@tigrannajaryan tigrannajaryan added the spec:miscellaneous For issues that don't match any other spec label label Mar 28, 2022
@tigrannajaryan tigrannajaryan added the help wanted Extra attention is needed label Mar 28, 2022
@pmm-sumo
Copy link
Contributor

pmm-sumo commented Apr 6, 2022

One concern I have about adding such capability is increased complexity of the overall model.

It might bring confusion on when to associate the attribute with Resource, Scope or Record. We have seen similar issue for log data model (where attributes can be stored within body or as LogRecord attributes) and we ended up with clarifying that body-level attributes are pretty much only needed for compatibility reasons.

On top of the above, adding such such capability will require bringing additional ways to modify/move/filter them and so on. I am concerned that it might be actually easier to instead deal with slight duplication at the record-level than have another layer of Attributes at the Scope level

@tigrannajaryan
Copy link
Member Author

The confusion between Body and Attributes of LogRecord was primarily because they both applied to the same LogRecord and you could easily record the same information in 2 different ways.

This is not the case for Resource, Scope or LogRecord attributes. They each are separately defined concepts, and the attributes field in each applies to that particular concept. I don't think there can be a similar confusion (this assumes Scope and LogRecord are clearly defined different concept, which I hope they are).

On top of the above, adding such such capability will require bringing additional ways to modify/move/filter them and so on. I am concerned that it might be actually easier to instead deal with slight duplication at the record-level than have another layer of Attributes at the Scope level

I think we already have to somehow deal with this, because the Scope already has a name and a version that you can modify/move/filter. We just mostly ignored it so far in the Collector.

@alanwest
Copy link
Member

differentiating the type of data emitted from the scopes that belong to different data domains, e.g. profiling data emitted as log records or client-side data emitted as log records needs to be differentiated so that it can be easily routed and processed differently in the backends. We don't have a good way to handle this today.

I'm curious about this use case. I was under the impression that the direction being explored for client-side telemetry was to define semantic conventions that would identify it as such. I can see there being a benefit to end users in that these "client-side telemetry" identifying attributes would not need to be duplicated on every log record.

But, from the standpoint of routing/processing client-side telemetry by a backend, does it really matter if these attributes are on the scope or the log record themselves?

@tigrannajaryan
Copy link
Member Author

tigrannajaryan commented Apr 14, 2022

But, from the standpoint of routing/processing client-side telemetry by a backend, does it really matter if these attributes are on the scope or the log record themselves?

I think it matters from efficiency perspective. The Scope in OTLP can contain a batch of LogRecords and the processing decision about the entire batch in the Collector can be made by looking at just one scope attribute instead of looking at all LogRecords in the batch and making decisions about each LogRecord individually.

@tsloughter
Copy link
Member

This would be the only way to associate some attributes with all spans created by a Tracer, right? Or is there another way already? I think it would be useful for this purpose if it isn't possible another way -- aside from a custom span processor that accesses some global store that maps tracer to attributes that it can lookup and add to each span.

@tigrannajaryan
Copy link
Member Author

This would be the only way to associate some attributes with all spans created by a Tracer, right? Or is there another way already?

I am not aware of a way to do it today.

@tsloughter
Copy link
Member

Then a big +1 from me.

tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why Scope attributes are a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with other primary data types: Resource, Span, Metric, LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why Scope attributes are a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with other primary data types: Resource, Span, Metric, LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why Scope attributes are a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with other primary data types: Resource, Span, Metric, LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why Scope attributes are a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with other primary data types: Resource, Span, Metric, LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes are a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
tigrannajaryan added a commit to tigrannajaryan/rfcs that referenced this issue Apr 25, 2022
There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
@tigrannajaryan
Copy link
Member Author

OTEP submitted: open-telemetry/oteps#201

carlosalberto pushed a commit to open-telemetry/oteps that referenced this issue May 24, 2022
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
@tigrannajaryan
Copy link
Member Author

Resolved by #2579

carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this issue Oct 21, 2024
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry#2450).
carlosalberto pushed a commit to carlosalberto/oteps that referenced this issue Oct 23, 2024
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
carlosalberto pushed a commit to carlosalberto/oteps that referenced this issue Oct 23, 2024
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
carlosalberto pushed a commit to carlosalberto/oteps that referenced this issue Oct 30, 2024
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](open-telemetry/opentelemetry-specification#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](open-telemetry/opentelemetry-specification#2450).
carlosalberto pushed a commit that referenced this issue Nov 8, 2024
* Introduce Scope Attributes

There are a few reasons why adding Scope attributes is a good idea:
- There are 2 known use cases where Scope attributes can solve specific problems:
  - Add support for [Meter "short_name"](#2422),
    represented as an attribute of Meter's Scope.
  - Add support for differentiating the type of data emitted from the scopes that belong
    to different data domains, e.g. profiling data emitted as log records or client-side
    data emitted as log records needs to be differentiated so that it can be easily
    routed and processed differently in the backends. We don't have a good way to handle
    this today. The type of the data can be recorded as an attribute Logger's Scope.
- It makes Scope consistent with the other primary data types: Resource, Span, Metric,
  LogRecord.

See additional [discussion here](#2450).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed spec:miscellaneous For issues that don't match any other spec label
Projects
None yet
Development

No branches or pull requests

5 participants