您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure 时序见解预览版中的数据查询Data querying in Azure Time Series Insights Preview

使用 Azure 时序见解可以通过公共 Surface API 对存储在环境中的事件和元数据进行数据查询。Azure Time Series Insights enables data querying on events and metadata stored in the environment via public surface APIs. 时序见解资源管理器也使用这些 api。These APIs also are used by the Time Series Insights Explorer.

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

  • 环境 api:这些 api 允许在时序见解环境本身上进行查询。Environment APIs: These APIs enable queries on the Time Series Insights environment itself. 这些可用于收集调用方有权访问的环境的列表和环境元数据。These can be used to gather the list of environments the caller has access to and environment metadata.
  • 时序模型-查询(TSM) 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. 它们可用于访问和编辑实例、类型和层次结构。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.

时序见解使用丰富的基于字符串的表述语言时序表达式 (TSX) 来表述计算。Time Series Insights uses a rich string-based expression language, Time Series Expression (TSX), for expressing calculations.

Azure 时序见解核心 ApiAzure Time Series Insights core APIs

支持以下核心 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:对默认类型和环境的型号名称启用GETPATCHModel 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 on all both stores in our multilayered storage solution in Time Series Insights. 查询 URL 参数用于指定查询应该在其上执行的存储类型Query URL parameters are used to specify the store type the query should execute on:

  • 获取事件 API:允许查询和检索原始事件,并在源提供程序中记录时序见解中的相关事件时间戳。Get Events API: Enables query and retrieval of raw events and the associated event timestamps as they're recorded in Time Series Insights 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:通过应用原始事件上变量定义的计算,启用计算值和关联事件时间戳的查询和检索。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:通过应用原始事件上的变量定义的计算,启用聚合值和关联时间戳的查询和检索。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 variable per interval for a Time Series ID. 响应数据集中的间隔数是通过计算 epoch 刻度(自 Unix epoch-Jan 1,1970以来已经过去的毫秒数)计算出来的,并将刻度除以查询中指定的时间间隔范围大小。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