Python的Microsoft Azure Monitor查询客户端库
项目描述
Python的Azure Monitor查询客户端库
Azure Monitor查询客户端库用于针对Azure Monitor的两个数据平台执行只读查询
- 日志 - 从受监控的资源收集和组织日志和性能数据。来自不同来源的数据,如Azure服务的平台日志、虚拟机代理的日志和性能数据,以及应用的用量和性能数据可以合并到一个Azure日志分析工作区中。可以使用Kusto查询语言一起分析不同的数据类型。
- 指标 - 将监控资源的数值数据收集到时间序列数据库中。指标是定期收集的数值,描述了在特定时间点的系统的一些方面。指标轻量且能够支持接近实时的场景,因此对警报和快速问题检测很有用。
资源
入门
先决条件
- Python 3.8或更高版本
- 一个Azure订阅
- 一个TokenCredential实现,例如Azure Identity库凭证类型。
- 要查询日志,您需要以下之一- 一个Azure Log Analytics工作区
- 任何类型的Azure资源(存储账户、密钥保管库、Cosmos DB等)
 
- 要查询指标,您需要任何类型的Azure资源(存储账户、密钥保管库、Cosmos DB等)。
安装包
使用pip安装Azure Monitor Query Python客户端库
pip install azure-monitor-query
创建客户端
查询日志或指标需要认证的客户端。库包含客户端的同步和异步形式。要认证,创建一个令牌凭证的实例。在创建LogsQueryClient、MetricsQueryClient或MetricsClient时使用该实例。以下示例使用azure-identity包中的DefaultAzureCredential。
同步客户端
以下示例创建日志和指标查询的同步客户端
from azure.identity import DefaultAzureCredential
from azure.monitor.query import LogsQueryClient, MetricsQueryClient, MetricsClient
credential = DefaultAzureCredential()
logs_query_client = LogsQueryClient(credential)
metrics_query_client = MetricsQueryClient(credential)
metrics_client = MetricsClient("https://<regional endpoint>", credential)
异步客户端
查询客户端API的异步形式位于以.aio后缀的命名空间中。例如
from azure.identity.aio import DefaultAzureCredential
from azure.monitor.query.aio import LogsQueryClient, MetricsQueryClient, MetricsClient
credential = DefaultAzureCredential()
async_logs_query_client = LogsQueryClient(credential)
async_metrics_query_client = MetricsQueryClient(credential)
async_metrics_client = MetricsClient("https://<regional endpoint>", credential)
为Azure主权云配置客户端
默认情况下,所有客户端都配置为使用Azure公共云。要使用主权云,在使用LogsQueryClient或MetricsQueryClient时提供正确的endpoint参数。对于MetricsClient,提供正确的audience参数。例如
from azure.identity import AzureAuthorityHosts, DefaultAzureCredential
from azure.monitor.query import LogsQueryClient, MetricsQueryClient, MetricsClient
# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable.
credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT)
logs_query_client = LogsQueryClient(credential, endpoint="https://api.loganalytics.us/v1")
metrics_query_client = MetricsQueryClient(credential, endpoint="https://management.usgovcloudapi.net")
metrics_client = MetricsClient(
    "https://usgovvirginia.metrics.monitor.azure.us", credential, audience="https://metrics.monitor.azure.us"
)
注意:目前,MetricsQueryClient使用Azure资源管理器(ARM)端点查询指标。您需要云的相应管理端点来使用此客户端。此详细信息可能在未来发生变化。
执行查询
有关日志和指标查询的示例,请参阅示例部分。
关键概念
日志查询速率限制和节流
当请求速率过高时,日志分析服务会应用节流。还应用了限制,例如返回的最大行数。有关更多信息,请参阅查询API。
如果您正在执行批处理日志查询,节流请求会返回一个LogsQueryError对象。该对象的code值为ThrottledError。
指标数据结构
每组指标值具有以下特征的时间序列
- 收集值的时间
- 与值关联的资源
- 类似于指标的类别的命名空间
- 指标名称
- 值本身
- 某些指标具有多个维度,如多维指标中所述。自定义指标可以有最多10个维度。
示例
日志查询
本示例展示了如何查询日志分析工作空间。要处理响应并在表格形式中查看,使用了pandas库。如果您不使用pandas,请参阅示例。
基于资源的日志查询
以下示例演示了如何在不使用日志分析工作空间的情况下直接从Azure资源查询日志。这里使用的是query_resource方法而不是query_workspace。传递一个Azure资源标识符而不是工作空间ID。例如,/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}。
import os
import pandas as pd
from datetime import timedelta
from azure.monitor.query import LogsQueryClient, LogsQueryStatus
from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential
credential  = DefaultAzureCredential()
client = LogsQueryClient(credential)
query = """AzureActivity | take 5"""
try:
    response = client.query_resource(os.environ['LOGS_RESOURCE_ID'], query, timespan=timedelta(days=1))
    if response.status == LogsQueryStatus.SUCCESS:
        data = response.tables
    else:
        # LogsQueryPartialResult
        error = response.partial_error
        data = response.partial_data
        print(error)
    for table in data:
        df = pd.DataFrame(data=table.rows, columns=table.columns)
        print(df)
