Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit ad4d0c8

Browse files
authored
Start adding Tag Context specification. (#27)
This commit includes the Tag Context restrictions and format-independent serialization guidelines from issue #12.
1 parent 6e5a773 commit ad4d0c8

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

tags/TagContext.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Tag Context API
2+
3+
TODO(sebright): Add more detail to the Tag Context summary, including how it
4+
relates to the current context.
5+
6+
`TagContext` is an abstract data type that represents a collection of tags. A
7+
`TagContext` can be used to label anything that is associated with a specific
8+
operation, such as an HTTP request. Each tag is composed of a key (`TagKey`),
9+
and a value (`TagValue`). A `TagContext` represents a map from keys to values,
10+
i.e., each key is associated with exactly one value, but multiple keys can be
11+
associated with the same value. `TagContext` is serializable, and it represents
12+
all of the information that must be propagated across process boundaries.
13+
14+
## TagKey
15+
16+
A string or string wrapper, with some restrictions:
17+
18+
- Must contain only printable ASCII (codes between 32 and 126, inclusive).
19+
- Must have length greater than zero and less than 256.
20+
21+
## TagValue
22+
23+
A string or string wrapper with the same restrictions as `TagKey`, except that it
24+
is allowed to be empty.
25+
26+
## Serialization
27+
28+
This section applies to all serialization formats. See
29+
https://github.com/census-instrumentation/opencensus-specs/tree/master/encodings
30+
for specific formats.
31+
32+
- The serialization format must preserve the `TagKey`-`TagValue` mapping.
33+
- A `TagContext` can only be serialized or deserialized if the combined size of
34+
its keys and values is at most 8192 characters (8192 bytes). The size
35+
restriction applies to the deserialized tags so that the set of serializable
36+
`TagContext`s is independent of the serialization format.
37+
38+
### Error handling
39+
40+
- There are no partial failures. The result of serialization or deserialization
41+
should always be a complete `TagContext` or an error.
42+
- Serialization should result in an error if the `TagContext` does not meet the
43+
size restriction above.
44+
- Deserialization should result in an error if the serialized `TagContext`
45+
- cannot be parsed.
46+
- contains a `TagKey` or `TagValue` that does not meet the restrictions above.
47+
- does not meet the size restriction above.

0 commit comments

Comments
 (0)