Skip to main content
Version: Next

Datadog RUM Installation

Datadog Real User Monitoring (RUM) allows you to visualize and analyze the real-time performance and user journeys of your application's individual users. This is an option to profile and monitor the user experience of your Backstage installation.

There is a basic Datadog RUM integration built into Backstage. You can enable it by adding the following to your app-config.yaml:

app:
datadogRum:
clientToken: '123456789'
applicationId: qwerty
# site: datadoghq.eu
# env: 'staging'
# sessionSampleRate: 100
# sessionReplaySampleRate: 0

If your app-config.yaml file does not have this configuration, you may have to adjust your packages/app/public/index.html to include the Datadog RUM init() section manually.

Please note that the env value MUST be specified at build time

note

In case after a proper configuration, the events still are not being captured: Copy and paste this section in to your packages/app/public/index.html under the <head> tag.

<% if (config.has('app.datadogRum')) { %>
<script>
(function (h, o, u, n, d) {
h = h[d] = h[d] || {
q: [],
onReady: function (c) {
h.q.push(c);
},
};
d = o.createElement(u);
d.async = 1;
d.src = n;
n = o.getElementsByTagName(u)[0];
n.parentNode.insertBefore(d, n);
})(
window,
document,
'script',
'https://www.datadoghq-browser-agent.com/datadog-rum-v3.js',
'DD_RUM',
);
DD_RUM.onReady(function () {
DD_RUM.init({
clientToken: '<%= config.getString("app.datadogRum.clientToken") %>',
applicationId: '<%= config.getString("app.datadogRum.applicationId") %>',
site: '<%= config.getOptionalString("app.datadogRum.site") || "datadoghq.com" %>',
service: 'backstage',
env: '<%= config.getString("app.datadogRum.env") %>',
sampleRate:
'<%= config.getOptionalNumber("app.datadogRum.sessionSampleRate") || 100 %>',
sessionReplaySampleRate:
'<%= config.getOptionalNumber("app.datadogRum.sessionReplaySampleRate") || 0 %>',
trackInteractions: true,
});
});
</script>
<% } %>

The clientToken and applicationId are generated from the Datadog RUM page following these instructions.

There are two optional arguments:

  • site: The Datadog site of your organization; defaults to datadoghq.com
  • env: The application environment for Datadog events (no default)