Application Insight: Use graphs that use "zero-fill"
Feedback for 'Monitoring NServiceBus endpoints with Application Insights' https://docs.particular.net/samples/open-telemetry/application-insights/
Location in GitHub: https://github.com/Particular/docs.particular.net/blob/master/samples/open-telemetry/application-insights/sample.md
Many metrics are updated based on message that are processed. When there are no incoming messages there are no metrics to report. By default, Azure Monitor / Application Insights will not set the value to 0 on graphs steps/intervals for which no metric data was capture. This results in strange graphs.
In ServicePulse graphs are "zero-filled" when no data is received in a step/interval.
This isn't easy to accomplish with Azure Monitor and requires custom KQL via the "range" operator
Using range operator to achieve zero-fill graphs:
let defaultValue = 0.0;
range timestamp from floor(ago(30m),1m) to floor(now(),1m) step 1m
| join kind=leftouter
(
customMetrics
| where timestamp >= ago(30m) and timestamp < now()
//| where name == "nservicebus.messaging.processingtime"
//| where name == "nservicebus.messaging.criticaltime"
//| where name == "nservicebus.messaging.failures"
| where name == "nservicebus.messaging.successes"
| where customDimensions has "Store.Operations"
| extend
customMetric_valueSum = iif(itemType == 'customMetric', valueSum, todouble(''))
//,customMetric_valueCount = iif(itemType == 'customMetric', valueCount, toint(''))
//| summarize Value = sum(customMetric_valueSum) / sum(customMetric_valueCount) by bin(timestamp, 1m)
| summarize Value = sum(customMetric_valueSum) by bin(timestamp, 1m)
| order by timestamp desc
) on timestamp
| project timestamp, value = iff(isnotempty(Value), Value, defaultValue)
| render areachart
Original solution found at https://stackoverflow.com/a/50537449/199551