Closed
Description
Describe the bug
This is a problem with DataDog RUM.
While using @datadog/browser-rum-slim
, v4.30.0 and v4.38.0 (latest), I have this configuration:
const ddRumConfig = {
clientToken: 'SCRUBBED',
applicationId: 'SCRUBBED',
version: process.env.VERSION,
sampleRate: 100,
sessionReplaySampleRate: 0,
trackUserInteractions: false,
trackInteractions: false,
trackResources: false,
env: 'SCRUBBED',
};
<script src="datadog-v4.38.0" type="text/javascript"></script>
<script>
window.DD_RUM && DD_RUM.onReady(function() {
window.DD_RUM.init(ddRumConfig);
})
</script>
But, even with that, resources are still being tracked.
The expectation is that resources (ajax, css, js, etc) would not be tracked and sent to DataDog when the trackResources: false
is set in the configuration.
I cloned your repo, and began looking into the problem, and here are some of my notes:
- If you search for
trackResources
, you will see that it is not used directly in any logic or conditions, but it is mapped toresourceAllowed
. - If you search for
resourceAllowed
, I can see that it is only used incomputeIndexingInfo
to setdiscarded
as true. But, that doesn't stop the request from going through.
So, it looks to me as though the setting trackResources
is not actually doing anything.
In addition to that, I think if someone sets trackResources
to be false
, that you should never run startResourceCollection
or startRequestCollection
, because:
- If we're not going to track these resources in DataDog, then don't spend cycles instrumenting and tracking them (this just slows down our system).
- Instrumenting them ruins stack traces for no reason if we're not going to use DataDog.