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

[APM] Trace timeline: Show message when transactions are missing #25117

Closed
sorenlouv opened this issue Nov 5, 2018 · 18 comments · Fixed by #171196
Closed

[APM] Trace timeline: Show message when transactions are missing #25117

sorenlouv opened this issue Nov 5, 2018 · 18 comments · Fixed by #171196
Assignees
Labels
apm:waterfall enhancement New value added to drive a business result Team:APM All issues that need APM UI Team support

Comments

@sorenlouv
Copy link
Member

sorenlouv commented Nov 5, 2018

It can happen that one or more spans are pointing to a transaction that is missing. In this case it is not possible to place the spans on the timeline.

When this occurs a message in the UI should indicating that the data is incomplete.

Design

This trace contains spans from missing transactions. As a result these spans are not displayed in the timeline.

@sorenlouv sorenlouv added Team:APM All issues that need APM UI Team support [zube]: Impl Backlog labels Nov 5, 2018
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

@formgeist
Copy link
Contributor

@elastic/apm-ui I'll assign this to me, as I will create explicit designs for showing this tooltip for either missing and dropped spans as an enhancement over the current solution.

@formgeist
Copy link
Contributor

@sqren Just bringing this issue back up to the surface, but we want to warn/notify the user at trace view level (AFAICT when looking at the referenced issue) that spans are not shown because they have no parent transaction, right?

@sorenlouv
Copy link
Member Author

sorenlouv commented Jan 4, 2019

we want to warn/notify the user at trace view level

Yes. If by trace level you mean in contrast to on transaction/span level. So it should probably be a message at the top or bottom of the trace (but not a tooltip on a specific span/transaction).

@formgeist
Copy link
Contributor

Meaning it's only relevant when viewing the full/root trace view?

@sorenlouv
Copy link
Member Author

sorenlouv commented Jan 4, 2019

Since we don't know where in the trace the missing transactions belong we don't know if it's relevant or not to display the message in a partial trace. It's probably better to show the message than not, in case the user is expecting some transactions that are missing.

@formgeist
Copy link
Contributor

Right, so displaying the message for the trace whether or not you're viewing the full trace or only a given transaction within the trace. Thanks for the feedback 👍

@sorenlouv
Copy link
Member Author

Right, so displaying the message for the trace whether or not you're viewing the full trace or only a given transaction within the trace. Thanks for the feedback 👍

Yes, that sounds right.
np :)

@formgeist
Copy link
Contributor

I reckon we should display a small warning badge with a tooltip that warns the user that the trace has spans that are not displayed in the timeline visualization.

don t sync 01 dt - origin transaction with full trace - transaction missing spans

Suggested copy:

This trace contains spans from missing transactions. As a result these spans are not displayed in the timeline.

@sorenlouv
Copy link
Member Author

I like it 👍

@formgeist
Copy link
Contributor

@sqren Updated description with the solution

@formgeist formgeist removed the design label Jan 7, 2019
@formgeist formgeist removed their assignment Jan 7, 2019
@sorenlouv sorenlouv added the enhancement New value added to drive a business result label Aug 17, 2019
@sorenlouv sorenlouv changed the title [APM] Show message when transactions are missing [APM] Trace timeline: Show message when transactions are missing May 14, 2020
@botelastic
Copy link

botelastic bot commented Nov 1, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added the stale Used to mark issues that were closed for being stale label Nov 1, 2021
@botelastic botelastic bot removed the stale Used to mark issues that were closed for being stale label May 16, 2022
@mykolaharmash
Copy link
Contributor

Moving back to "Ready" in order to prioritize Profiling integration into Infra.

@jennypavlova jennypavlova self-assigned this Nov 9, 2023
@jennypavlova
Copy link
Member

I discussed with @kpatticha the scenarios here and the easiest way to verify the spans is to check if the parent.id is present - that way we know that the trace is incomplete (draft PR).

We were also discussing the scenario when a transaction is missing but it's still a parent of a span (so the parent.id is the id of this transaction) - for that case just checking if the parent id is present won't work and the spans of the missing transaction won't be shown in the waterfall.

@elastic/apm-server I have some questions: Is there a way to know if a trace is incomplete and which property should I check? In case there is no way to check on a trace level how do we validate a transaction? I am looking for a way to check that based on the trace data returned. Also, any example of an incomplete trace will be useful.

@sorenlouv
Copy link
Member Author

I discussed with @kpatticha the scenarios here and the easiest way to verify the spans is to check if the parent.id is present - that way we know that the trace is incomplete (#171196).

This doesn't sound right. The problem I suggest we focus on is when items are dropped by an APM agent, are lost in transit or are still being ingested and are thus not available to be rendered (see example)
I suggest you look for items (transactions or spans) that are orphans, because their parent is missing. Orphans are items where parent.id is pointing to a non-existing item in the trace.

@kpatticha
Copy link
Contributor

@sqren Thanks for chiming in.

so orphans are

  • Transactions or Spans with a parent.id that doesn't exist in the trace

What about the use case where the parent.id field is not present?(expect from the root) Or we can assume that it will be present. ?

By any chance, do you have a reproducible example ?

@sorenlouv
Copy link
Member Author

sorenlouv commented Nov 15, 2023

What about the use case where the parent.id field is not present?(expect from the root) Or we can assume that it will be present?

I'm not aware of this use case. I don't see why this would happen unless there is a bug in the APM agent (which we should then fix instead).

By any chance, do you have a reproducible example ?

Easy: Create a distributed using synthtrace, then manually delete one of the items in the trace.
Better: Use synthtrace to create a distributed trace, and use synthtrace to delete some items.

@jennypavlova
Copy link
Member

Thank you @sqren and @kpatticha!

I suggest you look for items (transactions or spans) that are orphans, because their parent is missing. Orphans are items where parent.id is pointing to a non-existing item in the trace.

So we want to show the message if the parent id of any item in the trace is not an id of any other trace item, right? I will try it out and see - probably create a similar case using synthtrace (it was hard to remove an item the last time I tried because once I filtered out a transaction it removed all its children)

What about the use case where the parent.id field is not present? (except from the root) Or we can assume that it will be present?

I'm not aware of this use case. I don't see why this would happen unless there is a bug in the APM agent (which we should then fix instead).

Ok, so it's not something I will check for - I was thinking at the beginning that the parent id is not set if a span/transaction is an orphan as it is an optional field but I guess it is not correct.

kibanamachine pushed a commit to nchaulet/kibana that referenced this issue Nov 20, 2023
…Spans with a parent.id that doesn't exist in the trace (elastic#171196)

Closes elastic#25117

## Summary

Add a missing transaction warning if there are Transactions or Spans
with a `parent.id` that doesn't exist in the trace.


## Testing

- Use the `trace_with_orphan_items.ts` scenario: `node
scripts/synthtrace --clean trace_with_orphan_items.ts`
- In APM -> Traces there are 2 traces:
- <img width="1423" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/3548d1dd-d87f-4090-a028-d62cf8ec35c8">
- Check the traces: 
   - Incomplete trace (with warning):
- <img width="1401" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/a75a2112-a425-43d9-bdd1-b3724ccfe6e3">

   - Complete trace (no warning):
- <img width="1387" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/f33614ab-269b-447c-bd0b-bc00f9799092">
- Unit test in
[waterfall_helpers.test.ts](https://github.com/elastic/kibana/pull/171196/files#diff-6cdeaa931c0085a16353ac34f937d442a39e1227621f11b3de0608a39e949fc6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:waterfall enhancement New value added to drive a business result Team:APM All issues that need APM UI Team support
Projects
None yet
6 participants