You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pack: add metadata and group info into log JSON record (fix#10258)
Before this patch, the JSON log record encoder only supported the log
record body as an output content, missing support for log record metadata
and group metadata and group attributes (if defined).
This patch makes the JSON encoder add support for the missing data, packaging into
the record a new parent key called '__internal__' that holds the following inside it:
- group_attributes: group header attributes
- log_metadata: log record metadata
Note that for cases where the origin of the data was OTLP and as part of the groups
we add 'group metadata' (in the origin), this is not being used since it only contains
internal references that are not used for this JSON export: we do not aim to reassmble
this JSON into a Fluent Bit record.
Consider the following original OTLP JSON record ingested into the pipeline:
{
"resourceLogs": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "my.service"
}
}
]
},
"scopeLogs": [
{
"scope": {
"name": "my.library",
"version": "1.0.0",
"attributes": [
{
"key": "my.scope.attribute",
"value": {
"stringValue": "some scope attribute"
}
}
]
},
"logRecords": [
{
"timeUnixNano": "1544712660300000000",
"observedTimeUnixNano": "1544712660300000000",
"severityNumber": 10,
"severityText": "Information",
"traceId": "5B8EFFF798038103D269B633813FC60C",
"spanId": "EEE19B7EC3C1B174",
"body": {
"stringValue": "Example log record"
},
"attributes": [
{
"key": "string.attribute",
"value": {
"stringValue": "some string"
}
},
{
"key": "boolean.attribute",
"value": {
"boolValue": true
}
},
{
"key": "int.attribute",
"value": {
"intValue": "10"
}
},
{
"key": "double.attribute",
"value": {
"doubleValue": 637.704
}
},
{
"key": "array.attribute",
"value": {
"arrayValue": {
"values": [
{
"stringValue": "many"
},
{
"stringValue": "values"
}
]
}
}
},
{
"key": "map.attribute",
"value": {
"kvlistValue": {
"values": [
{
"key": "some.map.key",
"value": {
"stringValue": "some value"
}
}
]
}
}
}
]
}
],
"schemaUrl": "https://example.com/schema"
}
],
"schemaUrl": "https://example.com/schema"
}
]
}
now when encoded in msgpack and then JSON the output will be:
{
"date": 1544712658.274599,
"__internal__": {
"group_attributes": {
"resource": {
"attributes": {
"service.name": "my.service"
}
},
"scope": {
"name": "my.library",
"version": "1.0.0",
"attributes": {
"my.scope.attribute": "some scope attribute"
}
}
},
"log_metadata": {
"otlp": {
"observed_timestamp": 1544712660300000000,
"severity_number": 10,
"severity_text": "Information",
"attributes": {
"string.attribute": "some string",
"boolean.attribute": true,
"int.attribute": 10,
"double.attribute": 637.704,
"array.attribute": [
"many",
"values"
],
"map.attribute": {
"some.map.key": "some value"
}
},
"trace_id": "5B8EFFF798038103D269B633813FC60C",
"span_id": "EEE19B7EC3C1B174"
}
}
},
"log": "Example log record"
}
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
0 commit comments