extent_tags()extent_tags()

返回一个动态数组,其中包含当前记录所在的数据分片(“盘区”)的标记Returns a dynamic array with the tags of the data shard ("extent") that the current record is in.

将此函数应用于未附加到数据分片的计算数据会返回空值。Applying this function to calculated data, which isn't attached to a data shard, returns an empty value.

语法Syntax

extent_tags()

返回Returns

类型为 dynamic 的值,它是包含当前记录的盘区标记的数组,或者是空值。A value of type dynamic that is an array holding the current record's extent tags, or an empty value.

示例Examples

一些查询运算符将保留有关托管记录的数据分片的信息。Some query operators preserve the information about the data shard hosting the record. 这些运算符包括 whereextendprojectThese operators include where, extend, and project. 下面的示例演示如何获取一个列表,其中包含其记录是一小时前的所有数据分片的标记,这些记录具有列 ActivityId 的特定值。The following example shows how to get a list the tags of all the data shards that have records from an hour ago, with a specific value for the column ActivityId.

T
| where Timestamp > ago(1h)
| where ActivityId == 'dd0595d4-183e-494e-b88e-54c52fe90e5a'
| extend tags = extent_tags()
| summarize by tostring(tags)

下面的示例演示如何获取最近一小时内所有记录的计数,这些记录存储在使用标记 MyTag(可能还使用其他标记)标记但没有使用标记 drop-by:MyOtherTag 的盘区中。The following example shows how to obtain a count of all records from the last hour, which are stored in extents tagged with the tag MyTag (and potentially other tags), but not tagged with the tag drop-by:MyOtherTag.

T
| where Timestamp > ago(1h)
| extend Tags = extent_tags()
| where Tags has_cs 'MyTag' and Tags !has_cs 'drop-by:MyOtherTag'
| count

备注

当使用以下任一字符串运算符时,筛选值 extent_tags() 性能最佳:hashas_cs!has!has_csFiltering on the value of extent_tags() performs best when one of the following string operators is used: has, has_cs, !has, !has_cs.

Azure Monitor 不支持此功能This capability isn't supported in Azure Monitor