Comments (8)
Hi @raulmartinezr ,
Thanks for using Elastic APM.
Currently, only the page load transactions are sent to the APM Server by default. However, you can use our Custom Transaction API to create transactions after the page load. One common approach is to create a new transaction with each route change therefore you would register an event listener with your routing library and create a transaction when a route change happens. please note that all of the XHR spans are automatically added to your custom transaction once you create one.
We are also considering to provide integration with commonly used routing libraries but there are no timelines for that yet.
Can I ask which routing library you currently use?
Cheers,
Hamid
from apm-agent-rum-js.
Hi @jahtalab,
The webapp is developed with spring boot + angular and odata services.
But as i do not want to touch this third party app, i installed nginx in front and there I inject javascript in html.
What I did so far is...
-
add click events in angular links, not with angular but with jquery (filtering by angular attributes)
-
when the event is triggered, previous transaction is ended and new one is created. In this way transactions could be there without being sent to apm-server forever, thats why i want to implement some additional functionalities....
1.- define max timeout for transactions
2.- modal popup to control transactions when RUM mode is enabled. I'll configure nginx to enable this mode via parameter
- With all configured in this way i had an issue; some odata requests triggered by the click were sent faster than the event I added to links, so some spans were lost. That's why i had to change the sequence of click event handlers in links, prioritizing mine.
Only a few of these functionalities are pending, hope all of them work fine
By the way, one question. I use javascript agent and java agent(server side transactions and spans).... do you know if apm-server correlates transacions belonging to the same request and merge them in the same transaction before sending it to elasticsearch?
I tried to locate some correlation id in request headers (sent by javascript agent somewhere) but no luck.
Maybe this correlation is done in a different way. If its not done, It would be a nice feature... browser.. network.... server and database times, all spans together in the same transaction :)
BR,
Raul
from apm-agent-rum-js.
Thanks for sharing your progress.
We are considering ways to improve sending custom transactions. One of the approaches is to automatically detect when a transaction is finished by keeping track of all the "tasks" (such as XHRs) that happens while the transaction is active.
Do you mind sharing parts of your instrumentation in this issue? Having your feedback would help us a lot in improving our custom transaction feature.
Regarding correlating multiple transactions, we're working on a feature called distributed tracing which would enable you to see the correlation of transactions generated by different services.
from apm-agent-rum-js.
@raulmartinezr will be great if you could share the code!
from apm-agent-rum-js.
Closing this due to inactivity. @raulmartinezr please reopen if this is still happening and you have the requested information.
from apm-agent-rum-js.
Sorry for coming in late on a closed issue, but was fighting with this all morning and want to double check. So if I have a page already loaded with a single button that will make an ajax call onClick, this xhr will not get sent to APM server out of the box, correct? I can see the span being created, but if I want this to actually get logged, I will have to wrap my ajax call in a custom transaction? I thought I was not setting something up correctly because I was not seeing any of my ajax calls in kibana. I did start to see them after wrapping around custom transactions.
This is just a simple example, working on adding this in to a larger app and if xhr are not sent automatically, I will have to design a way to track them all and wanted to make sure this is the case before I move forward too much. Thanks for any input.
from apm-agent-rum-js.
Thanks for reaching out @kenyork !
That's correct! Currently it is required to create a transaction to keep track XHR requests!
However we have this issue to improve on this use-case.
from apm-agent-rum-js.
Thanks @jahtalab for getting back. I will be working on something similar to the issue you posted. I have an in-house solution in production that is currently doing this using PerformanceObserver (falls back XMLHttpRequest if Observer fails) and posting all XHR to Kafka but now trying to work APM in to the mix and expanding functionality. Appreciate the quick response.
from apm-agent-rum-js.
Related Issues (20)
- Feature: Add LCP Element Attribution HOT 1
- Add transaction.name to errors
- @elastic/apm-rum overrides window.fetch HOT 6
- EncodedBodySize overflow HOT 2
- legitimate "bots" sending empty requests
- rum can't capture video type transactions HOT 6
- Custom serializer for Unhandled promise rejection: <object> HOT 6
- Custom spans not getting sent from agent HOT 7
- Incorrect page-load transaction duration for unsampled transactions HOT 4
- Incorrect calculation of LCP with redirect HOT 1
- Rum agent causes http requests to stay open even when aborted HOT 1
- Ability to update transactionSampleRate from transaction level HOT 5
- Feature: Support for React Router v6.4 Data APIs HOT 1
- NotReadableError: The I/O read operation failed. HOT 3
- add outcome/status_code to resource timing spans
- `@elastic/apm-rum-angular` package is giving error in Angular 9 HOT 2
- apm-rum-angular load-page transaction cannot get route path correctly HOT 7
- APM with NextJS not working HOT 2
- @elastic/apm-rum causes bundling issue with @web/dev-server HOT 2
- User event prevents http request transaction from starting HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apm-agent-rum-js.