elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
20.01k stars 8.25k forks source link

[APM] Time spent by span type chart rendering problem #202343

Closed crespocarlos closed 1 week ago

crespocarlos commented 2 weeks ago

Summary

The Time spent by span type chart has problems rendering the data when:

1 - There are big gaps between metric collection. This causes the percentage calculation to generate really small numbers eg subBucket.total_self_time_per_subtype.value=3539 and sumAllSelfTimes=36963655477 results in 4.7769449682984235e-8

Image

2 - For some reason, the chart renders the data points incorrectly in this situation. In the example below HTMLWrappedInJSON value is 0 at that timestamp, but the line spikes as if the value was 100%

Image

Possible fix

How to reproduce

elasticmachine commented 2 weeks ago

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

miloszmarcinkowski commented 1 week ago

2 - For some reason, the chart renders the data points incorrectly in this situation. In the example below HTMLWrappedInJSON value is 0 at that timestamp, but the line spikes as if the value was 100%

The chart represents values proportionally with alphabetical order (from the bottom to the top). Therefore, if the one value spikes, it raises the lines for all the following values.

Consider this example (2nd value occupies 99%, therefore 3rd value spikes to the top): Image

In this example, I swapped the order, so the 1st value occupies 99%. This causes the 2nd and 3rd values to spike to the top: Image

This isn't clearly visible in the example from SDH because their chart is broken due to negative numbers being provided. That is the reason for lines to cross. I addressed the problem in my PR. However, it would be good to investigate APM server to find why negative values happened in the first place.

SHD scenario with negative values (original): Image Customer HAR: Image

SHD scenario with negative values clamped to zero (after fix): Image