except HttpResponseError as err:
    print("something fatal happened")
    print(err)
指定时间段
timespan参数指定查询数据的时间范围。此值可以采取以下形式之一
- 一个timedelta
- 一个timedelta和一个起始datetime
- 一个起始datetime/结束datetime
例如
import os
import pandas as pd
from datetime import datetime, timezone
from azure.monitor.query import LogsQueryClient, LogsQueryResult
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import HttpResponseError
credential = DefaultAzureCredential()
client = LogsQueryClient(credential)
query = """AppRequests | take 5"""
start_time=datetime(2021, 7, 2, tzinfo=timezone.utc)
end_time=datetime(2021, 7, 4, tzinfo=timezone.utc)
try:
    response = client.query_workspace(
        workspace_id=os.environ['LOG_WORKSPACE_ID'],
        query=query,
        timespan=(start_time, end_time)
        )
    if response.status == LogsQueryStatus.SUCCESS:
        data = response.tables
    else:
        # LogsQueryPartialResult
        error = response.partial_error
        data = response.partial_data
        print(error)
    for table in data:
        df = pd.DataFrame(data=table.rows, columns=table.columns)
        print(df)
except HttpResponseError as err:
    print("something fatal happened")
    print(err)
处理日志查询响应
query_workspace API返回一个LogsQueryResult或LogsQueryPartialResult对象。batch_query API返回一个列表,该列表可以包含LogsQueryResult、LogsQueryPartialResult和LogsQueryError对象。以下是响应的层次结构
LogsQueryResult
|---statistics
|---visualization
|---tables (list of `LogsTable` objects)
    |---name
    |---rows
    |---columns
    |---columns_types
LogsQueryPartialResult
|---statistics
|---visualization
|---partial_error (a `LogsQueryError` object)
    |---code
    |---message
    |---details
    |---status
|---partial_data (list of `LogsTable` objects)
    |---name
    |---rows
    |---columns
    |---columns_types
LogsQueryResult直接迭代表以方便使用。例如,要处理带有表格的日志查询响应并使用pandas显示
response = client.query(...)
for table in response:
    df = pd.DataFrame(table.rows, columns=[col.name for col in table.columns])
完整的示例可以在这里找到。
以类似的方式,处理批量日志查询响应
for result in response:
    if result.status == LogsQueryStatus.SUCCESS:
        for table in result:
            df = pd.DataFrame(table.rows, columns=table.columns)
            print(df)
完整的示例可以在这里找到。
批处理日志查询
以下示例展示了使用批量查询API同时发送多个查询。这些查询可以是LogsBatchQuery对象列表或字典表示。本示例使用前者方法。
import os
from datetime import timedelta, datetime, timezone
import pandas as pd
from azure.monitor.query import LogsQueryClient, LogsBatchQuery, LogsQueryStatus
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
client = LogsQueryClient(credential)
requests = [
    LogsBatchQuery(
        query="AzureActivity | summarize count()",
        timespan=timedelta(hours=1),
        workspace_id=os.environ['LOG_WORKSPACE_ID']
    ),
    LogsBatchQuery(
        query= """bad query""",
        timespan=timedelta(days=1),
        workspace_id=os.environ['LOG_WORKSPACE_ID']
    ),
    LogsBatchQuery(
        query= """let Weight = 92233720368547758;
        range x from 1 to 3 step 1
        | summarize percentilesw(x, Weight * 100, 50)""",
        workspace_id=os.environ['LOG_WORKSPACE_ID'],
        timespan=(datetime(2021, 6, 2, tzinfo=timezone.utc), datetime(2021, 6, 5, tzinfo=timezone.utc)), # (start, end)
        include_statistics=True
    ),
]
results = client.query_batch(requests)
for res in results:
    if res.status == LogsQueryStatus.PARTIAL:
        ## this will be a LogsQueryPartialResult
        print(res.partial_error)
        for table in res.partial_data:
            df = pd.DataFrame(table.rows, columns=table.columns)
            print(df)
    elif res.status == LogsQueryStatus.SUCCESS:
        ## this will be a LogsQueryResult
        table = res.tables[0]
        df = pd.DataFrame(table.rows, columns=table.columns)
        print(df)
    else:
        # this will be a LogsQueryError
        print(res.message)
