elastic / elastic/apm-server

{transaction,span}.duration.us is unset if {transaction,span}.duration exists

Open
#14,851 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
1.3k
Forks
543
Avg merge
1d 18h
Merged PRs (30d)
109

Description

```
{
"script": {
"if": "ctx[ctx.processor.event]?.duration == null",
"source": """def eventDuration = ctx.event?.duration ?: 0;
def rootObjectName = ctx.processor?.event;
def rootObject = ctx[rootObjectName];
if (rootObject == null) {
rootObject = [:];
ctx[rootObjectName] = rootObject;
}
rootObject.duration = ["us": (long)(eventDuration/1000)];
"""
}
}
```
The `if` condition here is too strict that it forbids any other fields under `{transaction,span}.duration`. By default we should never set `{transaction,span}.duration`, but it is still possible via ingest pipelines.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.