This is the early access documentation preview for Custom Views. This documentation might not be in sync with our official documentation.
Datadog
Monitor and observe your SDK with Datadog.
Datadog supports different languages, frameworks, and platforms to retrieve metrics and traces.
Java SDK
Prerequisites
- Version 17.6 (or later) of the Java SDK
- Active Datadog account with an API key
Include the Datadog middleware in the Java SDK
The Java SDK integrates with Datadog through the commercetools-monitoring-datadog module.
After adding commercetools-monitoring-datadog
as a dependency in your application, add the Datadog middleware and serializer to your SDK using the .withTelemetryMiddleware()
and withSerializer()
methods.
ApiHttpClient apiHttpClient = ApiRootBuilder.of().defaultClient(ServiceRegion.GCP_EUROPE_WEST1.getApiUrl()).withTelemetryMiddleware(new DatadogMiddleware(ApiClient.getDefaultApiClient())).withSerializer(new DatadogResponseSerializer(ResponseSerializer.of(),ApiClient.getDefaultApiClient())).buildClient();
The commercetools-monitoring-datadog
module includes telemetry middleware for monitoring request execution and response times, alongside counters for requests and errors.
In addition, the DatadogResponseSerializer
tracks the time taken to serialize and deserialize JSON payloads.
For an example of integrating Datadog with the Java SDK, refer to the Spring Boot Datadog example application.