-
Notifications
You must be signed in to change notification settings - Fork 991
Recommend JSON object encoding of an attribute for non-OTLP #5028
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
Changes from 12 commits
f7d265d
cafff95
b7156b2
864d0d7
33a3220
dc96379
6406205
dea3de4
dccd5bb
c04789f
bc48da2
6eb91fa
c3305ba
1f3c2e1
e42169b
a29f6e1
43982ab
3d1ad40
f1c82d5
c319aac
48db8d3
dd5f562
31f06f9
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 |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ path_base_for_github_subdir: | |
| + [Arrays](#arrays) | ||
| + [Maps](#maps) | ||
| - [Attribute](#attribute) | ||
| * [Attribute representation for non-OTLP](#attribute-representation-for-non-otlp) | ||
| * [Attribute Collections](#attribute-collections) | ||
| - [Attribute Limits](#attribute-limits) | ||
| * [Configurable Parameters](#configurable-parameters) | ||
|
|
@@ -195,6 +196,34 @@ See [Requirement Level](https://github.com/open-telemetry/semantic-conventions/b | |
| See [this document](attribute-type-mapping.md) to find out how to map values obtained | ||
| outside OpenTelemetry into OpenTelemetry attribute values. | ||
|
|
||
| ### Attribute representation for non-OTLP | ||
|
|
||
| **Status**: [Development](../document-status.md) | ||
|
|
||
| For non-OTLP protocols or other debugging-oriented contexts that need to | ||
|
pellared marked this conversation as resolved.
Outdated
|
||
| represent a single `Attribute` as a string, the RECOMMENDED form is a | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me this seems duplicative of the "#### Maps" section on line 168. It already describes how to encode using what I believe is the same output. An attribute set is analogous to a map. A single attribute is analogous to a single entry map. Rather than repeating that section, could we make the (obvious) analogy between attributes and maps, and link over to the existing maps section for how it should be represented?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Indeed. And this is what this section is specifying.
I am not repeating the whole section. Note that this PR is already linking to the maps section. Also note that e.g. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#maps does not tell anything about the attribute name/value. I did my best to refer to the existing specification while also adding the missing parts. This is why this PR has e.g.
Other reviewers also asked to have more examples and have this section to be more clear (even it if is more verbose).
It is not specified anywhere. It a subject for a separate PR as we would need it for open-telemetry/opentelemetry-go#8209. I do not want to open large PRs and I plan to create it once this PR lands.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough - I approve. |
||
| [JSON object](https://datatracker.ietf.org/doc/html/rfc8259#section-4) | ||
| containing a single name/value pair (member). | ||
|
|
||
| The attribute key SHOULD be represented as a JSON object member | ||
| name. | ||
|
|
||
| The attribute value SHOULD be represented as a JSON object member value and | ||
| follow the encoding rules defined in | ||
| [AnyValue representation for non-OTLP protocols](#anyvalue-representation-for-non-otlp-protocols), | ||
| as it would be represented as an element in an [array](#arrays) and a value in | ||
| a [map](#maps). | ||
|
|
||
| Examples: `{"http.request.method": "GET"}`, `{"retries": 3}`, | ||
| `{"payload": "aGVsbG8gd29ybGQ="}`, `{"session.id": null}`, | ||
| `{"colors": ["red", "blue"]}`, `{"context": {"nested": true}}` | ||
|
|
||
| > [!NOTE] | ||
| > This string representation is lossy. Type information is lost as all | ||
|
pellared marked this conversation as resolved.
|
||
| > values are converted to strings, and precision loss may occur for numeric values | ||
| > (particularly for floating point numbers and large integers that exceed the | ||
| > precision capabilities of the receiving system's string-to-number conversion). | ||
|
pellared marked this conversation as resolved.
|
||
|
|
||
| ### Attribute Collections | ||
|
|
||
| [Resources](../resource/sdk.md), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.