Search code examples
azureazure-application-insightsazure-monitoring

Azure Monitor (Application Insights) log queries charts - what is on Y-axis?


How to choose what is shown on Y-axis in Application Insights (Azure Monitor?) chart? enter image description here

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?


Solution

  • 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: Simple time-series chart 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: Plot multiple metrics 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
    

    Output: make-series operator

    For additional reading, please refer to the following resources: