|
10 | 10 | - [Attribute](#attribute) |
11 | 11 | * [Attribute Limits](#attribute-limits) |
12 | 12 | + [Exempt Entities](#exempt-entities) |
| 13 | +- [Attribute Collections](#attribute-collections) |
13 | 14 |
|
14 | 15 | <!-- tocstop --> |
15 | 16 |
|
@@ -105,3 +106,35 @@ attribute limits for Resources. |
105 | 106 | Attributes, which belong to Metrics, are exempt from the limits described above |
106 | 107 | at this time, as discussed in |
107 | 108 | [Metrics Attribute Limits](../metrics/sdk.md#attribute-limits). |
| 109 | + |
| 110 | +## Attribute Collections |
| 111 | + |
| 112 | +[Resources](../resource/sdk.md), Metrics |
| 113 | +[data points](../metrics/datamodel.md#metric-points), |
| 114 | +[Spans](../trace/api.md#set-attributes), Span |
| 115 | +[Events](../trace/api.md#add-events), Span |
| 116 | +[Links](../trace/api.md#specifying-links) and |
| 117 | +[Log Records](../logs/data-model.md) may contain a collection of attributes. The |
| 118 | +keys in each such collection are unique, i.e. there MUST NOT exist more than one |
| 119 | +key-value pair with the same key. The enforcement of uniqueness may be performed |
| 120 | +in a variety of ways as it best fits the limitations of the particular |
| 121 | +implementation. |
| 122 | + |
| 123 | +Normally for the telemetry generated using OpenTelemetry SDKs the attribute |
| 124 | +key-value pairs are set via an API that either accepts a single key-value pair |
| 125 | +or a collection of key-value pairs. Setting an attribute with the same key as an |
| 126 | +existing attribute SHOULD overwrite the existing attribute's value. See for |
| 127 | +example Span's [SetAttribute](../trace/api.md#set-attributes) API. |
| 128 | + |
| 129 | +A typical implementation of [SetAttribute](../trace/api.md#set-attributes) API |
| 130 | +will enforce the uniqueness by overwriting any existing attribute values pending |
| 131 | +to be exported, so that when the Span is eventually exported the exporters see |
| 132 | +only unique attributes. The OTLP format in particular requires that exported |
| 133 | +Resources, Spans, Metric data points and Log Records contain only unique |
| 134 | +attributes. |
| 135 | + |
| 136 | +Some other implementations may use a streaming approach where every |
| 137 | +[SetAttribute](../trace/api.md#set-attributes) API call immediately results in |
| 138 | +that individual attribute value being exported using a streaming wire protocol. |
| 139 | +In such cases the enforcement of uniqueness will likely be the responsibility of |
| 140 | +the recipient of this data. |
0 commit comments