I have an Azure Application Insight component and separate Log Analytics component which pulls data from App Insight. Inside Log Analytics portal, Using Log Analytics query language (power query), I can get Application Insight Traces and Custom Events.
Custom Events in last 24H
customEvents
| where timestamp >= ago(24h)
| order by timestamp desc
Traces in last 24H
traces
| where timestamp >= ago(24h)
| order by timestamp desc
But I cannot read custom metrics I have created. I am not a query language expert. Can someone please tell me, is there a way to query that please?
if the custom metrics were sent along with events/traces (like trackEvent(name, properties, metrics), they'd be in the customMeasurements property in the customEvents or traces tables.
customEvents | where timestamp >= ago(24h)
| project timestamp, name, customMeasurements
| order by timestamp desc
if the custom metrics were sent as their own "events" via trackMetric(name, value, properties), then you'd look in the customMetrics table
customMetrics | where timestamp >= ago(24h) | order by timestamp desc`
Related
I'm new with Azure Application Insights service, I want to get data from my app (developed with Xamarin Forms, c#) and I need to make a specific query to be able to get a user stats and display it on my Azure Dashboard. I'm able to make this request for all users but not for one user. I show you my query
customEvents
| where name == "LoggedUserEvent"
| where timestamp > now() - 31d
| extend Properties = todynamic(tostring(customDimensions.Properties))
| extend userId = todouble(todecimal(Properties.UserId))
| where userId == XXX
| summarize Total = count() by bin(timestamp, 1d)
| project Total, timestamp
this query work's well and show me Total and timestamp as you can see
but the issue it's I should specify
| where userId == XXX
Each time I want new data about specific user I have to update this line, is there en easier way to get this info using an input text for example or if you have any suggestions, salespeople will use this platform and need to be simple as possible. Thank you in advance.
To achieve the above requirement you can try with page view method so that we can get specific users who logged in to your application instead of using Custom events.
Example of query:
pageViews
| project user_Id , timestamp
| summarize max(timestamp) by user_Id
For more information please refer the below links:-
SO THREAD : Application Insights - Distinct Users and the last time they visited the site & Trying to create a KQL with users who have not logged in within the last 30 days
In Azure dashboards, is there any way we can trigger alerts based on percentage instead of counts?.. Example if total total failures in 20 minutes is 20%, then trigger alert than just cheking the counts of the failures? Here setting the count is not meeting our requirement and looking a solution based on the Percentage of occurance.
Based on the above shared requirement , we have created the custom Kusto query to calculate the percentage of failure requests & to trigger an email alert notification if the failure requests percentage > 20% for a particular web app & also projecting the output of the Kusto query to the dashboard as well.
Here is the custom Kusto query :
requests
| where timestamp >= ago(6h)
| project success, ['id'], resultCode, appName
| summarize failedtotal = countif(success == 'False'), total= count()
| project failurepercentage = (100 * (failedtotal) / (total))
| summarize totalouputrows=countif(failurepercentage>20) by failurepercentage
Use the New alert rule option in the log analytics space to create a custom alert & using the above query as signal as shown in below picture.
Use the Pin to dashboard option in the log analytics work space to project the output of the custom Kusto query & create the dashboard accordingly.
Here is the sample image of the alert rule that was created using the above query.
Here is the sample email output & Kusto query output projected to dashboard triggered by above alert rule.
I am trying to make a chart in Application Insights to plot the number of a certain operation performed by my API every time it is called, grouped by the language it is performed for. I have added the following telemetry event:
telemetryClient.TrackEvent("Count event",
properties:new Dictionary<string, string>(){{"language", language}},
metrics:new Dictionary<string, double>(){ {"messageCount", operationCount } } );
In metric explorer, when I filter by my event name I can group by language as desired. I can see the operationCount value in the CustomData of the events when they are displayed as log entries, but I cannot show this value in the chart. I only get the option to aggregate on the Sum, which is a count of the number of times my API is called:
Is there any way I can make a chart with the operationCount values as the y axis and time as the x-axis, split out by language?
You should be able to do it using Application Insights Analytics (and then pin to dashboard if needed).
Below is an area chart by language with 10m buckets:
customEvents
| where timestamp > ago(1d)
| extend language = tostring(customDimensions.language)
| summarize sum(todouble(customMeasurements.messageCount)) by language, bin(timestamp, 10m)
| render areachart
Is it possible to make real-time monitoring report by using Power BI?
I have an experience only with elasticsearch+kibana and I want to make the same dashboard by using Power BI:
There is a data source - RequestDateTime, Sendor, IsSuccess, RequestType, Request, Response. For example:
2016-10-20 12:00:12 | Test 1 | True | SetUserInfo | xml here... | xml here...
2016-10-20 12:00:18 | Test 2 | False | GetUserInfo | xml here... |
This data can be downloaded from Azure SQL database, by using simple sql-query.
I want to make a simple column chart. X-axis should be a timeline, accoring to the RequestDateTime field. Y-axis should be a count of records, that is correspond to filters.
Report should have a filters by sendor, isSuccess, RequestType and RequestDateTime range (for example - last 6 hours).
The report should be able to be refreshed in a real-time mode, according to the new events in the database.
The pipeline I usually do in my work using app.powerbi for real time visualization is :
Create a dataset: In your workspace, select the "create" option, there you can import or connect to data from Files and Databases. You can choose Azure SQL database and follow instructions.
Create a report: In your dataset list, select the icon to create a report (here you define the filters that you want) and save it.
Create a dashboard: Pin the charts to a dashboard. I have found that only dashboard refresh itself when data is added or deleted in the database, thus, you can see the real time in the dashboard.
You may find this video useful.
I created a couple of queries in Application Insights Analytics to get me the charts I want.
Example:
customEvents
| where timestamp >= ago(31d)
| where name == "Search"
| project name, customDimensions, customMeasurements, customDimensions.["Query"]
| summarize count() by tostring(customDimensions.["Query"])
| render piechart
Now I was wondering if it is possible to add this query / chart to my Application Insights dashboard? I don't want to always have to go to the analytics tool to see this specific chart.
I've been googling but without result.
Thanks,
Thomas
This new capability is in the works and should be released in the upcoming weeks. Would definitely help to operationalize your queries. Stay tuned.
-Dan Hadari
Application Insights Team