Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
carsonip opened this issue Dec 6, 2024 · 3 comments

Comments

@carsonip
Copy link
Member

carsonip commented Dec 6, 2024

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

@endorama
Copy link
Member

endorama commented Dec 6, 2024

Do we know why duration is not set or in which cases we expect it not to be set? Setting it to 0 make sense (no duration = 0 duration), but is it expected to not be present in the document at all? I'm wondering if there is a bug somewhere else and this is a symptom.

@carsonip
Copy link
Member Author

carsonip commented Dec 6, 2024

Great question. I've update the description to mention user ingest pipelines.

@kruskall
Copy link
Member

We should probably move away from *.duration.us to event.duration. See #5999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants