skywalking es查询语句整理
查找特定时间范围内,与特定服务相关的service_relation_server_side指标
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "bool": { "should": [ { "term": { "source_service_id": { "value": "c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } }, { "term": { "dest_service_id": { "value": c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_server_side", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1000, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "component_ids": { "terms": { "field": "component_ids", "size": 10, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" } } } } } } |
对特定时间范围内的服务间关系数据进行聚合分析
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "bool": { "should": [ { "term": { "source_service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } }, { "term": { "dest_service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_client_side", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1000, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "component_ids": { "terms": { "field": "component_ids", "size": 10, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" } } } } } } |
检索record_table
为profile_task
的文档
{ "size": 200, "query": { "bool": { "must": [ { "term": { "record_table": { "value": "profile_task", "boost": 1.0 } } }, { "range": { "time_bucket": { "from": 202411221137, "to": null, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "range": { "time_bucket": { "from": null, "to": 202411221147, "include_lower": true, "include_upper": true, "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "start_time": { "order": "desc" } } ] } |
检索metric_table
为network_address_alias
的文档
{ "size": 5000, "query": { "bool": { "must": [ { "term": { "metric_table": { "value": "network_address_alias", "boost": 1.0 } } }, { "range": { "last_update_time_bucket": { "from": 202411221132, "to": null, "include_lower": true, "include_upper": true, "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } } } |
检索metric_table
为events
且service
为service::tendata-contact-service
的文档
{ "from": 0, "size": 20, "query": { "bool": { "must": [ { "term": { "metric_table": { "value": "events", "boost": 1.0 } } }, { "term": { "service": { "value": "service::tendata-contact-service", "boost": 1.0 } } }, { "range": { "start_time": { "from": 1732245120000, "to": null, "include_lower": false, "include_upper": true, "boost": 1.0 } } }, { "range": { "end_time": { "from": null, "to": 1732246980000, "include_lower": true, "include_upper": false, "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "start_time": { "order": "desc" } } ] } |
{ "size": 1, "query": { "ids": { "values": [ "service_traffic_MTkyLjE2OC4xMS4xMDo1Njcy.15" ], "boost": 1.0 } } } |
{ "size": 12, "query": { "ids": { "values": [ "tag_autocomplete_20241122_TRACE_db.instance_[im_moldova-2024, im_moldova-2022, im_moldova-2023, im_moldova-2021]", "tag_autocomplete_20241122_TRACE_mq.queue_dcs.task-extract-data.route", "tag_autocomplete_20241122_TRACE_db.instance_[im_maritime_silk_bol-2022, im_maritime_silk_bol-2023, im_maritime_silk_bol-2021, im_maritime_silk_bol-2024]" ], "boost": 1.0 } } } |
{ "size": 156, "query": { "ids": { "values": [ "endpoint_traffic_c2VydmljZTo6dGVuZGF0YS1nYXRld2F5LXNlcnZpY2U=.1_L2luc2lnaHQtc2VhcmNoL3YxL3Byb2dyYW1tZXMvMjkyNTcvbWFya2V0LWNvdW50ZXJwYXJ0eS1hcmVh", "endpoint_traffic_c2VydmljZTo6dGVuZGF0YS1nYXRld2F5LXNlcnZpY2U=.1_L2luc2lnaHQvdjEvYWRtaW4vcHJvZ3JhbW1lcw==", "endpoint_traffic_c2VydmljZTo6dGVuZGF0YS10aGlyZC1wYXJ0eS1zZXJ2aWNl.1_UE9TVDovdXNlcnMvNjA5NjMvcHJveHk=", "endpoint_traffic_c2VydmljZTo6dGVuZGF0YS1nYXRld2F5LXNlcnZpY2U=.1_L2NvcnAvdjIvY29tcGFuaWVzLzEwYzdkMWVjYTY4NTE0NDQ1NzQ5OWVkZTJkZTQxY2I1L3JlZnJlc2gvcmVzdWx0" ], "boost": 1.0 } } } |
{ "from": 0, "size": 15, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 20241122111200, "to": 20241122114259, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "term": { "service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1tZXNzYWdlLXNlcnZpY2U=.1", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "timestamp": { "order": "desc" } } ] } |
检索record_table
为span_attached_event_record
,related_trace_id
为ab80cf2b85fa4f3e9baabd114f3b909e.98.17322469467401053
,且trace_ref_type
为0的文档。查询结果将按照start_time_second
和start_time_nanos
字段进行升序排序,并且只返回前100个结果
{ "size": 100, "query": { "bool": { "must": [ { "term": { "record_table": { "value": "span_attached_event_record", "boost": 1.0 } } }, { "terms": { "related_trace_id": [ "ab80cf2b85fa4f3e9baabd114f3b909e.98.17322469467401053" ], "boost": 1.0 } }, { "terms": { "trace_ref_type": [ 0 ], "boost": 1.0 } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "start_time_second": { "order": "asc" } }, { "start_time_nanos": { "order": "asc" } } ] } |
{ "size": 200, "query": { "term": { "trace_id": { "value": "ab80cf2b85fa4f3e9baabd114f3b909e.98.17322469467401053", "boost": 1.0 } } } } |
检索record_table
为ebpf_profiling_task
、service_id
为特定值、target_type
为1或2、trigger_type
为1的文档
{ "size": 200, "query": { "bool": { "must": [ { "term": { "record_table": { "value": "ebpf_profiling_task", "boost": 1.0 } } }, { "term": { "service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } }, { "terms": { "target_type": [ 1, 2 ], "boost": 1.0 } }, { "term": { "trigger_type": { "value": 1, "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "create_time": { "order": "desc" } } ] } |
{ "size": 10000, "query": { "bool": { "must": [ { "term": { "record_table": { "value": "profile_task_log", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "operation_time": { "order": "desc" } } ] } |
获取特定时间段内特定服务的事件或日志记录,并按开始时间排序
{ "from": 0, "size": 20, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 20241122111200, "to": 20241122114259, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "term": { "service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1jb250YWN0LXNlcnZpY2U=.1", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "sort": [ { "start_time": { "order": "desc" } } ] } |
{ "size": 5000, "query": { "bool": { "must": [ { "range": { "last_ping": { "from": 202411221112, "to": null, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "term": { "service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1tZXNzYWdlLXNlcnZpY2U=.1", "boost": 1.0 } } }, { "term": { "metric_table": { "value": "instance_traffic", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } } } |
{ "size": 20, "query": { "bool": { "must": [ { "term": { "service_id": { "value":"c2VydmljZTo6dGVuZGF0YS1tZXNzYWdlLXNlcnZpY2U=.1", "boost": 1.0 } } }, { "term": { "metric_table": { "value": "endpoint_traffic", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } } } |
{ "query": { "bool": { "must": [ { "term": { "tag_type": { "value": "TRACE", "boost": 1.0 } } }, { "term": { "metric_table": { "value": "tag_autocomplete", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "tag_key": { "terms": { "field": "tag_key", "size": 100, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "order": [ { "_count": "desc" }, { "_key": "asc" } ] } } } } |
{ "size": 5000, "query": { "bool": { "must": [ { "term": { "layer": { "value": 2, "boost": 1.0 } } }, { "term": { "metric_table": { "value": "service_traffic", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "MTkyLjE2OC4zMC4xOjkwOTI7MTkyLjE2OC4zMC4zOjkwOTI=.1-c2VydmljZTo6dGVuZGF0YS1jb3JwLXNlcnZpY2U=.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_server_cpm", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS1iaXpyLXNlcnZpY2U=.1-c2VydmljZTo6dGVuZGF0YS1nbG9jby1zZXJ2aWNl.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_server_resp_time", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS1tY3Mtc2VydmljZQ==.1-MTkyLjE2OC4zMC4xOjkwOTI7MTkyLjE2OC4zMC4zOjkwOTI=.0" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_client_resp_time", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS10cmFuc2xhdGlvbi1zZXJ2aWNl.1-YXBpLnRyYW5zbGF0b3IuYXp1cmUuY246NDQz.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_client_cpm", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS1tY3Mtc2VydmljZQ==.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_resp_time", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS1vcGVuYXBpLWdhdGV3YXktc2VydmljZQ==.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_sla", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "percentage": { "avg": { "field": "percentage" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "terms": { "entity_id": [ "c2VydmljZTo6dGVuZGF0YS1kZnMtc2VydmljZQ==.1" ], "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_cpm", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "value": { "avg": { "field": "value" } } } } } } |
{ "size": 0, "query": { "bool": { "must": [ { "range": { "time_bucket": { "from": 202411221112, "to": 202411221142, "include_lower": true, "include_upper": true, "boost": 1.0 } } }, { "bool": { "should": [ { "terms": { "source_service_id": [ "c2VydmljZTo6dGVuZGF0YS10aGlyZC1wYXJ0eS1zZXJ2aWNl.1", "c2VydmljZTo6dGVuZGF0YS1tY3Mtc2VydmljZQ==.1" ], "boost": 1.0 } }, { "terms": { "dest_service_id": [ "c2VydmljZTo6dGVuZGF0YS10aGlyZC1wYXJ0eS1zZXJ2aWNl.1", "c2VydmljZTo6dGVuZGF0YS1pbnNpZ2h0LXNlcnZpY2U=.1", "c2VydmljZTo6dGVuZGF0YS1tY3Mtc2VydmljZQ==.1" ], "boost": 1.0 } } ], "adjust_pure_negative": true, "boost": 1.0 } }, { "term": { "metric_table": { "value": "service_relation_server_side", "boost": 1.0 } } } ], "adjust_pure_negative": true, "boost": 1.0 } }, "aggregations": { "entity_id": { "terms": { "field": "entity_id", "size": 1000, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" }, "aggregations": { "component_ids": { "terms": { "field": "component_ids", "size": 10, "min_doc_count": 1, "shard_min_doc_count": 0, "show_term_doc_count_error": false, "execution_hint": "map", "order": [ { "_count": "desc" }, { "_key": "asc" } ], "collect_mode": "breadth_first" } } } } } } |
原文地址:https://blog.csdn.net/wang92424/article/details/143977276
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!