SOLVED
Home

Adding a threshold marker in Azure Log Anayltics

Ari Moskowitz
Microsoft

I am trying to add a line into a time chart. The time chart looks at a metric across all stream analytics jobs in the azure metrics table. Each job is represented by a line. I would like to add an artificial threshold line at metric=900 so that it is clear when a job passes 900 or is under 900. Here is a snippet from the table I am querying. 

 

AzureMetrics  
| where ResourceProvider == "MICROSOFT.STREAMANALYTICS"  
| where MetricName contains "WatermarkDelay"      
| project Resource, ResourceGroup, Maximum, MetricName, TimeGenerated
| summarize WatermarkDelay = max(Maximum)  by Resource, bin(TimeGenerated, 15m)

 

 

I have tried joins of many kinds as well as unions with this constructed table below. I've also played around with moving the summarize statement into both queries and just one or the other. The two queries output tables of the same schema, if I could just concatenate the tables then I could graph the new table and solve the problem. 

 

Constructed table with unique TimeGenerated values: 

    AzureMetrics
    | where ResourceProvider == "MICROSOFT.STREAMANALYTICS"      
    | where MetricName contains "WatermarkDelay"
    | where Resource == "AMSALERTSERVICEMODE"
    | extend Maximum = 900
    , Resource = "ams_Test"
    | project Resource, ResourceGroup, Maximum, MetricName, TimeGenerated

 

Thank you! 

2 Replies

 

AzureMetrics 
| where ResourceProvider == "MICROSOFT.STREAMANALYTICS"
  and MetricName contains "WatermarkDelay"
| summarize WatermarkDelay = max(Maximum), Threshold = 900 by Resource, bin(TimeGenerated, 15m)

This will produce two time series.  One called WaterMarkDay and the other Threshold with a constant value of 900 for every time.