azure - 尽管遵守维度上限,Metric.TryGetDataSeries 返回 false

标签 azure azure-application-insights metrics

我正在尝试使用 Metric.TryGetDataSeries 方法(此处记录:https://learn.microsoft.com/en-us/dotnet/api/microsoft.applicationinsights.metric.trygetdataseries?view=azure-dotnet#Microsoft_ApplicationInsights_Metric_TryGetDataSeries_Microsoft_ApplicationInsights_Metrics_MetricSeries__System_Boolean_System_String___)来获取 MetricSeries,然后可以使用该方法发送指标,如下所示:

MetricSeries series;
bool canTrack = metric.TryGetDataSeries(out series, true, dimensionValuesWithCanvasId.ToArray());
if (canTrack)
{
    series.TrackValue(value);
}
else
{
    throw new Exception($"Failed to track value for metric with dimensions: {string.Join(",", this.dimensionNames)}");
}

但是,我们的日志记录显示我们始终看到异常情况。日志示例:无法创建维度为 DownloadReadDurationInMs 的指标:Filename、StreamSzInKB、DataSourceId。下面的日志屏幕截图是很好的衡量标准:

Failed to create metric DownloadReadDurationInMs with dimensions: Filename,StreamSzInKB,DataSourceId.

换句话说,我们看到 TryGetDataSeries 在某些情况下返回 false。根据文档,该函数返回如下:

True if the MetricSeries indicated by the specified dimension names could be retrieved or created; False if the indicated series could not be retrieved or created because createIfNotExists is false or because a dimension cap or a metric series cap was reached.

显然createIfNotExists == true,所以一定是“达到了维度上限或公制系列上限”。但如果我们查看日志,就会发现有 3 个维度,所以我认为也没有超出任何上限(尽管我不知道在哪里可以验证这一点 - 与“系列上限”也是如此)。

那么,问题:

  1. 这些尺寸/系列上限的确切值是多少?
  2. 假设我没有超过这些上限(根据日志,我似乎在上限之内),这里是否还有其他可能出错的地方?

最佳答案

有人向我指出了此文档(仅在 3 周前添加!)https://learn.microsoft.com/en-us/azure/azure-monitor/app/get-metric#dimension-and-time-series-capping其中详细介绍了尺寸和系列上限的信息。

根据文档:

The default limits are no more than 1000 total data series per metric, and no more than 100 different values per dimension.

我对“独特值(value)”上限感到惊讶,因此看来我实际上超出了此上限。这共同回答了我的第一个问题和第二个问题。

关于azure - 尽管遵守维度上限,Metric.TryGetDataSeries 返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61879852/

相关文章:

java - Spark : configuration file 'metrics.properties'

hadoop - 用神经节监控Hadoop集群

jquery - 如何记录 Web 应用程序的详细用户指标?

python - 为什么我不能在 python 中使用 O365 包?

asp.net - 'System.Data.SqlClient.SqlException : Login failed for user' error on asp. 网络核心 1 db 首先

azure - 通过 ARM 模板对 EndpointType 为 AzureFunction 的主题进行事件订阅

azure - 如何创建或查找 Azure Application Insight 的 API key ?

azure - 如果我的函数在 24 小时内没有被调用,我可以设置 Azure Application Insight 警报吗?

Hibernate + SQL Azure = 找不到数据类型 bool 值

spring-boot - Kotlin Springboot 应用程序无法找到 Azure Application Insight 的连接字符串