Class DatadogSpansQuery

java.lang.Object
codes.grow.packages.datadogapm.DatadogSpansQuery
All Implemented Interfaces:
TraceQueryClient, AutoCloseable

public final class DatadogSpansQuery extends Object implements TraceQueryClient, AutoCloseable
The Datadog spans query client: the SaaS API at https://api.<site> with the headers DD-API-KEY and DD-APPLICATION-KEY (the application key needs apm_read). It implements TraceQueryClient on top of the spans search and aggregate APIs, plus the Datadog-specific searchSpans(codes.grow.packages.datadogapm.SearchSpansOptions), aggregateSpans(java.util.List<codes.grow.packages.datadogapm.SpanCompute>, java.util.List<codes.grow.packages.datadogapm.SpanGroupBy>) and ping(). Thread-safe. No container can serve these endpoints, so they are unit-tested against Datadog's documented examples and verified by the live sandbox job (API.md section 4).

Errors: 400/413/422 VALIDATION, 401 AUTHENTICATION, 403 PERMISSION_DENIED (AUTHENTICATION from ping()), 404 NOT_FOUND, 408 TIMEOUT, 429 RATE_LIMITED (waits Retry-After / X-RateLimit-Reset within the retry budget), 5xx UNAVAILABLE.


 try (DatadogSpansQuery q = DatadogSpansQuery.fromEnv()) {
   for (DatadogSpan s : q.searchSpans(SearchSpansOptions.builder().query("service:checkout").build())) {
     System.out.println(s.span().name());
   }
 }