Project: SkyWalking (Observability and Analysis / Observability)
File: query-protocol-deprecated.md

The following query services are deprecated since 9.5.0. All these queries are still available for the short term to keep compatibility. Query protocol official repository, https://github.com/apache/skywalking-query-protocol. Metadata contains concise information on all services and their instances, endpoints, etc. under monitoring. You may query the metadata in different ways. V1 APIs were introduced since 6.x. Now they are a shell to V2 APIs since 9.0.0. ```graphql extend type Query { getAllServices(duration: Duration!, group: String): [Service!]! searchServices(duration: Duration!, keyword: String!): [Service!]! searchService(serviceCode: String!): Service getAllBrowserServices(duration: Duration!): [Service!]! searchBrowserServices(duration: Duration!, keyword: String!): [Service!]! searchBrowserService(serviceCode: String!): Service getServiceInstances(duration: Duration!, serviceId: ID!): [ServiceInstance!]! searchEndpoint(keyword: String!, serviceId: ID!, limit: Int!): [Endpoint!]! getAllDatabases(duration: Duration!): [Database!]! } ``` Metrics query targets all objects defined in and . You may obtain the metrics data in linear or thermodynamic matrix formats based on the aggregation functions in script. Provide Metrics V2 query APIs since 8.0.0, including metadata, single/multiple values, heatmap, and sampled records metrics. ```graphql extend type Query { readMetricsValue(condition: MetricsCondition!, duration: Duration!): Long! readNullableMetricsValue(condition: MetricsCondition!, duration: Duration!): NullableValue! readMetricsValues(condition: MetricsCondition!, duration: Duration!): MetricsValues! sortMetrics(condition: TopNCondition!, duration: Duration!): [SelectedRecord!]! readLabeledMetricsValues(condition: MetricsCondition!, labels: [String!]!, duration: Duration!): [MetricsValues!]! readHeatMap(condition: MetricsCondition!, duration: Duration!): HeatMap readSampledRecords(condition: TopNCondition!, duration: Duration!): [SelectedRecord!]! } ``` 3 types of metrics can be queried. V1 APIs were introduced since 6.x. Now they are a shell to V2 APIs. Single value. Most default metrics are in single value. `getValues` and `getLinearIntValues` are suitable for this purpose. Multiple value. A metric defined in OAL includes multiple value calculations. Use `getMultipleLinearIntValues` to obtain all values. `percentile` is a typical multiple value function in OAL. Heatmap value. Read for details. `thermodynamic` is the only OAL function. Use `getThermodynamic` to get the values. ```graphql extend type Query { getValues(metric: BatchMetricConditions!, duration: Duration!): IntValues getLinearIntValues(metric: MetricCondition!, duration: Duration!): IntValues getMultipleLinearIntValues(metric: MetricCondition!, numOfLinear: Int!, duration: Duration!): [IntValues!]! getThermodynamic(metric: MetricCondition!, duration: Duration!): Thermodynamic } ``` Aggregation query means that the metrics data need a secondary aggregation at query stage, which causes the query interfaces to have some different arguments. A typical example of aggregation query is the `TopN` list of services. Metrics stream aggregation simply calculates the metrics values of each service, but the expected list requires ordering metrics data by their values. Aggregation query is for single value metrics only. ```graphql extend type Query { getServiceTopN(name: String!, topN: Int!, duration: Duration!, order: Order!): [TopNEntity!]! getAllServiceInstanceTopN(name: String!, topN: Int!, duration: Duration!, order: Order!): [TopNEntity!]! getServiceInstanceTopN(serviceId: ID!, name: String!, topN: Int!, duration: Duration!, order: Order!): [TopNEntity!]! getAllEndpointTopN(name: String!, topN: Int!, duration: Duration!, order: Order!): [TopNEntity!]! getEndpointTopN(serviceId: ID!, name: String!, topN: Int!, duration: Duration!, order: Order!): [TopNEntity!]! } ``` Record is a general and abstract type for collected raw data. In the observability, traces and logs have specific and well-defined meanings, meanwhile, the general records represent other collected records. Such as sampled slow SQL statement, HTTP request raw data(request/response header/body) ```graphql extend type Query { readRecords(condition: RecordCondition!, duration: Duration!): [Record!]! } ```