grafana / faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
https://grafana.com/oss/faro/
Apache License 2.0
774 stars 66 forks source link

Propagated traces have incorrect start time #698

Open omikader opened 2 months ago

omikader commented 2 months ago

Description

We are seeing strange delays in the start time for propagated traces emitted from our Flask API. Notice how the HTTP GET trace, which is emitted by our React SPA, starts and finishes before the traces emitted by the Flask API server seem to even start.

Image

Steps to reproduce

Expected behavior

Actual behavior

Image

Image

Image

Environment

JordiPolo commented 2 months ago

I think this happens because the clock in the laptop and the clock in the server are 200ms apart. Consumer laptops are not too hardcore about syncing continuously their clocks, being a couple of seconds up or down compared with some atomic clock in the atmosphere or something, does not make a difference to them. Servers tend to be perfectly synced within the datacenter so this effect does not happen among services.

omikader commented 2 months ago

Hi @JordiPolo, thanks for the quick response! Given that this is the case, would you say it is not valuable to propagate traces from a client's device to actions taken on the server? Or perhaps is there a canonical strategy for resetting the start time for the client-side trace once it is captured by the Faro receiver?

JordiPolo commented 2 months ago

Maybe at some point there is a way to know the diff in clocks an a solution. Right now this is what you will get. To me still makes sense to have this information as long as the people who would be reading the trace understand why this looks like that.