Class DatadogMiddleware
java.lang.Object
com.commercetools.monitoring.datadog.statsd.DatadogMiddleware
- All Implemented Interfaces:
Middleware
,TelemetryMiddleware
The DatadogTelemetry middleware can be used to report outgoing request to commercetools to Datadog.
This middleware uses Datadog StatsD protocol to submit telemetry data.
It can be registered as TelemetryMiddleware to the ClientBuilder
or the ApiRootBuilder.
ApiHttpClient client = ApiRootBuilder.of() .defaultClient(ServiceRegion.GCP_EUROPE_WEST1.getApiUrl()) .withTelemetryMiddleware(new DatadogMiddleware(new NonBlockingStatsDClientBuilder().build())) .buildClient();
See the test code.
- commercetools.client.duration: The duration of the request in milliseconds
- commercetools.client.total_requests: The total number of requests
- commercetools.client.error_requests: The total number of requests with a status code greater or equal to 400
The metrics are enriched with the response status code, server address, port and request method.
See also the Spring MVC example application in the examples folder for further details.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<ApiHttpResponse<byte[]>>
invoke
(ApiHttpRequest request, Function<ApiHttpRequest, CompletableFuture<ApiHttpResponse<byte[]>>> next)
-
Constructor Details
-
DatadogMiddleware
public DatadogMiddleware(com.timgroup.statsd.StatsDClient datadogStatsDClient)
-
-
Method Details
-
invoke
public CompletableFuture<ApiHttpResponse<byte[]>> invoke(ApiHttpRequest request, Function<ApiHttpRequest, CompletableFuture<ApiHttpResponse<byte[]>>> next) - Specified by:
invoke
in interfaceMiddleware
-