Last active
February 25, 2025 13:33
-
-
Save danifitz/a260944cbc6f9745372b34378d7c478d to your computer and use it in GitHub Desktop.
rum-detector.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const RUM_DETECTORS = [ | |
{ | |
name: "Grafana Faro", | |
check: () => !!window.Faro || !!window.faro, | |
urls: ["faro.grafana.net"] | |
}, | |
{ | |
name: "Datadog RUM", | |
check: () => !!window.DD_RUM || !!window.DD_LOGS, | |
urls: ["datadoghq.com", "browser-intake-datadoghq.com"] | |
}, | |
{ | |
name: "New Relic Browser", | |
check: () => !!window.NREUM || !!window.NRBA, | |
urls: ["bam.nr-data.net"] | |
}, | |
{ | |
name: "Coralogix Agent", | |
check: () => !!window.CoralogixLogger || !!window.coralogix || !!window.CoralogixRum, | |
urls: ["api.coralogix.com"] | |
}, | |
{ | |
name: "AppDynamics", | |
check: () => !!window.ADRUM || !!window.appdynamics, | |
urls: ["col.eum-appdynamics.com"] | |
}, | |
{ | |
name: "Elastic APM", | |
check: () => !!window.elasticApm, | |
urls: ["apm.elastic.co"] | |
}, | |
{ | |
name: "Splunk RUM", | |
check: () => !!window.splunkRum, | |
urls: ["rum-ingest.splunk.com"] | |
}, | |
{ | |
name: "Dynatrace", | |
check: () => !!window.dT || !!window.dynatrace, | |
urls: ["bf.dynatrace.com", "*.live.dynatrace.com"] | |
} | |
]; | |
const detectedSDKs = RUM_DETECTORS.filter(sdk => sdk.check()).map(sdk => sdk.name); | |
if (detectedSDKs.length > 0) { | |
console.warn("Detected RUM SDKs:", detectedSDKs); | |
} else { | |
console.log("No known RUM SDKs detected."); | |
} | |
function monitorNetworkRequests() { | |
const originalOpen = XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function (method, url) { | |
RUM_DETECTORS.forEach(sdk => { | |
if (sdk.urls.some(domain => url.includes(domain))) { | |
console.warn(`Potential ${sdk.name} network request detected:`, url); | |
} | |
}); | |
return originalOpen.apply(this, arguments); | |
}; | |
} | |
monitorNetworkRequests(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment