查询来自 Azure 时序见解第 2 代的数据Querying Data from Azure Time Series Insights Gen2

使用 Azure 时序见解第 2 代可以通过公共 Surface API 对存储在环境中的事件和元数据进行数据查询。Azure Time Series Insights Gen2 enables data querying on events and metadata stored in the environment via public surface APIs.

Azure 时序见解第 2 代中提供三个主要 API 类别:Three primary API categories are available in Azure Time Series Insights Gen2:

  • 环境 API:这些 API 允许查询 Azure 时序见解第 2 代环境本身。Environment APIs: These APIs enable queries on the Azure Time Series Insights Gen2 environment itself. 这些 API 可用于收集调用方有权访问的环境列表和环境元数据。These can be used to gather the list of environments the caller has access to and environment metadata.
  • 时序模型-查询 (TSM-Q) API:用于针对环境的时序模型中存储的元数据执行创建、读取、更新和删除 (CRUD) 操作。Time Series Model-Query (TSM-Q) APIs: Enables create, read, update, and delete (CRUD) operations on metadata stored in the Time Series Model of the environment. 这些 API 可用于访问和编辑实例、类型与层次结构。These can be used to access and edit the instances, types, and hierarchies.
  • 时序查询 (TSQ) API:用于检索从源提供程序记录的遥测数据或事件数据,以及通过高级标量和聚合函数对数据执行高性能计算和聚合。Time Series Query (TSQ) APIs: Enables retrieval of telemetry or events data as it's recorded from the source provider and enables performant computations and aggregations on the data using advanced scalar and aggregate functions.

Azure 时序见解第 2 代使用丰富的基于字符串的表达式语言时序表达式 (TSX) 来表达时序变量中的计算。Azure Time Series Insights Gen2 uses a rich string-based expression language, Time Series Expression (TSX), for expressing calculations in Time Series Variables.

Azure 时序见解第 2 代 API 概述Azure Time Series Insights Gen2 APIs overview

支持以下核心 API。The following core APIs are supported.

时序查询概述Time Series Query overview

环境 APIEnvironment APIs

  • 获取环境 API:返回调用方有权访问的环境的列表。Get Environments API: Returns the list of environments that the caller is authorized to access.
  • 获取环境可用性 API:返回事件时间戳 $ts 中事件计数的分布。Get Environments Availability API: Returns the distribution of event count over the event timestamp $ts. 此 API 通过返回按时间间隔划分的事件计数(如果有),来帮助确定环境中是否出现了任何事件。This API helps determine if there are any events in the environment by returning the count of events broken into intervals of time, if any exist.
  • 获取事件架构 API:返回给定搜索范围的事件架构元数据。Get Event Schema API: Returns the event schema metadata for a given search span. 此 API 可帮助检索给定搜索范围的架构中可用的所有元数据和属性。This API helps retrieve all metadata and properties available in the schema for the given search span.

时序模型-查询 (TSM-Q) APITime Series Model-Query (TSM-Q) APIs

其中的大多数 API 支持批量执行操作,可用于对多个时序模型实体执行批量 CRUD 操作:Most of these APIs support batch execution operation to enable batch CRUD operations on multiple Time Series Model entities:

  • 模型设置 API:允许对环境的默认类型和模型名称执行 GETPATCH 操作。Model Settings API: Enables GET and PATCH on the default type and the model name of the environment.
  • 类型 API:允许对时序类型及其关联变量执行 CRUD。Types API: Enables CRUD on Time Series types and their associated variables.
  • 层次结构 API:允许对时序层次结构及其关联的字段路径执行 CRUD。Hierarchies API: Enables CRUD on Time Series hierarchies and their associated field paths.
  • 实例 API:允许对时序实例及其关联的实例字段执行 CRUD。Instances API: Enables CRUD on Time Series instances and their associated instance fields. 另外,实例 API 支持以下操作:Additionally, the Instances API supports the following operations:
    • 搜索:检索在搜索基于实例属性的时序实例时获得的结果的部分列表。Search: Retrieves a partial list of hits on search for time series instances based on instance attributes.
    • 建议:搜索并建议在搜索基于实例属性的时序实例时获得的结果的部分列表。Suggest: Searches and suggests a partial list of hits on search for time series instances based on instance attributes.

时序查询 (TSQ) APITime Series Query (TSQ) APIs

这些 API 对多层存储解决方案中的两种存储(暖存储和冷存储)都可用。These APIs are available across both stores (Warm and Cold) in our multilayered storage solution. 查询 URL 参数用于指定查询应该在其上执行的存储类型Query URL parameters are used to specify the store type the query should execute on:

  • 获取事件 API:用于查询和检索原始事件和关联的事件时间戳(当它们从源提供程序记录在 Azure 时序见解第 2 代中时)。Get Events API: Enables query and retrieval of raw events and the associated event timestamps as they're recorded in Azure Time Series Insights Gen2 from the source provider. 此 API 可用于从给定时序 ID 和搜索范围中检索原始事件。This API allows retrieval of raw events for a given Time Series ID and search span. 此 API 支持分页,可以检索选定输入的完整响应数据集。This API supports pagination to retrieve the complete response dataset for the selected input.

    重要

  • 获取时序 API:此 API 对原始事件应用变量定义的计算,可用于查询和检索计算值与关联的事件时间戳。Get Series API: Enables query and retrieval of computed values and the associated event timestamps by applying calculations defined by variables on raw events. 这些变量可以在时序模型中定义,或者在查询中以内联方式提供。These variables can be defined in either the Time Series Model or provided inline in the query. 此 API 支持分页,可以检索选定输入的完整响应数据集。This API supports pagination to retrieve the complete response dataset for the selected input.

  • 聚合时序 API:此 API 对原始事件应用变量定义的计算,可用于查询和检索聚合值与关联的间隔时间戳。Aggregate Series API: Enables query and retrieval of aggregated values and the associated interval timestamps by applying calculations defined by variables on raw events. 这些变量可以在时序模型中定义,或者在查询中以内联方式提供。These variables can be defined in either the Time Series Model or provided inline in the query. 此 API 支持分页,可以检索选定输入的完整响应数据集。This API supports pagination to retrieve the complete response dataset for the selected input.

    对于指定的搜索范围和间隔,此 API 将根据每个间隔和变量返回时序 ID 的聚合响应。For a specified search span and interval, this API returns an aggregated response per interval per variable for a Time Series ID. 响应数据集中的间隔数的计算方式是,统计纪元计时周期数(自 Unix 纪元 1970 年 1 月 1 日开始消逝的毫秒数),然后将计时周期数除以查询中指定的间隔跨度大小。The number of intervals in the response dataset is calculated by counting epoch ticks (the number of milliseconds that have elapsed since Unix epoch - Jan 1st, 1970) and dividing the ticks by the interval span size specified in the query.

    响应集中返回的时间戳与左间隔边界相关,而与间隔中的采样事件无关。The timestamps returned in the response set are of the left interval boundaries, not of the sampled events from the interval.

后续步骤Next steps