高级日志查询场景
设置日志查询超时
以下示例展示了设置服务器超时(以秒为单位)。如果查询时间超过指定的超时,则会引发网关超时。默认值为180秒,可以设置为最多10分钟(600秒)。
import os
from datetime import timedelta
from azure.monitor.query import LogsQueryClient
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
client = LogsQueryClient(credential)
response = client.query_workspace(
    os.environ['LOG_WORKSPACE_ID'],
    "range x from 1 to 10000000000 step 1 | count",
    timespan=timedelta(days=1),
    server_timeout=600 # sets the timeout to 10 minutes
    )
查询多个工作区
相同的日志查询可以在多个日志分析工作空间中执行。除了Kusto查询外,还需要以下参数
- workspace_id- 第一个(主)工作空间ID
- additional_workspaces- 工作空间列表,不包括在- workspace_id参数中提供的工作空间。参数列表项可以由以下标识符格式组成- 合格的工作空间名称
- 工作空间ID
- Azure资源ID
 
例如,以下查询在三个工作空间中执行
client.query_workspace(
    <workspace_id>,
    query,
    timespan=timedelta(days=1),
    additional_workspaces=['<workspace 2>', '<workspace 3>']
    )
完整的示例可以在这里找到。
包含统计信息
要获取日志查询执行统计信息,例如CPU和内存消耗
- 将include_statistics参数设置为True。
- 访问LogsQueryResult对象中的statistics字段。
以下示例打印查询执行时间
query = "AzureActivity | top 10 by TimeGenerated"
result = client.query_workspace(
    <workspace_id>,
    query,
    timespan=timedelta(days=1),
    include_statistics=True
    )
execution_time = result.statistics.get("query", {}).get("executionTime")
print(f"Query execution time: {execution_time}")
statistics字段是一个与原始JSON响应对应的dict,其结构因查询而异。统计信息位于query属性中。例如
{
  "query": {
    "executionTime": 0.0156478,
    "resourceUsage": {...},
    "inputDatasetStatistics": {...},
    "datasetStatistics": [{...}]
  }
}
包含可视化
要使用渲染操作符获取日志查询的可视化数据
- 将include_visualization属性设置为True。
- 访问LogsQueryResult对象中的visualization字段。
例如
query = (
    "StormEvents"
    "| summarize event_count = count() by State"
    "| where event_count > 10"
    "| project State, event_count"
    "| render columnchart"
)
result = client.query_workspace(
    <workspace_id>,
    query,
    timespan=timedelta(days=1),
    include_visualization=True
    )
print(f"Visualization result: {result.visualization}")
visualization字段是一个与原始JSON响应对应的dict,其结构因查询而异。例如
{
  "visualization": "columnchart",
  "title": "the chart title",
  "accumulate": False,
  "isQuerySorted": False,
  "kind": None,
  "legend": None,
  "series": None,
  "yMin": "NaN",
  "yMax": "NaN",
  "xAxis": None,
  "xColumn": None,
  "xTitle": "x axis title",
  "yAxis": None,
  "yColumns": None,
  "ySplit": None,
  "yTitle": None,
  "anomalyColumns": None
}
可视化数据的解释留给了库的使用者。要使用Plotly图形库(Plotly graphing library)来使用这些数据,请参阅同步或异步代码示例。
度量查询
以下示例获取Event Grid订阅的指标。资源ID(也称为资源URI)是Event Grid主题的ID。
资源ID必须是正在查询指标的资源的ID。它通常是以下格式:/subscriptions/<id>/resourceGroups/<rg-name>/providers/<source>/topics/<resource-name>。
要查找资源ID/URI
- 导航到Azure门户中您资源的页面。
- 在“概述”部分中选择JSON视图链接。
- 复制JSON视图顶部资源ID文本框中的值。
注意:指标按发送的metric_names的顺序返回。
import os
from datetime import timedelta, datetime
from azure.monitor.query import MetricsQueryClient
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
client = MetricsQueryClient(credential)
start_time = datetime(2021, 5, 25)
duration = timedelta(days=1)
metrics_uri = os.environ['METRICS_RESOURCE_URI']
response = client.query_resource(
    metrics_uri,
    metric_names=["PublishSuccessCount"],
    timespan=(start_time, duration)
    )
