Reputation: 2958
How to choose what is shown on Y-axis in Application Insights (Azure Monitor?) chart?
I have custom events in Application Insights and I want to build a time-series chart with a custom metric.
But instead of my metric an itemCount is shown on Y-axis. How to choose a metric for Y-axis?
Upvotes: 1
Views: 2921
Reputation: 5492
The key to getting your time-series charts right is to fetch all the time and metric information in the result set from your query.
Considering the requests
table as an example (you can apply it to your customEvents
data as appropriate):
# Simple time-series chart
requests
| summarize Requests = count() by bin(timestamp, 1h)
| render timechart
Output: Here, the query control uses timestamp for the X-axis and Requests for the Y-axis.
Next, multiple metrics can also be plotted as:
# Time-series chart with multiple metrics
requests
| summarize Requests = count(), Users = dcount(user_Id) by bin(timestamp, 1h)
| render timechart
Output: The query control uses timestamp for the X-axis and Requests & Users as separate series on the Y-axis here.
There is also the make-series
operator, which has the option to provide default values for empty buckets.
requests
| where name contains "POST"
| make-series Requests = count() default = 0 on timestamp from ago(1d) to now() step 1h by RequestName = name
| render timechart
For additional reading, please refer to the following resources:
Upvotes: 6