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
- 第一个(主)工作空间IDadditional_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
现在直接遍历表以方便起见。- 日志中的
query
API现更名为query_workspace
- 度量中的
query
API现更名为query_resource
query_workspace
API现在返回LogsQueryPartialResult
和LogsQueryResult
的联合。query_batch
API现在返回LogsQueryPartialResult
、LogsQueryError
和LogsQueryResult
的联合。metric_namespace
更名为namespace
,并在list_metric_definitions
API中作为关键字参数。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_namespaces
API 中的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_query
API 现在返回响应列表。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 |