OpenTelemetry with Salesforce - is it working with Dynatrace?

@Slawa , if you are not going to purchase the available plugins, then your options are limited.

you’re not really providing much about what you have in Sales Force, so here’s a generic answer.
 
Only relevant if you have custom apps.
You can use Apex to create custom HTTP callouts to send traces or custom events to Dynatrace.

This will involve:
Creating a HTTP Callout to Dynatrace by using Apex to make a HTTP callout to the Dynatrace API endpoint.
you’ll need an apex class sort of like the below.

public class DynatraceIntegration {

    // The endpoint for Dynatrace custom events API
    private static final String DYNATRACE_API_URL = 'https://{environmentid}.live.dynatrace.com/api/v1/events';
    private static final String DYNATRACE_API_TOKEN = 'YOUR_DYNATRACE_API_TOKEN';

    public static void sendCustomEvent(String eventName, String eventDetails) {
        // Prepare the request headers
        Map<String, String> headers = new Map<String, String>();
        headers.put('Authorization', 'Api-Token ' + DYNATRACE_API_TOKEN);
        headers.put('Content-Type', 'application/json');

        // Prepare the request body
        String body = '{"eventType":"CUSTOM","title":"' + eventName + '","description":"' + eventDetails + '","source":"Salesforce Apex","customProperties":{"salesforceEvent":"true"}}';

        // Send the HTTP request to Dynatrace
        HttpRequest req = new HttpRequest();
        req.setEndpoint(DYNATRACE_API_URL);
        req.setMethod('POST');
        req.setHeaders(headers);
        req.setBody(body);

        Http http = new Http();
        HttpResponse res = http.send(req);

        // Log the response
        System.debug('Dynatrace Response: ' + res.getBody());
    }
}

You can then trigger this class when specific events occur in your Salesforce environment.

// Trigger this in your Apex logic when an event occurs
DynatraceIntegration.sendCustomEvent('Record Updated', 'Salesforce record has been updated successfully.');

If you don’t have a custom App, then the only other option is to us the SF API to get events into Dynatrace.
This will involve you creating a custom integration:  Dynatrace Extensions Python SDK — Dynatrace Docs
based on your own version of: Salesforce Extension monitoring & observability | Dynatrace Hub

This will allow you go get events based on API calls, user actions, or login events. You would need to host this on a local Active Gate and pull the data.

The RUM components, you can just rip off the extension steps.

Anyway, have fun building your own solution.

1 Like