for metric in response.metrics:
    print(metric.name)
    for time_series_element in metric.timeseries:
        for metric_value in time_series_element.data:
            print(metric_value.time_stamp)
处理度量查询响应
指标查询API返回一个MetricsQueryResult对象。该MetricsQueryResult对象包含如Metric-类型对象列表、granularity、namespace和timespan等属性。可以使用metrics参数访问Metric对象列表。此列表中的每个Metric对象都包含一个TimeSeriesElement对象列表。每个TimeSeriesElement对象都包含data和metadata_values属性。从视觉形式上看,响应的对象层次结构类似于以下结构
MetricsQueryResult
|---granularity
|---timespan
|---cost
|---namespace
|---resource_region
|---metrics (list of `Metric` objects)
    |---id
    |---type
    |---name
    |---unit
    |---timeseries (list of `TimeSeriesElement` objects)
        |---metadata_values
        |---data (list of data points represented by `MetricValue` objects)
处理响应的示例
import os
from azure.monitor.query import MetricsQueryClient, MetricAggregationType
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
client = MetricsQueryClient(credential)
metrics_uri = os.environ['METRICS_RESOURCE_URI']
response = client.query_resource(
    metrics_uri,
    metric_names=["MatchedEventCount"],
    aggregations=[MetricAggregationType.COUNT]
    )
for metric in response.metrics:
    print(metric.name)
    for time_series_element in metric.timeseries:
        for metric_value in time_series_element.data:
            if metric_value.count != 0:
                print(
                    "There are {} matched events at {}".format(
                        metric_value.count,
                        metric_value.time_stamp
                    )
                )
查询多个资源的度量
要在单个请求中查询多个Azure资源的指标,请使用MetricsClient的query_resources方法。此方法
- 调用与MetricsQueryClient方法不同的API。
- 在创建客户端时需要区域端点。例如,“https://westus3.metrics.monitor.azure.com”。
每个Azure资源都必须位于
- 与创建客户端时指定的端点相同的区域。
- 相同的Azure订阅。
此外
- 用户必须被授权在Azure订阅级别读取监控数据。例如,要查询的订阅上的监控读取器角色。
- 必须提供包含要查询的指标的指标命名空间。有关指标命名空间的列表,请参阅按资源类型支持的指标和日志类别。
from datetime import timedelta
import os
from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential
from azure.monitor.query import MetricsClient, MetricAggregationType
endpoint = "https://westus3.metrics.monitor.azure.com"
credential = DefaultAzureCredential()
client = MetricsClient(endpoint, credential)
resource_ids = [
    "/subscriptions/<id>/resourceGroups/<rg-name>/providers/<source>/storageAccounts/<resource-name-1>",
    "/subscriptions/<id>/resourceGroups/<rg-name>/providers/<source>/storageAccounts/<resource-name-2>"
]
response = client.query_resources(
    resource_ids=resource_ids,
    metric_namespace="Microsoft.Storage/storageAccounts",
    metric_names=["Ingress"],
    timespan=timedelta(hours=2),
    granularity=timedelta(minutes=5),
    aggregations=[MetricAggregationType.AVERAGE],
)
for metrics_query_result in response:
    print(metrics_query_result.timespan)
