|
| 1 | +#Exemplars |
| 2 | + |
| 3 | +Exemplars are example data points for aggregated data. In particular, for distribution-type |
| 4 | +metrics, exemplars are points associated with each bucket in the distribution giving an |
| 5 | +example of what was aggregated into the bucket. |
| 6 | + |
| 7 | +Exemplars consist of a value that was recorded, an exact timestamp of when that value |
| 8 | +was recorded, and a set of attachments. |
| 9 | + |
| 10 | +## Attachments |
| 11 | + |
| 12 | +Exemplars my have zero or more attachments. Attachments are key-value pairs that |
| 13 | +describe the context in which the exemplar was recored. |
| 14 | + |
| 15 | +Implementations should provide an extensible mechanism to extract custom attachments |
| 16 | +from the context. |
| 17 | + |
| 18 | +### Well-known attachment keys |
| 19 | + |
| 20 | +We define the following types of attachments: |
| 21 | + |
| 22 | +1. `trace_id`: lower-case base16 encoded trace ID |
| 23 | +2. `span_id`: lower-case base16 encoded span ID |
| 24 | +4. `tag:KEY`: tags that were active at the time of recording, regardless of whether |
| 25 | + they were ultimately added to views or not. `KEY` is the tag key, the value |
| 26 | + of the attachment is the tag value in effect. |
| 27 | + |
| 28 | +If `trace_id` and `span_id` are provided, the associated trace should be sampled. |
| 29 | + |
| 30 | +## Retention in views |
| 31 | + |
| 32 | +Libraries should attempt to retain and export at least once exemplar per bucket per reporting |
| 33 | +period for distribution-type views. Libraries should not retain an unbounded number |
| 34 | +of exemplars. |
| 35 | + |
| 36 | +Libraries should prefer retaining exemplars with |
| 37 | +[sampled traces](https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/Sampling.md) |
| 38 | +associated with them. |
| 39 | +After considering associated trace, libraries should prefer exemplars with more attachments |
| 40 | +over exemplars with fewer or no attachments. |
| 41 | + |
| 42 | +## Exporting |
| 43 | + |
| 44 | +The interpretation of attachments is up to the exporter. Currently, only Stackdriver is known |
| 45 | +to support exemplars. |
0 commit comments