Skip to content

Commit

Permalink
[EXPORTERS]: elastic search put attributes in json root instead of under
Browse files Browse the repository at this point in the history
`attributes`

This allows user to set other fields that are part of the [ECS log documentation](https://www.elastic.co/guide/en/ecs/8.11/ecs-log.html).
For instance, it allows to have an attribute with key `log.file`, that
will, thanks to `nlohmann::json`, appear as :
```
{
  "log": {
    "file": "xxx"
  }
}
```

Closes open-telemetry#3091
  • Loading branch information
ShadowMaxLeb committed Oct 18, 2024
1 parent 401ad81 commit 6d72624
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exporters/elasticsearch/src/es_log_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void ElasticSearchRecordable::SetAttribute(
nostd::string_view key,
const opentelemetry::common::AttributeValue &value) noexcept
{
WriteKeyValue(key, value, "attributes");
WriteValue(value, key.data());
}

void ElasticSearchRecordable::SetResource(
Expand Down

0 comments on commit 6d72624

Please sign in to comment.