designcourse
designcourse copied to clipboard
🙏 Custom timings that occur before originTime
What are you trying to achieve and what is your issue? Please describe.
I'm building an web app for Samsung TVs which run on the Tizen OS and I need to track metrics that are created before my application is requested.
The setup looks like this:
- My app is installed as a simple html file
- When this html file loads it uses the object element to embed my the actual application which is hosted on a public domain:
const webview = document.createElement('object');
webview.setAttribute('type', 'text/html');
webview.setAttribute('data', 'https://domain-for-my-app.com');
document.body.appendChild(webview);
- The parent document gets the resource timing for the embedded app and when the embedded app is ready, the parent document posts a message into it with the resource timing.
How I'm calculating the resource timing:
// "embeddedAppStartTime" is when the embedded app was requested.
const timing = performance.timeOrigin - embeddedAppStartTime
dd.addTiming('app-load-start', timing)
Unfortunately, the RUM UI ends up showing values that are in days and hours whereas they should be in milliseconds.
Describe the solution you'd like I'd like to be able to submit and view timings that occur before the originTime for the document. With the current approach I am seeing values that are in days and hours but they should be in milliseconds.
Nice to have: It would be great if I could pass these into .addDurationVital() and have them show in the UI as having occurred before originTime.
Describe alternatives you've considered There's the approach I've shown above. I'm new to DataDog so maybe there's a better way?
Hello @gxxcastillo, Thanks for sharing your use case. Our visualizations only support timings that occur during the page lifecycle. Visualizing timings before timeOrigin isn’t something we’ve considered yet, but we may revisit it in the future if it gains more traction.
Thanks for the clarification, @amortemousque. Given the options that are currently available, do you know if there's a better way to approach this than using .addTiming() and passing it timeOrigin - {timePriorToOrigin}? Even if it can't be graphed, it would be great to have some way to visualize this value.
You can set any value to the global context or view context. Ex:
const timing = performance.timeOrigin - embeddedAppStartTime
dd.setGlobalContextProperty('app_load_start', timing)
Then in the Datadog App UI, all events should have this property (under @context.app_load_start), and you'll be able to add a facet and graph it using the various Visualisations in the Sessions Explorer.