Package codes.grow.packages.skywalking
Class SkyWalkingTraceQueryClient
java.lang.Object
codes.grow.packages.skywalking.SkyWalkingTraceQueryClient
- All Implemented Interfaces:
TraceQueryClient
TraceQueryClient for SkyWalking (SPEC section 5) over OAP's two trace stores. OTLP spans
(what SkyWalkingTracing.initTracing(codes.grow.packages.skywalking.tracing.TracingConfig) sends) are stored in OAP's Zipkin model and read via
the Zipkin query API (:9412/zipkin, needs SW_QUERY_ZIPKIN); SkyWalking agent
segments are read via GraphQL. The backend comes from SkyWalkingConfig.traceBackend():
| method | zipkin | native | auto (default) |
|---|---|---|---|
| getTrace | Zipkin | GraphQL | hex id → Zipkin, then GraphQL; other ids → GraphQL |
| searchTraces | Zipkin | GraphQL queryTraces | Zipkin |
| listServices, listOperations | Zipkin | GraphQL | union of both |
| getDependencies | UnsupportedException | topology | topology |
Native traces keep their opaque ids (<hex>.<n>.<ms>); native span ids are
<segmentId>-<spanId> (see NativeSpan.toSpan()). OAP lower-cases OTLP span names (
GET /checkout → get /checkout). Obtain it from SkyWalkingClient.traces().
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefaultlimitofsearchTraces(codes.grow.packages.skywalking.tracing.query.TraceSearchQuery)(SPEC section 5). -
Method Summary
Modifier and TypeMethodDescriptionbackend()The configured backend.getDependencies(Instant start, Instant end) Service dependencies from the native topology of the window (default the last hour): parent = source service, child = target service,callCount0 (the topology carries no counts).getDependenciesAsync(Instant start, Instant end) One trace in the SPEC model.getTraceAsync(String traceId) AsynchronousTraceQueryClient.getTrace(java.lang.String); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).listOperations(String service) Operation names of a service, sorted and unique. zipkin:GET /api/v2/spans?serviceName=(lower-cased span names); native: the service's endpoints (at most 100); auto: the union.listOperationsAsync(String service) AsynchronousTraceQueryClient.listOperations(java.lang.String).Service names, sorted and unique. zipkin:GET /api/v2/services(OTLP senders); native: the normal services of GraphQLlistServices(agents and log senders); auto: the union.AsynchronousTraceQueryClient.listServices().searchTraces(TraceSearchQuery query) SPEC search.searchTracesAsync(TraceSearchQuery search) AsynchronousTraceQueryClient.searchTraces(codes.grow.packages.skywalking.tracing.query.TraceSearchQuery); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).waitForTrace(String traceId, WaitForTraceOptions options) waitForTraceAsync(String traceId, WaitForTraceOptions options) AsynchronousTraceQueryClient.waitForTrace(String, WaitForTraceOptions); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).withBackend(TraceBackend backend) Returns a client reading from another backend.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface codes.grow.packages.skywalking.tracing.query.TraceQueryClient
acceptsNativeIds, waitForTrace
-
Field Details
-
DEFAULT_SEARCH_LIMIT
public static final int DEFAULT_SEARCH_LIMITDefaultlimitofsearchTraces(codes.grow.packages.skywalking.tracing.query.TraceSearchQuery)(SPEC section 5).- See Also:
-
-
Method Details
-
backend
The configured backend.- Returns:
- the backend
-
withBackend
Returns a client reading from another backend.- Parameters:
backend- backend- Returns:
- a new client sharing this client's connections
-
getTrace
One trace in the SPEC model. Zipkin rejects non-hex ids withValidationException.- Specified by:
getTracein interfaceTraceQueryClient- Parameters:
traceId- hex (OTLP) or native trace id- Returns:
- the trace, or empty when it does not exist
-
getTraceAsync
Description copied from interface:TraceQueryClientAsynchronousTraceQueryClient.getTrace(java.lang.String); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).- Specified by:
getTraceAsyncin interfaceTraceQueryClient- Parameters:
traceId- trace id- Returns:
- future trace
-
searchTraces
SPEC search. Zipkin and auto:service→serviceName,operation→spanName(lower-cased like OAP stores names),tags→annotationQuery(k=v and …; keys must be inSW_ZIPKIN_SEARCHABLE_TAG_KEYS), durations in µs,endTs= end (default now),lookback= end − start when a start is set. Native:queryTraceswithoperationas endpoint name (needs a service), durations in ms, window default the last hour.- Specified by:
searchTracesin interfaceTraceQueryClient- Parameters:
query- search- Returns:
- trace summaries
-
searchTracesAsync
Description copied from interface:TraceQueryClientAsynchronousTraceQueryClient.searchTraces(codes.grow.packages.skywalking.tracing.query.TraceSearchQuery); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).- Specified by:
searchTracesAsyncin interfaceTraceQueryClient- Parameters:
search- filter- Returns:
- future summaries
-
listServices
Service names, sorted and unique. zipkin:GET /api/v2/services(OTLP senders); native: the normal services of GraphQLlistServices(agents and log senders); auto: the union. New services appear about 30–35 s after their first data (OAP flushes its name index periodically).- Specified by:
listServicesin interfaceTraceQueryClient- Returns:
- the names
-
listServicesAsync
Description copied from interface:TraceQueryClientAsynchronousTraceQueryClient.listServices().- Specified by:
listServicesAsyncin interfaceTraceQueryClient- Returns:
- future names
-
listOperations
Operation names of a service, sorted and unique. zipkin:GET /api/v2/spans?serviceName=(lower-cased span names); native: the service's endpoints (at most 100); auto: the union.- Specified by:
listOperationsin interfaceTraceQueryClient- Parameters:
service- service name- Returns:
- the names
-
listOperationsAsync
Description copied from interface:TraceQueryClientAsynchronousTraceQueryClient.listOperations(java.lang.String).- Specified by:
listOperationsAsyncin interfaceTraceQueryClient- Parameters:
service- service name- Returns:
- future names
-
getDependencies
Service dependencies from the native topology of the window (default the last hour): parent = source service, child = target service,callCount0 (the topology carries no counts). OAP 10.4 does not implement Zipkin/dependencies, so the zipkin backend throwsUnsupportedException; OTLP spans create no topology edges.- Specified by:
getDependenciesin interfaceTraceQueryClient- Parameters:
start- window start, or nullend- window end, or null- Returns:
- the links
-
getDependenciesAsync
Description copied from interface:TraceQueryClient- Specified by:
getDependenciesAsyncin interfaceTraceQueryClient- Parameters:
start- range start ornullend- range end ornull- Returns:
- future links
-
waitForTrace
PollsgetTrace(java.lang.String)until the trace hasminSpansspans (TimeoutExceptionotherwise). Native ids are used verbatim; hex ids are normalised.- Specified by:
waitForTracein interfaceTraceQueryClient- Parameters:
traceId- trace idoptions- timeout, interval and minimum span count- Returns:
- the trace
-
waitForTraceAsync
Description copied from interface:TraceQueryClientAsynchronousTraceQueryClient.waitForTrace(String, WaitForTraceOptions); runs with the caller's id policy (TraceQueryClient.acceptsNativeIds()).- Specified by:
waitForTraceAsyncin interfaceTraceQueryClient- Parameters:
traceId- trace idoptions- options- Returns:
- future trace
-