-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a docs/ directory to thoroughly describe the InfluxDB data model/schema, and how it relates to other data models/schemas. As I write the docs, I'm also auditing the otel2influx implementation; some incremental improvements are included as well.
- Loading branch information
Jacob Marble
committed
Mar 29, 2021
1 parent
0bf16ca
commit f471805
Showing
10 changed files
with
224 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# InfluxDB Observability | ||
|
||
**This is experimental software** | ||
> This is experimental software | ||
This repository aims to be the reference for storing traces, metrics, and logs in InfluxDB/IOx. | ||
This repository is a reference for converting observability signals (traces, metrics, logs) to/from a common InfluxDB/IOx schema. | ||
|
||
The [InfluxDB/IOx storage engine](https://github.com/influxdata/influxdb_iox) is a new time series storage engine, currently under active development. | ||
Its design objectives include critical features for storing and querying observability signals at scale: | ||
- high cardinality | ||
- high capacity | ||
- high performance | ||
|
||
## Schema Reference | ||
|
||
[Schema reference with conversion tables](docs/index.md). | ||
|
||
## otel2influx | ||
|
||
The golang package [`otel2influx`](otel2influx/README.md) converts OpenTelemetry protocol buffer objects to (measurement, tags, fields, timestamp) tuples. | ||
It is imported by [a WIP fork of OpenTelemetry Collector Contrib](https://github.com/influxdata/opentelemetry-collector-contrib/tree/influxdb) and by [a WIP fork of Telegraf](https://github.com/jacobmarble/telegraf/tree/jgm-opentelemetry). | ||
|
||
## jaeger-query-plugin | ||
|
||
The [Jaeger Query Plugin for InfluxDB](jaeger-query-plugin) enables querying traces stored in InfluxDB/IOx via the Jaeger UI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# InfluxDB/IOx Common Observability Schema | ||
|
||
*Perfect is the enemy of good.* | ||
|
||
Reference for InfluxDB/IOx schema, in terms of the OpenTelemetry data model. | ||
The goal of this schema is to be (1) a common reference for clients writing to and reading from InfluxDB/IOx and (2) a common reference for humans performing ad-hoc queries to troubleshoot observed systems. | ||
|
||
While OpenTelemetry is the primary reference, translation to/from some other common schemas are also provided. | ||
|
||
InfluxDB value types are expressed as tag and field. | ||
Tags and fields have non-empty string keys. | ||
Tags have string values, and fields have basic scalar values: string, int, uint, float, bool. | ||
|
||
Non-finite floating-point field values (+/- infinity and NaN from IEEE 754) are not currently supported by InfluxDB/IOx, but are part of the design spec. | ||
Therefore, no special consideration is given here. | ||
|
||
## Signal Types | ||
|
||
- [Traces](traces.md) | ||
- [Metrics](metrics.md) | ||
- [Logs](logs.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Traces | ||
|
||
A trace is a list of spans. | ||
A span is composed of: | ||
|
||
- some specific attributes | ||
- zero-to-many free-form attributes | ||
- logs | ||
- links to other spans | ||
|
||
#### References | ||
|
||
- [OpenTelemetry Tracing Specification](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.1.0/specification/trace) | ||
- [OpenTelemetry Span protocol buffer message](https://github.com/open-telemetry/opentelemetry-proto/blob/v0.7.0/opentelemetry/proto/trace/v1/trace.proto#L48-L227) | ||
- [OpenTracing Specification](https://github.com/opentracing/specification) | ||
- [Jaeger protocol buffers](https://github.com/jaegertracing/jaeger-idl/tree/master/proto) | ||
- [OpenTelemetry -> Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/trace/sdk_exporters/jaeger.md) TODO link to code and documentation | ||
- [Zipkin protocol buffers](https://github.com/openzipkin/zipkin-api/blob/1.0.0/zipkin.proto) | ||
- [OpenTelemetry -> Zipkin](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/trace/sdk_exporters/zipkin.md) TODO link to code and documentation | ||
|
||
## InfluxDB measurement `spans` | ||
|
||
Influx tag/field | OpenTelemetry Span field | Jaeger Span field | Zipkin Span field | ||
--- | --- | --- | --- | ||
timestamp | `start_time_unix_nano` fixed64 | `start_time` Timestamp | `timestamp` fixed64 (µs) | ||
`trace_id` tag | `trace_id` bytes | `trace_id` bytes | `trace_id` bytes | ||
`span_id` tag | `span_id` bytes | `span_id` bytes | `id` bytes | ||
`parent_span_id` tag | `parent_span_id` bytes | (included in `references`)<br />type `CHILD_OF` | `parent_id` bytes | ||
`trace_state` tag | `trace_state` string | ||
`name` tag | `name` string | `operation_name` string | `name` string | ||
`kind` tag<br />(OTel stringified) | `kind` enum SpanKind | `tags["span.kind"]` | `kind` enum Kind | ||
`end_time_unix_nano` field int | `end_time_unix_nano` fixed64 | ||
`duration_nano` field int | | `duration` Duration | `duration` uint64 (µs) | ||
- | `status` Status | ||
`otel.status_code` tag; `OK` or `ERROR` | `status.code` enum StatusCode | `tags["otel.status_code"]`<br />if `ERROR` then add:<br />`tags["error"] = true` | `tags["otel.status_code"]`<br />if `ERROR` then add:<br />`tags["error"] = true` | ||
`otel.status_description` field string | `status.message` string | `tags["otel.status_description"]` | `tags["error"]`<br />iff `otel.status_code` == ERROR | ||
- | `instrumentation_library` InstrumentationLibrary | ||
`otel.library.name` tag | `InstrumentationLibrary.name` string | `tags["otel.library.name"]` | `tags["otel.library.name"]` | ||
`otel.library.version` tag | `InstrumentationLibrary.version` string | `tags["otel.library.version"]` | `tags["otel.library.version"]` | ||
- | `resource` Resource | `process` Process | ||
- | `attributes["service.name"]` | `process.service_name` string | ||
(free-form fields)\* | `Resource.attributes` repeated KeyValue. | `process.tags` repeated KeyValue | ||
`otel.resource.dropped_attributes_count` field uint | `Resource.dropped_attributes_count` uint32 | ||
(free-form fields)\* | `attributes` repeated KeyValue | `tags` repeated KeyValue | `tags` map<string, string> | ||
`otel.span.dropped_attributes_count` field uint | `dropped_attributes_count` uint32 | ||
(see "Influx measurement `logs`") | `events` repeated Event | `logs` repeated Log | `annotations` repeated Annotation | ||
`otel.span.dropped_events_count` field uint. | `dropped_events_count` uint32 | ||
(see "Influx measurement `span-links`") | `links` repeated Link | `references` repeated SpanRef | ||
`otel.span.dropped_links_count` field uint | `dropped_links_count` uint32 | ||
- | | `flags` uint32 | ||
- | | `warnings` string | ||
- | `attributes["zipkin.local_endpoint"]` | | `local_endpoint` Endpoint | ||
- | \*\* | | `remote_endpoint` Endpoint | ||
- | `attributes["zipkin.debug"]` | | `debug` bool | ||
- | `attributes["zipkin.shared"]` | | `shared` bool | ||
|
||
\* To convert from Influx to OTel, use common OTel attribute key prefixes to distinguish resource attributes from span attributes. | ||
This regex matches resource attribute keys: | ||
|
||
``` | ||
^(service\.|telemetry\.|container\.|process\.|host\.|os\.|cloud\.|deployment\.|k8s\.|aws\.|gcp\.|azure\.|faas\.name|faas\.id|faas\.version|faas\.instance|faas\.max_memory) | ||
``` | ||
|
||
\*\* Zipkin's `remote_endpoint` [must be created from several OTel attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md#remote-endpoint) | ||
|
||
## InfluxDB measurement `logs` | ||
|
||
Influx tag/field | OpenTelemetry Span.Event field | Jaeger Log field | Zipkin Annotation field | ||
--- | --- | --- | --- | ||
timestamp | `time_unix_nano` fixed64 | `timestamp` Timestamp | `timestamp` fixed64 (µs) | ||
`trace_id` tag | `trace_id` bytes | ||
`span_id` tag | `span_id` bytes | ||
`name` tag | `name` string | `fields["event"]` | `value` string\*\* | ||
`body` field string\* | | `fields["message"]` | ||
? | ? | `fields["stack"]` | ||
(free-form fields) | `attributes` repeated KeyValue | `fields` repeated KeyValue | ||
`otel.event.dropped_attributes_count` field uint | `dropped_attributes_count` uint32 | `fields["otel.event.dropped_attributes_count"]` | ||
(free-form fields) | span resource.attributes | ||
|
||
\* `body` does not exist in the OpenTelemetry Span.Event, but does in OpenTelemetry LogRecord; InfluxDB explicitly names it in the `logs` measurement. | ||
|
||
\*\* `value` is composed as: | ||
|
||
``` | ||
"<name>": {"<attribute key>": "<attribute value", ...} | ||
``` | ||
|
||
## InfluxDB measurement `span-links` | ||
|
||
Influx tag/field | OpenTelemetry Span.Link field | Jaeger SpanRef field | ||
--- | --- | --- | ||
timestamp | (copied from linking span) | ||
`trace_id` tag | (copied from linking span) | ||
`span_id` tag | (copied from linking span) | ||
`linked_trace_id` tag | `trace_id` bytes | `trace_id` bytes | ||
`linked_span_id` tag | `span_id` bytes | `span_id` bytes | ||
`trace_state` tag | `trace_state` string | ||
(free-form fields) | `attributes` repeated KeyValue | ||
`otel.link.dropped_attributes_count` field uint | `dropped_attributes_count` uint32 | ||
- | | `ref_type` SpanRefType<br />always `FOLLOWS_FROM` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.