Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Resource tracking cannot be turned off #2143

Closed
cgood92 opened this issue Apr 6, 2023 · 3 comments · Fixed by #2493
Closed

🐛 Resource tracking cannot be turned off #2143

cgood92 opened this issue Apr 6, 2023 · 3 comments · Fixed by #2493
Labels
enhancement New feature or request

Comments

@cgood92
Copy link

cgood92 commented Apr 6, 2023

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:

  1. If you search for trackResources, you will see that it is not used directly in any logic or conditions, but it is mapped to resourceAllowed.
  2. If you search for resourceAllowed, I can see that it is only used in computeIndexingInfo to set discarded 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:

  1. 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).
  2. Instrumenting them ruins stack traces for no reason if we're not going to use DataDog.
@cgood92 cgood92 added the bug Something isn't working label Apr 6, 2023
@BenoitZugmeyer
Copy link
Member

Thank you for your report.

Could you tell me whether resources are showing up in the Datadog App?

I understand your concerns about resources sent to Datadog even if resources tracking is disabled. It works as designed: the resources should be droped when being processed by the backend. We'll see if we can improve this.

@cgood92
Copy link
Author

cgood92 commented Apr 6, 2023

Thank you for your report.

Could you tell me whether resources are showing up in the Datadog App?

I understand your concerns about resources sent to Datadog even if resources tracking is disabled. It works as designed: the resources should be droped when being processed by the backend. We'll see if we can improve this.

Thank you @BenoitZugmeyer. These resources are no longer showing up in the DataDog App.

As you pointed out, my concern is about the noisiness. On a single page load for my application, there are 69 network requests sent to DataDog reporting on resources. Very noisy. Plus, we have other instrumentation implementations too, and each time they send a request to report to their event hub DataDog then tries to report on those as well. So, very, very noisy.

The longer history is that we used to have resource tracking just working for us automatically. Then, it stopped a few months ago for no reason. Then, we passed along trackResources: true to get it back, and they started to come again.

Well, now we're trying to unwind that and NOT track resources. Way too noisy.

For now, I have implemented this in our beforeSend:

if (event.type === 'resource') {
  return false;
}

But, it would be nice if the flag was honored instead of having to do this. Plus, as mentioned, it would be nice if DataDog just didn't instrument things if we're asking it not to, because of the useless time it spends tracking timings and all of that jazz.

Thanks again for taking a look. We're heavy DataDog users.

@BenoitZugmeyer BenoitZugmeyer added enhancement New feature or request and removed bug Something isn't working need-info labels Apr 11, 2023
@BenoitZugmeyer
Copy link
Member

BenoitZugmeyer commented Nov 7, 2023

@cgood92 thank you again for your feedback. This issue has been fixed and being released in v5.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants