Skip to content

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

Open
@carsonip

Description

@carsonip
      {
        "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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions