Skip to content

Commit b7eddc4

Browse files
authored
Add exemplars section to spec (#25)
* Add table of contents to spec * Add exemplars section
1 parent 8656703 commit b7eddc4

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

SPEC.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1-
# Autometrics Specification
1+
# Autometrics Specification <!-- omit in toc -->
22

33
This is a work in progress specification for Autometrics.
44

55
It aims to describe the full feature set of the Autometrics libraries, but it may have important details missing. We will attempt to update this document to describe the expectations across all of the language implementations.
66

7+
- [API](#api)
8+
- [Service-Level Objectives (SLOs)](#service-level-objectives-slos)
9+
- [Metric Collection Libraries](#metric-collection-libraries)
10+
- [Exemplars (Optional)](#exemplars-optional)
11+
- [Metrics](#metrics)
12+
- [`function.calls.count`](#functioncallscount)
13+
- [`function.calls.duration`](#functioncallsduration)
14+
- [`build_info`](#build_info)
15+
- [`function.calls.concurrent`](#functioncallsconcurrent)
16+
- [Labels](#labels)
17+
- [`branch`](#branch)
18+
- [`caller`](#caller)
19+
- [`commit`](#commit)
20+
- [`function`](#function)
21+
- [`module`](#module)
22+
- [`objective.name`](#objectivename)
23+
- [`objective.percentile`](#objectivepercentile)
24+
- [`objective.latency_threshold`](#objectivelatency_threshold)
25+
- [`result`](#result)
26+
- [`version`](#version)
27+
28+
729
## API
830

931
Libraries SHOULD expose a decorator, macro, wrapper function, or use another metaprogramming technique offered by the language to instrument functions and methods in the user's source code. Ideally, the function attribute should simply be called `autometrics` or `Autometrics`, but libraries MAY append a suffix to the name if necessary.
@@ -32,6 +54,14 @@ Libraries MUST support producing metrics using an OpenTelemetry library. Librari
3254

3355
Libraries MUST support exporting metrics to Prometheus, or provide documentation for how users can export the metrics from the OpenTelemetry format to the Prometheus exposition format.
3456

57+
### Exemplars (Optional)
58+
59+
Autometrics libraries MAY support attaching exemplars to the metrics generated if the underlying metrics library or libraries they use support them. See [Grafana's explainer](https://grafana.com/docs/grafana/latest/fundamentals/exemplars/), the [OpenMetrics Spec](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars), and the [OpenTelemetry Spec](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#exemplars) for more details about exemplars.
60+
61+
Libraries that support exemplars SHOULD integrate with popular tracing libraries and/or the OpenTelemetry library to extract exemplar fields from the context or span a given function is called within.
62+
63+
Libraries SHOULD support extracting the `trace_id` field and attaching it as an exemplar label or attribute. Libraries MAY support extracting other fields automatically or provide the user functionality to customize which fields are used.
64+
3565
## Metrics
3666

3767
Autometrics uses the [OpenTelemetry Metric Semantic Conventions](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md) for naming metrics, including using `.`'s as separators.

0 commit comments

Comments
 (0)