This is the early access documentation preview for Custom Views. This documentation might not be in sync with our official documentation.

Dynatrace

Monitor and observe your SDK with Dynatrace.

Dynatrace provides real-time monitoring of user interactions, backend services, and infrastructure. Dynatrace supports various environments including cloud, on-premise, and hybrid setups.

Java SDK

Prerequisites

  • Version 17.3 (or later) of the Java SDK

Dynatrace OneAgent

To monitor your application using Dynatrace OneAgent, there is no need to change the SDK.

Follow the steps to install the OneAgent on your host and configure it to monitor your application.

To test an application with Java SDK and OneAgent, you can use the provided example application.

Dynatrace OpenTelemetry

To monitor your application using OpenTelemetry, follow the steps for Java in Monitor using OpenTelemetry.

TypeScript SDK

Prerequisites

Include the monitoring package in your SDK

Create a oneagent-tracer.js file in your project to capture and send request and response data to Dynatrace using opentelemetry traces and metrics. You can find a sample oneagent-tracer.js file here.

This file uses environment variables that you need to set up according to your commercetools and Dynatrace configurations. Check our example environment file for guidance.

A oneagent-metric.js module, which exposes metric tracking functions, can also be used to record specific function values or object properties.

To integrate Dynatrace into your project, use the @commercetools/ts-sdk-apm package with withTelemetryMiddleware() method in your SDK client setup. The following code demonstrates how to implement this middleware in your SDK client.

// Import the @commercetools/ts-sdk-apm package
import { createTelemetryMiddleware } from '@commercetools/ts-sdk-apm'
import { ClientBuilder } from '@commercetools/sdk-client-v2'
// Configure the telemetry options
const telemetryOptions = {
tracer: () => require('./path/to/oneagent-tracer.js'),
userAgent: 'typescript-sdk-middleware-dynatrace',
createTelemetryMiddleware
}
// Create the client with the withTelemetryMiddleware() middleware
const client = new ClientBuilder()
.withClientCredentialsFlow(...)
.withHttpMiddleware(...)
.withTelemetryMiddleware(telemetryOptions) // telemetry middleware
...
.build()

For an example of integrating Dynatrace with the TypeScript SDK, refer to the Dynatrace Express example application.

Using the Dynatrace dashboard

You can now send requests in your application to commercetools Composable Commerce through the SDK and monitor the reported data on the Dynatrace visual dashboard.

For more information on using Dynatrace dashboards, consult Use dashboards and other Dynatrace documentation.