Open zhammer opened 6 months ago
From discussion in the argo contributor meeting, we're going to try implementing this as an extension
We've implemented this using a UI extension. Happy to open source though it's a little unclear what the best way to do that is since it requires custom configuration on the rum sdk (and also optional configuration). Anyway here's the extension index.ts
we run:
import { datadogRum } from '@datadog/browser-rum';
async function setUser() {
const res = await fetch(`/api/v1/session/userinfo`)
if (res.status !== 200) {
throw new Error(`Failed to get user info: ${res.status}`);
}
const { username } = await res.json();
datadogRum.setUser({ id: username });
}
function initDDRum() {
datadogRum.init({
applicationId: '<application_id>',
clientToken: '<client_token>',
service: 'argocd',
traceSampleRate: 100,
telemetrySampleRate: 100,
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackUserInteractions: true,
})
setUser().catch(e => console.warn('Failed to set user:', e));
}
initDDRum();
we build it with webpack into a dist file that gets installed to argocd.
Summary
Similarly to #738 (Google analytics integration), it should be possible to enable dd rum tracking. Rum ID and client token should be specified in argocd-cm config map and accessible via API
Motivation
DataDog RUM is a useful analytics/insights alternative to Google Analytics, especially for platform teams that are less familiar with and may not have access to a GA account.
Proposal
Follow the same pattern as laid out in #1848