Input data transformation
Monium currently receives data only in the OpenTelemetry
As the OpenTelemetry data model is not a full match of the Monium logical data model (e.g., it does not distinguish between labels and meta), a number of rules and transformations are applied.
Attribute transformations
Attributes from resources (ResourceLogs.resource.attributes), instrumentation scopes (ScopeLogs.scope.attributes), and log lines (LogRecord.attributes) are merged and transferred into labels (labels) and metadata (meta) based on the following algorithm:
- At each level (resource/scope/log), attributes are collected and sorted between
labelsandmeta:- Attributes with names starting with
labels.go tolabels(thelabels.prefix will be deleted). - Attributes with names starting with
meta.go tometa(themeta.prefix will be deleted). - All other attributes go to
meta, except for the known attributes. - Attributes whose keys start with the
_character or contain non-printable characters are discarded. The number of discarded attributes will be shown in a metric.
- Attributes with names starting with
labelsandmetaof all levels (resource/scope/log) get merged; the log-level attributes have the highest priority, the scope-level attributes have lower priority, and resource-level attributes have the lowest priority. For more information, see the table of priorities.- Values in
int64ordoubletype attributes remain numeric. Other types are converted to strings:- Bool, a string with the
trueorfalsevalue. - Bytes are serialized as a base64 string (RFC 4648
). - Arrays and dictionaries are serialized similarly to JSON.
- Bool, a string with the
- Attributes from
labelsthat do not comply with the label limitations are moved to themetalevel (the existing attribute gets removed). - Attributes from
metathat do not comply with the metadata limitations are discarded. The number of discarded attributes will be shown in a metric.
Priorities
Priorities for attributes in labels
| Attribute | Resource | Scope | Log |
|---|---|---|---|
Valid value of the labels.abc label |
2 | 1 | 0 |
(0 for the highest priority, 2 for the lowest)
Priorities for attributes in meta
| Attribute | Resource | Scope | Log |
|---|---|---|---|
abc |
8 | 6 | 4 |
meta.abc |
7 | 5 | 3 |
Invalid value of the labels.abc label |
2 | 1 | 0 |
(0 for the highest priority, 8 for the lowest)
Known attributes
Some system attributes are treated as labels without the labels. prefix:
projectclusterservice,service.namehost,host.name,hostnameservice.componentservice.versiondeployment.environmentdc
Warning
The request_id attribute is also treated as a known label but will be migrated to meta soon.
Warning
The project, cluster, service, and host system attributes are expected at the resource level.
Specifics of transforming reserved labels:
If a non-empty and non-null value is found by the first key in the list (the highest priority one), it is written to the relevant attribute label. The key that was used is removed. Preservation of the remaining keys in the list is not guaranteed.
| Label in otel format (attribute key) | Transformed into (attribute label) |
|---|---|
service/service.name |
service |
host/host.name/hostname |
host |
labels.component/service.component |
component |
labels.version/service.version |
version |
labels.env/deployment.environment |
env |
labels.dc/dc |
dc |
Invalid attributes
Attributes that do not comply with the limitations will be deleted and will not go to the long-term storage. The rest of the information from the log line will be saved.
Supported OTLP fields
Scope level
Scope-level fields
- The
namefield, into thescope.nameattribute. - The
versionfield, into thescope.versionattribute.
The resulting attributes have the lowest priority.
Log level
Trace and span IDs
The trace_id and span_id fields are optional. Field values must have the following lengths:
trace_id: 16-byte ID.span_id: 8-byte ID.
Valid IDs will be saved in the system in HEX format as trace.id and span.id, respectively.
For more information, see this specification
In JSON format, the trace_id and span_id visualization depends on the protocol:
| Protocol | Visualization |
|---|---|
| HTTP+JSON | HEX string |
| GRPC+JSON | Base64 string |