apm-agent-rum-js
apm-agent-rum-js copied to clipboard
Named long tasks
Hello everyone,
Right now I am working on long tasks optimization in my app
Data that I have in page load transaction - total blocking time and total long tasks count adn I could use it in Kibana to analyze long tasks in my app
In my case I would like to see more data related to long tasks - lets say particular long tasks with its durations
What I need:
- Additional statistic in Kibana - lets say I would like to add names to particular long tasks (in case I exactly know that this place in source code creates long task ):
agent.addNameToCurrentLongTask(someLongTaskName);
- When we have named long task it would be useful to automatically add additional parameters (durations of named long tasks) to page load transaction - like
transaction.namedLongTasksDurations.someLongTaskName : 500ms
That will allow as to add additional related to particular app Kibana aggregations to help us to understand and optimize long tasks better
So is it possible to add such kind of API in the future?
You can add an observer and rename the coresponding span, but you'll need some internal logic in your app to track what you want to add as meta data.
@dobrindobrev thank for such a quick response Seems that doesn't works for my case I could start observing transactions only when agent is initialized , so I could listen only the end event for such transactions and seems that on this point it is impossible to patch names to long tasks because on this point all the long tasks are the same - unknown - I hardly would be able to write an algorithm which will be able to set names to finished long tasks
That is why my suggestion was to add some API which will allow us to set long task name to current long task (which is not finished yet)
What do you think?
In the API, you'll still need to change the names of all Long tasks, there's no semantics attached to these spans afaik. I don't know if this is the case you're trying to cover, if it is then the new API method is a good idea, yes :)
However, in our experience these long tasks are application specific, and the information provided by the rum js agent is on a lower level of abstraction. So we've spent some time analyzing what this time actually represents(via the performance browser API) and we're adding spans to the page-load transaction. It's tedious, but I think that unless there's a specific driver for the technology you're using (which most probably causes the long tasks) there's no way to add meaningful information.
Hi @litwin90,
Thanks for using the agent!
It would be helpful if you give us an example of how would you like to use this new API exactly. (including snippets if possible). Btw, the agent doesn't have the concept of "current long task", there is no track of individual long tasks.
That would help us to understand the feasibility of this enhancement.
@dobrindobrev thanks for providing this excellent support 🙌
Thanks, Alberto