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

Commit 2eca89b

Browse files
authored
Introduce the Metrics data model. (#118)
1 parent 137d1c0 commit 2eca89b

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

stats/Export.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ parameter from the `View` and the aggregated data associated with those `columns
2828

2929
The library SHOULD provide a means of retrieving the ViewData for any registered view in the system.
3030

31+
ViewData is a language-specific data structure implementing the [Metrics data
32+
model](Metrics.md).
33+
3134
### Aggregation to Metric
3235

3336
| Aggregation | Measure Type | Metric Type | Value Type | Unit |
@@ -39,4 +42,4 @@ The library SHOULD provide a means of retrieving the ViewData for any registered
3942
| LastValue | Int64 | GAUGE | INT64 | Measure Unit |
4043
| Distribution | Int64 or Double | CUMULATIVE | DISTRIBUTION | Measure Unit |
4144

42-
Dimensionless Unit can be represented as "1".
45+
Dimensionless Unit can be represented as "1".

stats/Metrics.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Metrics
2+
Metrics are a data model for what stats exporters take as input.
3+
4+
Different exporters have different capabilities (e.g. which data types
5+
are supported) and different constraints (e.g. which characters are allowed in
6+
label keys). Metrics is intended to be a superset of what's possible, not a
7+
lowest common denominator that's supported everywhere.
8+
9+
Because of this, Metrics puts minimal constraints on the data (e.g. which
10+
characters are allowed in keys), and code dealing with Metrics should avoid
11+
validation and sanitization of the Metrics data. Instead, pass the data to the
12+
backend, rely on the backend to perform validation, and pass back any errors
13+
from the backend.
14+
15+
The Metrics data model is defined as
16+
[metrics.proto](https://github.com/census-instrumentation/opencensus-proto/blob/master/opencensus/proto/stats/metrics/metrics.proto),
17+
but the proto is just to illustrate the concepts. OpenCensus implementations
18+
don't have to use the actual proto, and can instead use a language-specific
19+
in-memory data structure that captures what exporters need. This structure
20+
should use the names and fields from the data model, for API consistency across
21+
languages.

stats/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ metrics.
1313
data aggregation.
1414
* [Export API](Export.md): used by the specific vendors to define vendor specific exporters (e.g.
1515
Prometheus, Stackdriver, SignalFx).
16+
* [Metrics Data Model](Metrics.md): defines a data model for exporters.
1617

1718
## Utils
1819
* [HTTP integration](HTTP.md): document about how to instrument http frameworks.
19-
* [gRPC integration](gRPC.md): document about how to instrument gRPC framework.
20+
* [gRPC integration](gRPC.md): document about how to instrument gRPC framework.

0 commit comments

Comments
 (0)