Open lucascaro opened 2 years ago
Hi @lucascaro, this would be a great feature and that is definitely the approach to take re the gatsby-config.js
file. The following file takes that configuration and turns it into one that the Browser agent can recognise:
If you create a new Browser app in New Relic with Distributed Tracing enabled you will see a snippet that looks like the following:
<script type="text/javascript">
;window.NREUM||(NREUM={});NREUM.init={};
window.NREUM||(NREUM={}),__nr_require=function..... etc
;NREUM.loader_config={}
;NREUM.info={}
</script>
;window.NREUM||(NREUM={});NREUM.init={};
;window.NREUM||(NREUM={});NREUM.init={distributed_tracing:{enabled:true},privacy:{cookies_enabled:true},ajax:{deny_list:["bam-cell.nr-data.net"]}};
init
variablewindow.NREUM||(NREUM={}),__nr_require=function..... etc
configs
variable here and won't need to be changedThen we could put them all together here as:
__html: init + agent + configs
Hope that makes sense and great to see you contributing to the project 🕺
Hi, we are using the gatsby-plugin-newrelic, but distributed tracing seems not to be working for us. Is it possible to enable distributed tracing in the current version of the plugin? Or do you know a workaround on how to enable it?
Summary
Add support for distributed tracing configuration (
NREUM.init={distributed_tracing: ...
) or a custom init block.Desired Behaviour
The plugin allows to enable distributed tracing and set other related settings:
Possible Solution
The plugin allows adding initialization values in the plugin configuration
Additional context
I couldn't find any way to add these settings via the plugin which would be ideal. Right now it seems the only solution is to add this code manually before the plugin adds newrelic code to the page.