How do I stop sending APM traces and logs to Datadog and only send them to Middleware, when I have both of the agents installed(i.e. middleware apm and datadog apm)?

If you want to stop sending APM traces and logs to Datadog, you can change the api_key (or environment variable DD_API_KEY) in the /etc/datadog/datadog.yaml file to something invalid.

Here’s how:

  1. Open the Configuration File: Use a text editor with appropriate permissions:

    sudo nano /etc/datadog/datadog.yaml
    
  2. Change the API Key: Set the api_key to an invalid value:

    api_key: usingmiddleware
    
  3. Set an Invalid Site: Change the site to an invalid value:

    site: example.com
    
  4. Important: Do not comment out the api_key or set it to an empty value, as the agent requires a valid key to function.

  5. Save Changes: Save the file and exit the editor.

  6. Restart the Agent: Apply the changes by restarting the Datadog Agent:

    sudo systemctl restart datadog-agent
    

By following these steps, you will effectively stop the Datadog Agent from sending APM traces and logs, only Middleware Agent will work on and you can see the data in dashboard.

Refer this document for more details : Installing the Datadog Agent in Middleware (Dual Shipping)