|
1 |
| -# Autometrics Specification |
| 1 | +# Autometrics Specification <!-- omit in toc --> |
2 | 2 |
|
3 | 3 | This is a work in progress specification for Autometrics.
|
4 | 4 |
|
5 | 5 | 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.
|
6 | 6 |
|
| 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 | + |
7 | 29 | ## API
|
8 | 30 |
|
9 | 31 | 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
|
32 | 54 |
|
33 | 55 | 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.
|
34 | 56 |
|
| 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 | + |
35 | 65 | ## Metrics
|
36 | 66 |
|
37 | 67 | 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