Dynamic userId in kusto query Application Insights - azure

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

Related

How to create a single data tile in azure application insight dashboard?

How to create a single data tile in azure application insight dashboard ?
by single data i mean the XXX(A number)(which i found querying the application insights).
For say - I queried for unique users in Application Insight logs, and I want to display it as Single Data Tile on the Dashboard. i.e. just the number(XXX) and the heading (Unique Users For XYZ Application)
Workbooks will give you tons of features to create custom tiles showing just the number on the tile. Here's how to do it using Workbooks.
Try the code below, then pin to dashboard:
requests
//add the filter for querying unique users
| extend users=""
| summarize number_of_users = count() by users
| render barchart
The result:

Azure Log Analytics - Query Application Insight Custom Metrics

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`

BI Publisher / PeopleSoft Security Roles Report

Hey I am trying to create a report to display in a matrix type format the navigations and permissions that a user has. I already have a query set up that correctly gets the path associated with each user. I am having trouble creating the XML / BI Publisher template.
The staging table has the format
ROLE | COMPONENT | DISPLAYONLY | NAVIGATION PATH
and I want to convert this into a table where it may look something along the lines of
PATH | COMPONENT | ROLE1 | ROLE2 | ROLE3 | .... | ROLE N |
where it has all of the users access rights given a certain path. Any guidance is very much appreciated. Thanks
It appears your request is to print data horizontally, which has been answered previously here. This can be done via RTF templates, and there are samples provided by oracle here : C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\samples\RTF templates\Advanced\Dynamic Columns, where you have installed BIP Word Addon.

Adding AI Analytics query to AI dashboard?

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

cucumber feature: simulate multiple selection fields in a form

I have started writing the following feature within an app designed to manage a cleaning business:
Feature: Creating a new cleaner
In order to allow Franchisees to allocate cleaners to jobs they need to be uploaded to the system
Background:
Given I am currently logged in to my account
And I have navigated to the "Cleaners" page
And I want to add a new cleaner to the database
Scenario: Add a new cleaner to the system
Given I have brought up the "Add Cleaner" form
Then I will need to complete the fields within the following form:
| first_name |
| last_name |
| email |
| date_of_birth |
| postcode |
| mobile |
| other_phone |
| address_1 |
| address_2 |
| work_radius |
| **days_available** |
| notes |
When I have entered valid data
Then I can save to the database
And I will have added a new cleaner to the system
In addition to welcoming comments on the way I have written the scenarios etc, my main problem is that I can't work out how to simulate selecting from a pre-populated field:
Populating the days_available should allow the franchisee to choose which days of the week, and which hours within those days, that a cleaner will be available for work. This obviously makes it possible to return queries which only show available cleaners for any given day/time of day.
Really hope someone can explain how this is done?
Just a quick comment on the structure of your feature file ... the 'Then' step in your feature should be asserting that something has or has not been done successfully.
Given I have logged into the site
When I add a new Cleaner to the site
Then I should see that the Cleaner has been added successfully
I would recommend using language that can be easily understood. Your scenario doesn't need to be instructions on how to use the site. Excessive navigational steps can make you lose track of the purpose of the scenario.
To answer your question regarding days_available accurately, would require some knowledge of how the site is structured and how the days_available are entered. Are you choosing from select lists, filling in form fields, etc? Also, since you are testing, you could consider setting the data from within your step (ie. hash, array) instead of passing all of the info in via a table.
Just some food for thought. Cheers.
Based on your updated post, I would suggest the following:
The step And I want to add a new cleaner to the database doesn't seem like an actionable step and could be removed. Same for the step When I have entered valid data. If you handle filling out the form in the previous step, you have already entered valid data.
If you need to multiple available days, I would consider making it its own step
And(/^the cleaner is available from (.*?) to (.*?) on (.*?)$/) do |start_time, end_time, day|
#fill in start time
#fill in end time
#select day
end
Background:
Given I am currently logged in to my account
And I have navigated to the "Cleaners" page
Scenario:
And I bring up the "Add Cleaners" form
And I complete the form with
| first name | Bob |
| last name | Smith |
...
And the cleaner is available from 0600 to 1800 on W
When I submit the Add Cleaners form
Then I should see the new cleaner has been successfully added

Resources