Skip to content

DQL Data Query



POST /api/v1/df/query_data_v1

Overview

DQL Data Query

Body Request Parameters

Parameter Name Type Required Description
queries array Multiple command queries, consisting of a list of query objects
Allow empty: False
fieldTagDescNeeded boolean Whether field or tag description information is needed
Allow empty: False

Parameter Supplementary Description

Query Description


  1. Parameter Description
Parameter Name Type Required Description
queries array Y Multiple command queries, consisting of a list of query objects
fieldTagDescNeeded boolean Whether field or tag description information is needed
  1. queries[*] Member Parameter Structure Description
Parameter Name Type Required Description
qtype string Y Type of query statement
dql: indicates dql type query statement;
promql: indicates PromQl type query statement
query json Y Query structure
query.q string Query statement consistent with qtype, such as dql or promql query statement
query.ignore_cache boolean Whether to disable cache for query, default is false, indicating use of cache
query.promqlType enum Effective when qtype=promql, type of promql query, optional values instantQuery and rangeQuery, default is rangeQuery
query.highlight boolean Whether to display highlighted data
query.timeRange array Timestamp list for time range
query.disableMultipleField bool Whether to enable single-column mode, default is true
query.showLabel bool Whether to display object labels, default is none
query.funcList array Aggregation modifiers for dql return values, note invalid when disableMultipleField=Flse
query.slimit integer Time series group size, only effective for metric queries
query.soffset integer Time series group offset
query.limit integer Pagination size
query.offset integer Pagination offset
query.orderby array Sorting list, {fieldName:method}, note metric query sorting only supports fieldName=time; method in ["desc", "asc"]; note metric query sorting only supports fieldName=time
query.sorderby array Sorting list, sorderby column is an expression, supports all aggregation functions returning single value min max last avg p90 p95 count, {fieldName:method}, structure consistent with orderby
query.order_by array Sorting list, structure is [{"column": "field", "order": "DESC"}], doris engine compatible field
query.sorder_by array Sorting list, structure is [{"column": "field", "order": "DESC"}], doris engine compatible field
query.density string Response point density, priority less than autoDensity and greater than density set in dql statement
query.interval integer Unit is seconds, time slice interval, used to calculate response points; calculated points less than or equal to points when density=high, then effective, otherwise invalid
query.search_after array Pagination query marker. Use the search_after value from the last request response result with the same parameters as the parameter for this request.
query.maxPointCount integer Maximum points
query.workspaceUUID string UUID of the workspace to query, "*" means query all authorized spaces, refer to interface /wksp_share/granted_ws_list for space reference
query.workspaceUUIDs array UUIDs of the workspaces to query, priority higher than query.workspaceUUID. ["*"] means query all authorized spaces, refer to interface /wksp_share/granted_ws_list for space reference
query.targetRegion string When specified query workspace is ["*"], this field is required
query.output_format string lineprotocol: line protocol output, default is unchanged output format
query.cursor_time integer Segmented query threshold: for the first segmented query, set cursor_time to end_time; for subsequent segmented queries, set cursor_time to next_cursor_time in the response
query.cursor_token string Pagination query token (returned by engine cursor_token value): for pagination query, set the next_cursor_token returned from the last query to the cursor_token of this query; requests without cursor_token may cause data with the same timestamp to be skipped during pagination.
query.disable_sampling bool Sampling disable switch, default is false
  1. Response Point Density density Parameter Value Description
Optional Value Description
lower Low, 60 points
low Low, 180 points
medium Medium, 360 points
high High, 720 points
  • Note the priority of point density parameters, maximum density density[high] * maxPointCount > interval > density > control parameters in dql statement

  • Common Query Description

  • Unrecovered Event Query

    Note: When using openapi interface for data query, default is admin role. Note that it may be subject to data access rule restrictions

Request Example

curl 'https://openapi.guance.com/api/v1/df/query_data_v1' \
-H 'Content-Type: application/json' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-raw $'{"queries":[{"qtype":"dql","query":{"q":"M::`cpu`:(avg(`usage_idle`))","_funcList":[],"funcList":[],"maxPointCount":720,"interval":10,"align_time":true,"sorder_by":[{"column":"`#1`","order":"DESC"}],"slimit":20,"disable_sampling":false,"timeRange":[1708911106000,1708912906999],"tz":"Asia/Shanghai"}}]}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "data": [
            {
                "async_id": "",
                "column_names": [
                    "avg(usage_idle)"
                ],
                "complete": false,
                "cost": "14.815745ms",
                "index_name": "",
                "index_names": "",
                "index_store_type": "",
                "interval": 10000,
                "is_running": false,
                "max_point": 181,
                "next_cursor_time": -1,
                "points": null,
                "query_parse": {
                    "fields": {
                        "avg(usage_idle)": "usage_idle"
                    },
                    "funcs": {
                        "avg(usage_idle)": [
                            "avg"
                        ]
                    },
                    "namespace": "metric",
                    "sources": {
                        "cpu": "exact"
                    }
                },
                "query_type": "example_db",
                "sample": 1,
                "scan_completed": false,
                "scan_index": "",
                "series": [
                    {
                        "columns": [
                            "time",
                            "avg(usage_idle)"
                        ],
                        "name": "cpu",
                        "units": [
                            null,
                            null
                        ],
                        "values": [
                            [
                                1708912900000,
                                75.68748278863335
                            ],
                            [
                                1708912890000,
                                80.20737341208
                            ],
                            [
                                1708912880000,
                                73.23943236630001
                            ],
                            [
                                1708912870000,
                                71.08465385756001
                            ],
                            [
                                1708912860000,
                                75.12657005472002
                            ],
                            [
                                1708912850000,
                                84.19848645072001
                            ],
                            [
                                1708912840000,
                                81.59161169702
                            ],
                            [
                                1708912830000,
                                77.14274451154
                            ]
                        ]
                    }
                ],
                "window": 10000
            }
        ],
        "declaration": {
            "b": [
                "asfawfgajfasfafgafwba",
                "asfgahjfaf"
            ],
            "business": "aaa",
            "organization": "6540c09e4243b300077a9675"
        }
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "10888927517520616916"
} 

Feedback

Is this page helpful? ×