Using Power BI and Application Insights REST APIs to gain insight into your application health


Reporting on Application Insights REST APIs with Power BI

· Developers can access their Application Insights data (events, metrics & analytics queries) using REST APIs from https://dev.applicationinsights.io/

To Demo this:

· Open https://dev.applicationinsights.io/ to demo REST APIs using the fabrikamprod resource.

clip_image002

REST APIs are one of the ways to access your Application Insights Data (in addition to Azure Portal, Analytics Portal, OMS Portal, Visual Studio, VSTS, Continuous Export, PowerBI, etc.)

· Browse to the “API Explorer” section of the website and enter the following details to access data from fabrikamprod resource. API Explorer lets you play with the APIs and evaluate the results, enabling you to identify the optimal HTTP/cURL Requests for your purposes.

 

clip_image004

· You can see the HTTP Request on the Top-Right and the actual response on the Bottom-Right. Click on Visualize to see the data in graphical format:

clip_image005

· To demo Query API, select “GET /query” on the left window.

In the Query box, type any Analytics query (e.g. requests | where timestamp >= ago(7d) | where client_CountryOrRegion == "Germany" | project name, duration, client_CountryOrRegion | where name has "GET")

Click Fetch! and see the HTTP Request & the Response on the Right side:

To get data into Power BI

1. Open Power BI > select Get Data

clip_image007

2. Select Web and select Advanced

In this dialog paste the URL from the CURL dialog and add the x-api-key as a separate request header.

See the following two screen shots below.

clip_image009

clip_image011

 

The URL I am using is:

https://api.applicationinsights.io/v1/apps/AppKey/metrics/requests/count?timespan=P7D&interval=PT1H

 

clip_image013

3. Format the JSON into tables for Power BI

In the Query Editor select the values right click and choose “Into Table”

clip_image015

4. Expand the JSON into constituent columns

clip_image017

Expand Segments into Rows

clip_image019

Further Expand Segments into child columns

clip_image021

Further Expand the Count.Sum column from Segments.requests parent JSON.

clip_image023

At this point you can start looking at your applications run time data from Power BI collected by Application Insights!

clip_image025

As I am not seeing those big shark fins/oscillations to it looks like the DOS or campaign is over and everything looks like it is running fine!


Comments (0)

Skip to main content