Skip to content

Commit

Permalink
Allow array values for attributes (open-telemetry#368)
Browse files Browse the repository at this point in the history
Resolves open-telemetry#341

Array values are useful for representing attributes that can have
multiple values (e.g. representing a Memcached `get` that can be
over multiple keys and making the keys a span attribute).

This change allows homogeneous array values for span attributes
and specifies that array values should be JSON encoded stirng when
exporting using protocols that do not natively support array values.
  • Loading branch information
tigrannajaryan authored and Sergey Kanzhelev committed Feb 18, 2020
1 parent ba969b0 commit 76d7d96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions specification/api-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,10 @@ A `Span` MUST have the ability to set attributes associated with it.
An `Attribute` is defined by the following properties:

- (Required) The attribute key, which must be a string.
- (Required) The attribute value, which must be either a string, a boolean
value, or a numeric type.
- (Required) The attribute value, which is either:
- A primitive type: string, boolean or numeric.
- An array of primitive type values. The array MUST be homogeneous,
i.e. it MUST NOT contain values of different types.

The Span interface MUST provide:

Expand Down
5 changes: 5 additions & 0 deletions specification/data-semantic-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Span attributes.
* [Resource Conventions](data-resource-semantic-conventions.md)
* [Span Conventions](#span-conventions)

The type of the attribute SHOULD be specified in the semantic convention
for that attribute. Array values are allowed for attributes. For
protocols that do not natively support array values such values MUST be
represented as JSON strings.

## Span Conventions

In OpenTelemetry spans can be created freely and it’s up to the implementor to
Expand Down

0 comments on commit 76d7d96

Please sign in to comment.