故障排除
请参阅我们的故障排除指南,了解如何诊断各种故障场景的详细信息。
下一步
要了解更多关于Azure Monitor的信息,请参阅Azure Monitor服务文档。
示例
以下代码示例显示了Azure Monitor Query客户端库的常见场景。
日志查询示例
- 使用LogsQueryClient发送单个查询并作为表处理响应(异步示例)
- 使用LogsQueryClient发送单个查询并以键值形式处理响应
- 使用没有pandas的LogsQueryClient发送单个查询
- 使用LogsQueryClient在多个工作区中发送单个查询
- 使用LogsQueryClient发送多个查询
- 使用LogsQueryClient使用服务器超时发送单个查询
指标查询示例
- 使用MetricsQueryClient发送查询(异步示例)
- 使用MetricsClient对区域和订阅中的多个资源发送查询 (异步示例)
- 获取指标命名空间列表 (异步示例)
- 获取指标定义列表 (异步示例)
贡献
此项目欢迎贡献和建议。大多数贡献都需要您同意一份贡献者许可协议(CLA),声明您有权,并且实际上确实授予我们使用您的贡献的权利。有关详细信息,请访问 cla.microsoft.com。
当您提交拉取请求时,CLA机器人将自动确定您是否需要提供CLA,并相应地装饰PR(例如,标签,注释)。只需遵循机器人提供的说明即可。您只需在整个使用我们的CLA的存储库中这样做一次。
此项目采用了Microsoft开源行为准则。有关更多信息,请参阅行为准则FAQ或通过opencode@microsoft.com联系以获取任何其他问题或评论。
发布历史
1.4.0 (2024-06-11)
新增功能
- 现在可以将audience关键字参数传递给MetricsClient构造函数,以指定身份验证令牌的受众。当查询主权云中的指标时非常有用。(#35502)
1.3.0 (2024-03-28)
新增功能
- 将roll_up_by关键字参数添加到MetricsClient.query_resources,以支持按维度汇总指标。(#33752)
破坏性更改
- 以下更改与先前的预览版本不兼容(即 1.3.0b2/1.3.0b1)
1.2.1 (2024-01-31)
已修复的错误
- 修复了在使用MetricsQueryClient时某些关键字参数未传播的问题。
其他更改
- 生成代码的内部更新。
- 将azure-core的最小依赖性提升到>=1.28.0。
1.3.0b2 (2023-11-20)
其他更改
- 生成代码的内部更新。
- 将azure-core的最小依赖性提升到>=1.28.0。
1.3.0b1 (2023-08-16)
新增功能
- 添加了MetricsBatchQueryClient以支持从Azure资源批量查询指标。(#31049)
1.2.0 (2023-05-09)
新增功能
- 将query_resource方法添加到LogsQueryClient,以允许用户直接查询Azure资源,而无需工作区上下文。(#29365)
已修复的错误
其他更改
- 改进了非公共Azure云的客户配置逻辑,凭据作用域将由配置的端点确定。(#29602)
1.1.1 (2023-02-13)
已修复的错误
- 修复了一个错误,其中在创建MetricValue对象时使用了错误的键time_stamp(应该是timeStamp)(感谢@jamespic)。(《a href="https://github.com/Azure/azure-sdk-for-python/pull/28777" rel="nofollow">#28777)
1.1.0 (2023-02-07)
已修复的错误
- 错误详情现在在LogsQueryError对象内部传播。(#25137)
其他更改
- 不再支持Python 3.6。请使用Python版本3.7或更高版本。有关更多详细信息,请参阅Azure SDK for Python版本支持策略。
- 移除了msrest依赖。
- 将azure-core的最小依赖项升级到>=1.24.0。
- 添加了对isodate>=0.6.0的要求(isodate由msrest需要)。
- 添加了对typing-extensions>=4.0.1的要求。
1.0.3 (2022-07-07)
已修复的错误
- 修复了度量客户端中的query_resource在具有意外metric_namespace参数时抛出错误的bug。
1.0.2 (2022-05-06)
- 此版本和所有未来版本将需要Python 3.6+。Python 2.7不再受支持。
已修复的错误
- 修复了datetime中的None值抛出错误的bug。
1.0.1 (2021-11-09)
已修复的错误
- 修复了时间戳中的元数据值有时不会显示的bug。
1.0.0 (2021-10-06)
新增功能
- 添加了LogsQueryPartialResult和LogsQueryError来处理错误。
- 添加了status属性到LogsQueryResult。
- 添加了LogsQueryStatus枚举来描述结果的状态。
- 添加了一个新的LogsTableRow类型,它表示表中的一行。
- 现在可以通过度量名称访问MetricsQueryResult中的metrics列表中的项目。
破坏性更改
- LogsQueryResult现在直接遍历表以方便起见。
- 日志中的queryAPI现更名为query_workspace
- 度量中的queryAPI现更名为query_resource
- query_workspaceAPI现在返回- LogsQueryPartialResult和- LogsQueryResult的联合。
- query_batchAPI现在返回- LogsQueryPartialResult、- LogsQueryError和- LogsQueryResult的联合。
- metric_namespace更名为- namespace,并在- list_metric_definitionsAPI中作为关键字参数。
- MetricsResult更名为- MetricsQueryResult。
1.0.0b4 (2021-09-09)
新增功能
- 向Metric类型添加了额外的display_description属性。
- 添加了一个MetricClass枚举来提供度量的类别。
- 向MetricDefinition类型添加了一个metric_class属性。
- 添加了一个MetricNamespaceClassification枚举来支持MetricNamespace类型上的namespace_classification属性。
- 添加了一个MetricUnit枚举来描述度量的单位。
破坏性更改
- 将batch_query更名为query_batch。
- 将LogsBatchQueryRequest更名为LogsBatchQuery。
- 查询API中的include_render现更名为include_visualization。
- LogsQueryResult现在返回- visualization而不是- render。
- start_time、- duration和- end_time现在用一个名为- timespan的单一参数替换。
- 在MetricResult类型中将resourceregion更名为resource_region。
- 度量查询API中的top更名为max_results。
- metric_namespace_name更名为- fully_qualified_namespace。
- is_dimension_required更名为- dimension_required。
- interval和- time_grain更名为- granularity。
- orderby更名为- order_by。
- LogsQueryResult现在为时间值返回- datetime对象。
- LogsBatchQuery不再接受- request_id。
- 删除了MetricsMetadataValues。现在使用字典。
- 在MetricValue类型中将time_stamp更名为timestamp。
- AggregationType更名为- MetricAggregationType。
- 已移除 LogsBatchResultError类型。
- LogsQueryResultTable已更名为- LogsTable
- LogsTableColumn已移除。列标签现在是字符串。
- list_metric_namespacesAPI 中的- start_time现在是 datetime 类型。
- LogsBatchQuery中参数的顺序已更改。同时,- headers已不再接受。
- timespan现在是日志 API 中必需的关键字参数。
- 批处理 API 现在返回 LogsQueryResult对象的列表。
已修复的错误
- include_statistics和- include_visualization参数现在可以一起使用。
1.0.0b3 (2021-08-09)
新增功能
- 添加了枚举 AggregationType,可用于在查询 API 中指定聚合。
- 添加了返回日志批查询结果的 LogsBatchQueryResult模型。
- 为 LogsQueryResult添加了error属性。
破坏性更改
- 查询 API 中的 aggregation参数已重命名为aggregations
- batch_queryAPI 现在返回响应列表。
- LogsBatchResults模型已移除。
- LogsQueryRequest已更名为- LogsBatchQueryRequest
- LogsQueryResults已更名为- LogsQueryResult
- LogsBatchQueryResult现在有 4 个额外的属性 -- tables、- error、- statistics和- render,而不是- body属性。
1.0.0b2 (2021-07-06)
破坏性更改
- workspaces、- workspace_ids、- qualified_names和- azure_resource_ids现已合并为查询 API 中的单个- additional_workspaces列表。
- LogQueryRequest对象现在接受- workspace_id和- additional_workspaces而不是- workspace。
- aggregation参数现在在- query方法中是一个列表而不是字符串。
- duration必须以 timedelta 的形式提供,而不是字符串。
1.0.0b1 (2021-06-10)
功能
- 版本 (1.0.0b1) 是我们创建一个用户友好且 Pythonic 的 Azure Monitor Query 客户端库的第一个预览版。有关更多信息,请访问https://azure.github.io/azure-sdk/releases/latest/python.html。
- 添加了 ~azure.monitor.query.LogsQueryClient以查询日志分析,以及~azure.monitor.query.aio.LogsQueryClient。
- 实现了 ~azure.monitor.query.MetricsQueryClient以查询指标、列出命名空间和指标定义,以及~azure.monitor.query.aio.MetricsQueryClient。
项目详情
下载文件
下载您平台上的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
构建发行版
azure_monitor-query-1.4.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 699c6f3c5942f09da98cef273ffbb7403904ec43f93c0d63f10a367b4479e009 | |
| MD5 | b44e948f1f8f8fedd79074cf8433b167 | |
| BLAKE2b-256 | 2cdb9f3da027fea29068928587c028b996a878cd9e7b6caea5b70ba6cea96755 | 
azure_monitor_query-1.4.0-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 5e3783d52d334049dc6e50d6b38e36285e8b826ca343158a698495d3f57ed86d | |
| MD5 | c7d50ff500dba72de4e1eb55cebe3781 | |
| BLAKE2b-256 | f9f48bc8d38e8898a5f264d4cbea1b62df8fe572d426fe1c8cf5a9974ef75fa4 |