Feature Request: Introduce events to transaction/spans
- Dominant language
- Gherkin
- Stars
- 427
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Currently, the experience of the APM is not ideal when it comes to visualising some of the interesting events that happened during the lifetime of transactions as well as the individual spans.
### Current shortcomings
RUM agent captures some of the metrics that are provided by the browser to understand the user experience of the web page. These metrics can be categorized into two categories
Marks - Denotes a timestamp of an interesting event
Metrics/Events - Denotes a duration of an interesting event
Examples:
Marks - [First Contentful Paint](https://web.dev/fcp/), [Largest Contentful Paint](https://web.dev/lcp)
Metrics - [First Input Delay](https://web.dev/fid), [Total Blocking Time](tbt)
Since there is no way to properly denotes these interesting metrics in the UI, The RUM agent uses spans with the name of the metrics, but they are not super helpful and would confuse users.
## Proposal
Introduce events into the existing Transaction and Spans scheme that would allow us to denote some of the interesting events that happened during the lifetime of that trace.
Example of the schema
```json
{
"events": [
{
"name": "First Input Delay",
"start": 5,
"end": 20
},
{
"name": "Total Blocking Time",
"start": 25,
"end": 50
}
]
}
```
This proposal would not only allow us to make the experience better for RUM, but also would help surface other interesting details in Span created by both RUM and other backend agents such as
A give HTTP request span could be enriched with events like DNS time,TCP connection time,Download time and could be rendered in the UI in this way

Even though we can create spans for DNS, Connection etc, I believe it has two advantages in the context of RUM
+ Reduces the number of span documents, eventually reducing the payload size and storage (applicable to all agents)
+ Makes it easier for our users to adopt the APM product as it resembles the events used by browser devtools.
I believe this would be immensely helpful for the users and would solve one of the other RUM usecase where we want to create dashboards based on some of the events.
### Schema changes
```
{
"events": [
{
"name": ["string"],
"start": ["number", "null"],
"end": ["number", "null"]
}
]
}
```
This is not the final schema change, I would like to get all your thoughts and feedback on how we can make it work for both RUM and other backend agents.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.