extent_tags()extent_tags()

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

将此函数应用于未附加到数据分片的计算数据会返回空值。Applying this function to calculated data which is not 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

下面的示例演示如何获取一个列表,其中包含其记录是一小时前的所有数据分片的标记,这些记录具有列 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. 它表明,一些查询运算符(这里是 where 运算符,但对于 extendproject 也是如此)保留了有关承载记录的数据分片的信息。It demonstrates that some query operators (here, the where operator, but this is also true for extend and project) preserve the information about the data shard hosting the record.

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 which are 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

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