-
Notifications
You must be signed in to change notification settings - Fork 183
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
Move attribute definition from spec #636
Closed
joaopgrassi
wants to merge
57
commits into
open-telemetry:main
from
dynatrace-oss-contrib:move-attribute-definition-from-spec
+158
−0
Closed
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
d541ee7
Centralize attributes definition (#722)
bogdandrutu a2fe1a3
DocFX sanity check (#742)
reyang 3f8bc51
Consistency between Span and Resource attributes (#777)
thisthat 79d4166
Add conventions for attribute names (#807)
tigrannajaryan 00959df
Extend attribute naming rules to metric labels (#821)
tigrannajaryan 56f7730
Fix lint check in makefile, fix errors (#837)
bogdandrutu 596379f
Require that names and namespaces are one global space across all sem…
tigrannajaryan f52034c
Define `null` as an invalid value for attributes and declare attempts…
arminru 89262a0
Fix absolute links to spec (#1192)
Oberon00 b8ab101
Remove ordering reqirement for attributes. (#1212)
Oberon00 ccef73a
Include attribute name pluralization guidelines (#1115) (#1140)
pmm-sumo e99bc0b
Add guidance on when to use and not use nested namespaces (#1197)
tigrannajaryan 640a5c5
Nulls SHOULD NOT be allowed in arrays. (#1214)
Oberon00 49b70ba
Declare freeze of Trace API Specification 1.0 (#1121)
tigrannajaryan f3aaff6
Add lifecycle statuses to all documents (#1385)
tedsuo 8d474bf
Clarify usage of "otel." attribute namespace (#1640)
tigrannajaryan c74933e
Rename Metrics labels to attributes (#1775)
jtmalinowski 93c8323
Add an option to limit length of values of attributes and metric valu…
jtmalinowski 7ff2672
Prefer global limit over model-specific default (#1893)
owais 64387bc
Exempt resources from attribute limits (#1892)
owais a66bd4d
Provide a normative definition of Attribute (singular) rather than At…
chalin 02c9500
[editorial] Ensure all ToCs are generated using markdown-toc (#2146)
chalin 3321b3e
Prohibit usage of retired names in semantic conventions (#2191)
tigrannajaryan aeab663
Clarify that attribute keys are unique in collections (#2248)
tigrannajaryan 96108c0
Clarify that Trace/Meter are associated with Instrumentation Scope (#…
tigrannajaryan 6ea7155
Describe how to convert non-string primitives for protocols which onl…
dashpole d7400c8
Fix links (#2426)
reyang 91bf1f1
Implement OTEP 0178: Mapping external data to AnyValue (#2385)
tigrannajaryan a2feb34
[editorial] Ensure common section has a README (#2479)
chalin 5bcfad4
Define attribute requirement levels (#2522)
lmolkova 1174ab5
[editorial] Add missing READMEs to section (#2559)
chalin 5902a67
Move non-otlp.md to common directory (#2587)
tigrannajaryan eaa6744
Introduce Instrumentation Scope Attributes (#2579)
tigrannajaryan 22d04d6
Use consistent file name for data-model.md (#2586)
tigrannajaryan 00e0849
[editorial] Add note to Hugo front matter (#2651)
chalin e7134eb
Define net.sock attributes and clarify logical net.peer|host.name att…
lmolkova 95338c6
Align log sdk naming with api (#2768)
jack-berg a82836b
Define semantic conventions yaml for non-otlp conventions (#2850)
bogdandrutu e7e679d
Add log attribute limit configuration (#2861)
alanwest cfcd551
Mark Attribute naming conventions as stable. (#3220)
jsuereth 229c66c
Rename Optional attribute requirement level to Opt-In (#3228)
trask 33069b0
Proofread of attribute requirement levels in preparation for stabilit…
trask 0089575
Attribute requirement level follow-up edits (#3293)
trask c9c56e0
Clarify that attribute requirement levels apply to instrumentation li…
trask 9cf537a
Mark attribute requirement levels as stable (#3368)
trask 32292d9
[editorial] Use path, not external URL, for link into glossary (#3375)
chalin c5237e8
BREAKING: Replace `net.peer.*`/`net.host.*` with `client.*`/`server.*…
lmolkova cf7de34
BREAKING: Rename remaining network attributes from `net.*` to `networ…
trask a99da5e
BREAKING: Introduce common `url.*` attributes, and improve use of nam…
lmolkova c98792c
Explain why custom attributes are not recommended to be placed in Ote…
tigrannajaryan e40b6d5
[editorial] Hugo front-matter fixes for aliases and linkTitle (#3592)
chalin d028b06
Remove local stubs of semantic conventions. (#3711)
jsuereth 093bd1f
Add a new AddLink() operation to Span. (#3678)
carlosalberto 33d1c2f
Rename/replace `(client|server).socket.(address|port)` attributes wit…
trask dc5e136
Move attribute documents to semantic-conventions repository (#3758)
jack-berg 1d52d31
Merge remote-tracking branch 'remotes/spec/main' into move-attribute-…
joaopgrassi 5ab265d
Remove unwanted files and update links to spec repo
joaopgrassi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<!--- Hugo front matter used to generate the website version of this page: | ||
---> | ||
|
||
# Attribute definition | ||
|
||
**Status**: [Stable, Feature-freeze][DocumentStatus] | ||
|
||
<details> | ||
<summary>Table of Contents</summary> | ||
|
||
<!-- toc --> | ||
|
||
- [Attribute](#attribute) | ||
* [Attribute Limits](#attribute-limits) | ||
+ [Configurable Parameters](#configurable-parameters) | ||
+ [Exempt Entities](#exempt-entities) | ||
- [Attribute Collections](#attribute-collections) | ||
|
||
<!-- tocstop --> | ||
|
||
</details> | ||
|
||
## Attribute | ||
|
||
<a id="attributes"></a> | ||
|
||
An `Attribute` is a key-value pair, which MUST have the following properties: | ||
|
||
- The attribute key MUST be a non-`null` and non-empty string. | ||
- Case sensitivity of keys is preserved. Keys that differ in casing are treated as distinct keys. | ||
- The attribute value is either: | ||
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer. | ||
- An array of primitive type values. The array MUST be homogeneous, | ||
i.e., it MUST NOT contain values of different types. | ||
|
||
For protocols that do not natively support non-string values, non-string values SHOULD be represented as JSON-encoded strings. For example, the expression `int64(100)` will be encoded as `100`, `float64(1.5)` will be encoded as `1.5`, and an empty array of any type will be encoded as `[]`. | ||
|
||
Attribute values expressing a numerical value of zero, an empty string, or an | ||
empty array are considered meaningful and MUST be stored and passed on to | ||
processors / exporters. | ||
|
||
Attribute values of `null` are not valid and attempting to set a `null` value is | ||
undefined behavior. | ||
|
||
`null` values SHOULD NOT be allowed in arrays. However, if it is impossible to | ||
make sure that no `null` values are accepted | ||
(e.g. in languages that do not have appropriate compile-time type checking), | ||
`null` values within arrays MUST be preserved as-is (i.e., passed on to span | ||
processors / exporters as `null`). If exporters do not support exporting `null` | ||
values, they MAY replace those values by 0, `false`, or empty strings. | ||
This is required for map/dictionary structures represented as two arrays with | ||
indices that are kept in sync (e.g., two attributes `header_keys` and `header_values`, | ||
both containing an array of strings to represent a mapping | ||
`header_keys[i] -> header_values[i]`). | ||
|
||
See [Attribute Naming](attribute-naming.md) for naming guidelines. | ||
|
||
See [Requirement Level](attribute-requirement-level.md) for requirement levels guidelines. | ||
|
||
See | ||
[Mapping Arbitrary Data to OTLP AnyValue](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/attribute-type-mapping.md) | ||
to find out how to map values obtained | ||
outside OpenTelemetry into OpenTelemetry attribute values. | ||
|
||
### Attribute Limits | ||
|
||
Execution of erroneous code can result in unintended attributes. If there are no | ||
limits placed on attributes, they can quickly exhaust available memory, resulting | ||
in crashes that are difficult to recover from safely. | ||
|
||
By default an SDK SHOULD apply truncation as per the list of | ||
[configurable parameters](#configurable-parameters) below. | ||
|
||
If an SDK provides a way to: | ||
|
||
- set an attribute value length limit such that for each | ||
attribute value: | ||
- if it is a string, if it exceeds that limit (counting any character in it as | ||
1), SDKs MUST truncate that value, so that its length is at most equal | ||
to the limit, | ||
- if it is an array of strings, then apply the above rule to each of the | ||
values separately, | ||
- otherwise a value MUST NOT be truncated; | ||
- set a limit of unique attribute keys such that: | ||
- for each unique attribute key, addition of which would result in exceeding | ||
the limit, SDK MUST discard that key/value pair. | ||
|
||
There MAY be a log emitted to indicate to the user that an attribute was | ||
truncated or discarded. To prevent excessive logging, the log MUST NOT be | ||
emitted more than once per record on which an attribute is set. | ||
|
||
If the SDK implements the limits above, it MUST provide a way to change these | ||
limits programmatically. Names of the configuration options SHOULD be the same as | ||
in the list below. | ||
|
||
An SDK MAY implement model-specific limits, for example | ||
`SpanAttributeCountLimit` or `LogRecordAttributeCountLimit`. If both a general | ||
and a model-specific limit are implemented, then the SDK MUST first attempt to | ||
use the model-specific limit, if it isn't set, then the SDK MUST attempt to use | ||
the general limit. If neither are defined, then the SDK MUST try to use the | ||
model-specific limit default value, followed by the global limit default value. | ||
|
||
#### Configurable Parameters | ||
|
||
* `AttributeCountLimit` (Default=128) - Maximum allowed attribute count per record; | ||
* `AttributeValueLengthLimit` (Default=Infinity) - Maximum allowed attribute value length; | ||
|
||
#### Exempt Entities | ||
|
||
Resource attributes SHOULD be exempt from the limits described above as resources | ||
are not susceptible to the scenarios (auto-instrumentation) that result in | ||
excessive attributes count or size. Resources are also sent only once per batch | ||
instead of per span so it is relatively cheaper to have more/larger attributes | ||
on them. Resources are also immutable by design and they are generally passed | ||
down to TracerProvider along with limits. This makes it awkward to implement | ||
attribute limits for Resources. | ||
|
||
Attributes, which belong to Metrics, are exempt from the limits described above | ||
at this time, as discussed in | ||
[Metrics Attribute Limits](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#attribute-limits). | ||
|
||
## Attribute Collections | ||
|
||
[Resources](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md), Metrics | ||
[data points](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#metric-points), | ||
[Spans](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-attributes), Span | ||
[Events](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#add-events), Span | ||
[Links](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#link) and | ||
[Log Records](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md) may contain a collection of attributes. The | ||
keys in each such collection are unique, i.e. there MUST NOT exist more than one | ||
key-value pair with the same key. The enforcement of uniqueness may be performed | ||
in a variety of ways as it best fits the limitations of the particular | ||
implementation. | ||
|
||
Normally for the telemetry generated using OpenTelemetry SDKs the attribute | ||
key-value pairs are set via an API that either accepts a single key-value pair | ||
or a collection of key-value pairs. Setting an attribute with the same key as an | ||
existing attribute SHOULD overwrite the existing attribute's value. See for | ||
example Span's | ||
[SetAttribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-attributes) | ||
API. | ||
|
||
A typical implementation of | ||
[SetAttribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-attributes) | ||
API will enforce the uniqueness by overwriting any existing attribute values pending | ||
to be exported, so that when the Span is eventually exported the exporters see | ||
only unique attributes. The OTLP format in particular requires that exported | ||
Resources, Spans, Metric data points and Log Records contain only unique | ||
attributes. | ||
|
||
Some other implementations may use a streaming approach where every | ||
[SetAttribute](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-attributes) | ||
API call immediately results in that individual attribute value being exported | ||
using a streaming wire protocol. In such cases the enforcement of uniqueness | ||
will likely be the responsibility of the recipient of this data. | ||
|
||
[DocumentStatus]: | ||
https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/document-status.md |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't think this document belongs into the semantic conventions repository, as it mostly contains requirements that need to be implemented by SDKs.