apm-agent-rum-js icon indicating copy to clipboard operation
apm-agent-rum-js copied to clipboard

expose a beacon API as part of the rum instance

Open vigneshshanmugam opened this issue 5 years ago • 3 comments

This is a feature request.

We could expose a beacon API from the ApmBase instance that would let users supply their own way of sending the RUM events to the APM Server. Some of advantages this would bring for the users are

  • Can configure custom authentication strategies when there is a proxy server infront of the APM server.
  • possible to choose AJAX, FETCH or sendBeacon for sending the payload
  • Payload formats can be customised based on the needs.

vigneshshanmugam avatar Sep 04 '19 11:09 vigneshshanmugam

Since the agent uses an AJAX POST to APM Server today, I think we should consider that the API we expose should make it simple to mostly reuse the current approach, but modify/add auth headers and potentially modify the post PATH.

Some customers have difficulties getting additional public IP addresses for APM Server (in addition to the one their application uses). So, they want to add a routing reverse proxy in front of the users application that will route to the application server or to APM Server depending on whether it's a normal application AJAX or a POST from the RUM agent. You can imagine postfixing the agent post PATH with _rum/ so it becomes /intake/v2/events such that you can configure your reverse proxy to forward rum/* to APM Server. Another option is for them to add an endpoint to their application which will check auth headers and then proxy the result to an APM Server.

roncohen avatar Sep 04 '19 11:09 roncohen

Thanks @roncohen for the detailed information. Totally agree with you on the reusability part.

For path, we can keep using the serverUrlPrefix config set by the user and we can allow also users to extend the headers in addition to the default configs.

vigneshshanmugam avatar Sep 04 '19 12:09 vigneshshanmugam

For path, we can keep using the serverUrlPrefix config set by the user and we can allow also users to extend the headers in addition to the default configs.

ah, forgot about serverUrlPrefix. Very good. Thanks

roncohen avatar Sep 04 '19 12:09 roncohen