Package codes.grow.packages.skywalking
Class SkyWalkingQueryClient
java.lang.Object
codes.grow.packages.skywalking.SkyWalkingQueryClient
The SkyWalking GraphQL query API (
POST /graphql on port 12800): services, endpoints,
instances, native traces, logs, topology and raw GraphQL. Obtain it from SkyWalkingClient.query(). Services, instances and endpoints are given by name; the SDK derives
the ids (SkyWalkingIds).
Every method has a blocking form and an …Async form returning CompletableFuture. Errors: HTTP 400 and resolver errors → ValidationException, an
UnsupportedOperationException on the server → UnsupportedException, other statuses per
SPEC section 2.1. Thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of endpointslistEndpoints(java.lang.String)returns. -
Method Summary
Modifier and TypeMethodDescriptionServer features (hasQueryTracesV2Support,supportQueryLogsByKeywords), probed once and cached.Asynchronouscapabilities().findService(String name) One service by name (findService).findServiceAsync(String name) AsynchronousfindService(String).One native trace (queryTrace(traceId)); the id is kept verbatim.getTraceAsync(String traceId) AsynchronousgetTrace(String).Raw GraphQL without variables.Raw GraphQL: returnsdataanderrors(partial data possible).graphqlAsync(String query, Map<String, ?> variables) Asynchronousgraphql(String, Map).listEndpoints(String service) Every endpoint of a service (at most 100).listEndpoints(String service, String keyword) Endpoints of a service matching a keyword (at most 100).listEndpoints(String service, String keyword, int limit) Endpoints of a service (findEndpoint(keyword, serviceId, limit)).listEndpointsAsync(String service, String keyword, int limit) AsynchronouslistEndpoints(String, String, int).listInstances(String service) Instances of a service active in the last hour.listInstances(String service, TimeRange range) Instances of a service active inrange(listInstances).listInstancesAsync(String service, TimeRange range) AsynchronouslistInstances(String, TimeRange).Log tag keys seen in the last hour (queryLogTagAutocompleteKeys), sorted.listLogTagKeys(TimeRange range) Log tag keys seen inrange(queryLogTagAutocompleteKeys), sorted.listLogTagKeysAsync(TimeRange range) AsynchronouslistLogTagKeys(TimeRange).Every service of every layer.listServices(String layer) Services of one layer (listServices(layer)).listServices(String layer, TimeRange range) Services (listServices(layer)).listServicesAsync(String layer, TimeRange range) AsynchronouslistServices(String, TimeRange).queryLogs(QueryLogsOptions options) Logs (queryLogs(condition)).queryLogsAsync(QueryLogsOptions options) AsynchronousqueryLogs(QueryLogsOptions).queryTraces(QueryTracesOptions options) Native traces (queryTraces(condition), whole traces).queryTracesAsync(QueryTracesOptions options) AsynchronousqueryTraces(QueryTracesOptions).timeInfo()OAP clock and time zone (getTimeInfo); caches the time zone for query windows.AsynchronoustimeInfo().topology()The global service topology of the last hour.The global service topology ofrange.topology(TimeRange range, TopologyOptions options) Service topology (getGlobalTopology(duration, layer), orgetServiceTopologywhenTopologyOptions.service()is set).topologyAsync(TimeRange range, TopologyOptions options) Asynchronoustopology(TimeRange, TopologyOptions).
-
Field Details
-
DEFAULT_ENDPOINT_LIMIT
public static final int DEFAULT_ENDPOINT_LIMITDefault number of endpointslistEndpoints(java.lang.String)returns.- See Also:
-
-
Method Details
-
graphql
Raw GraphQL: returnsdataanderrors(partial data possible). HTTP 400 (syntax or validation errors) throwsValidationException.- Parameters:
query- GraphQL documentvariables- variables (may be null)- Returns:
- the response
-
graphql
Raw GraphQL without variables.- Parameters:
query- GraphQL document- Returns:
- the response
-
graphqlAsync
Asynchronousgraphql(String, Map).- Parameters:
query- GraphQL documentvariables- variables (may be null)- Returns:
- a future with the response
-
timeInfo
OAP clock and time zone (getTimeInfo); caches the time zone for query windows.- Returns:
- the time info
-
timeInfoAsync
AsynchronoustimeInfo().- Returns:
- a future with the time info
-
capabilities
Server features (hasQueryTracesV2Support,supportQueryLogsByKeywords), probed once and cached.- Returns:
- the capabilities
-
capabilitiesAsync
Asynchronouscapabilities().- Returns:
- a future with the capabilities
-
listServices
Every service of every layer.- Returns:
- the services
-
listServices
Services of one layer (listServices(layer)).- Parameters:
layer- layer such asGENERAL; null = all layers; an unknown layer gives[]- Returns:
- the services
-
listServices
Services (listServices(layer)). OAP has no time filter for services, sorangeis accepted for API symmetry and ignored. Services that only sent OTLP traces are not listed (useSkyWalkingTraceQueryClient.listServices()); new services appear about 30 s after their first data.- Parameters:
layer- layer, or null for all layersrange- ignored- Returns:
- the services
-
listServicesAsync
AsynchronouslistServices(String, TimeRange).- Parameters:
layer- layer, or null for all layersrange- ignored- Returns:
- a future with the services
-
findService
One service by name (findService).- Parameters:
name- service name- Returns:
- the service, or empty when OAP does not know it
-
findServiceAsync
AsynchronousfindService(String).- Parameters:
name- service name- Returns:
- a future with the service, or empty
-
listEndpoints
Every endpoint of a service (at most 100).- Parameters:
service- service name- Returns:
- the endpoints
-
listEndpoints
Endpoints of a service matching a keyword (at most 100).- Parameters:
service- service namekeyword- keyword or null- Returns:
- the endpoints
-
listEndpoints
Endpoints of a service (findEndpoint(keyword, serviceId, limit)).keywordis OAP's token match, not a substring match:downstreamfinds/native/downstream,downdoes not; null or empty lists all. No duration is sent (OAP 10.4 + BanyanDB returns nothing with one). Only native services have endpoints; OTLP spans create none.- Parameters:
service- service namekeyword- keyword or nulllimit- maximum number of endpoints (positive)- Returns:
- the endpoints
-
listEndpointsAsync
public CompletableFuture<List<SkyWalkingEndpoint>> listEndpointsAsync(String service, String keyword, int limit) AsynchronouslistEndpoints(String, String, int).- Parameters:
service- service namekeyword- keyword or nulllimit- maximum number of endpoints- Returns:
- a future with the endpoints
-
listInstances
Instances of a service active in the last hour.- Parameters:
service- service name- Returns:
- the instances
-
listInstances
Instances of a service active inrange(listInstances).- Parameters:
service- service namerange- window, or null for the last hour- Returns:
- the instances
-
listInstancesAsync
public CompletableFuture<List<SkyWalkingInstance>> listInstancesAsync(String service, TimeRange range) AsynchronouslistInstances(String, TimeRange).- Parameters:
service- service namerange- window, or null for the last hour- Returns:
- a future with the instances
-
queryTraces
Native traces (queryTraces(condition), whole traces). Durations in ms; tags must be searchable keys. Traces sent over OTLP are not stored here (useSkyWalkingClient.traces()with the zipkin backend). The legacyqueryBasicTracesis not used (unsupported on BanyanDB).- Parameters:
options- filter- Returns:
- one page of traces
-
queryTracesAsync
AsynchronousqueryTraces(QueryTracesOptions).- Parameters:
options- filter- Returns:
- a future with one page of traces
-
getTrace
One native trace (queryTrace(traceId)); the id is kept verbatim.- Parameters:
traceId- native trace id- Returns:
- the trace, or empty when unknown (OTLP trace ids are never native)
-
getTraceAsync
AsynchronousgetTrace(String).- Parameters:
traceId- native trace id- Returns:
- a future with the trace, or empty
-
queryLogs
Logs (queryLogs(condition)). Either a window (default the last hour) or a trace id is sent; seeQueryLogsOptions.keywords()for keyword handling on BanyanDB.- Parameters:
options- filter- Returns:
- one page of logs
-
queryLogsAsync
AsynchronousqueryLogs(QueryLogsOptions).- Parameters:
options- filter- Returns:
- a future with one page of logs
-
listLogTagKeys
Log tag keys seen in the last hour (queryLogTagAutocompleteKeys), sorted.- Returns:
- the keys
-
listLogTagKeys
Log tag keys seen inrange(queryLogTagAutocompleteKeys), sorted.- Parameters:
range- window, or null for the last hour- Returns:
- the keys
-
listLogTagKeysAsync
AsynchronouslistLogTagKeys(TimeRange).- Parameters:
range- window, or null for the last hour- Returns:
- a future with the keys
-
topology
The global service topology of the last hour.- Returns:
- the topology
-
topology
The global service topology ofrange.- Parameters:
range- window, or null for the last hour- Returns:
- the topology
-
topology
Service topology (getGlobalTopology(duration, layer), orgetServiceTopologywhenTopologyOptions.service()is set). Native traffic only (OTLP spans create no edges); includes the virtualUsernode.- Parameters:
range- window, or null for the last houroptions- service or layer filter- Returns:
- the topology
- Throws:
SkyWalkingException- on failure
-
topologyAsync
Asynchronoustopology(TimeRange, TopologyOptions).- Parameters:
range- window, or null for the last houroptions- service or layer filter- Returns:
- a future with the topology
-