Git Product home page Git Product logo

Comments (8)

hmdhk avatar hmdhk commented on June 15, 2024

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.

raulmartinezr avatar raulmartinezr commented on June 15, 2024

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

  1. 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.

hmdhk avatar hmdhk commented on June 15, 2024

@raulmartinezr ,

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.

adrianlzt avatar adrianlzt commented on June 15, 2024

@raulmartinezr will be great if you could share the code!

from apm-agent-rum-js.

alvarolobato avatar alvarolobato commented on June 15, 2024

Closing this due to inactivity. @raulmartinezr please reopen if this is still happening and you have the requested information.

from apm-agent-rum-js.

kenyork avatar kenyork commented on June 15, 2024

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.

hmdhk avatar hmdhk commented on June 15, 2024

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.

kenyork avatar kenyork commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.