No Custom Events in Application Insights - azure

Trying to create custom event in Application Insights but it doesn't show up on Azure Portal. All other events like requests, dependencies, exception are visible.
I have tried in dotnet core and can see following in debug log, but still no event in portal, even custom event table is empty:
Application Insights Telemetry: {"name":"Microsoft.ApplicationInsights.Dev.<instrumentkey>.Event","time":"2019-12-05T19:16:34.1373921Z","iKey":"<instrument key>","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"<role>","ai.session.id":"<session>","ai.user.id":"<user>","ai.operation.id":"<operation>","ai.operation.parentId":"|<some ids>","ai.operation.name":"GET /auth/login","ai.location.ip":"::1","ai.internal.sdkVersion":"dotnetc:2.11.0-21474","ai.internal.nodeName":"<subscription>"},"data":{"baseType":"EventData","baseData":{"ver":2,"name":"SAML_Authentication_Initiated","properties":{"DeveloperMode":"true","AspNetCoreEnvironment":"Local"}}}}
Tried from javascript as well, can see following successful post request in browser console:
POST https://dc.services.visualstudio.com/v2/track
[{"time":"2019-12-05T19:00:21.781Z","iKey":"<instrumentkey>","name":"Microsoft.ApplicationInsights.<instrumentkey>.Event","tags":{"ai.user.id":"<user>","ai.session.id":"<session>","ai.device.id":"browser","ai.device.type":"Browser","ai.operation.name":"/public","ai.operation.id":"<operationid>","ai.internal.sdkVersion":"javascript:2.3.1"},"data":{"baseType":"EventData","baseData":{"ver":2,"name":"CustomEvent","properties":{},"measurements":{}}}}]
Response
{"itemsReceived":1,"itemsAccepted":1,"errors":[],"appId":"<application id>"}
Not sure how much time Azure needs to process custom event or should I create support ticket or something is wrong at my end.

Application insights usually takes 3-5 minutes before data begins appearing in the portal, see the Note section of this official doc.
If you worry about the data is missing, you can use Flush() method.
And if it always takes more than 5 minutes before data appearing in portal, you should consider opening a support ticket to get professional help.

Related

Is there a way to get notified by Azure ApplicationInsights when a new exception appears?

We are using Application Insights by Azure. At the moment I have to manually check the exceptions after each deployment to see if a new one appeared. Has anyone figured out a way to get notified (via Azure alert) once a new exception appears? For example, other error trackers like Sentry support this.
Example:
We did a deployment at 15:15
A previously unknown exception appears at 15:17
An email is sent to me with content "New exception X appeared in project Y"
Here is a screenshot demonstrating this a bit more clearly:
Smart detections are being replaced by alets. The only way to get notifications is to write a query that will see your new exceptions. Configure the period to let alerts activate.
Navigate to the Application insights resource on Azure Portal.
Select Logs under the Monitoring blade.
Construct your log query and check the results.
Click on + New alert rule.
Configure your alert as follows:
The above alert fires whenever the count of results in Custom log search log query for the last 1 day is greater than 0, and is evaluated every 6 hours. You can customize the Period and frequency as needed.
You can also run through this detailed guide for troubleshooting problems with Azure Monitor alerts. Please check if this helps.
You can try Smart Detection, specifically the alert for abnormal rise in exception volume.
When would I get this type of smart detection notification?
You get this type of notification if your app is showing an abnormal rise in the number of exceptions of a specific type, during a day. This number is compared to a baseline calculated over the previous seven days. Machine learning algorithms are used for detecting the rise in exception count, while taking into account a natural growth in your application usage.
If you never got a specificy exception before a release, I would consider that a rise in exceptions for that type and you should get an alert. Though the alert won't happen if there are very few exceptions occuring, and it won't be as detailed as you described in your question.

Azure Monitor Data Collector API Powershell sample doesn't work

I tried to use the PowerShell sample https://learn.microsoft.com/en-us/azure/azure-monitor/platform/data-collector-api#powershell-sample without any changes.
It completes with status 200 (OK) and correctly creates a new table with LogType (MyRecordType) within the Custom Logs in the portal (Log Analytics Workspace->Logs).
However, the events that are submitted don't turn up there - there are always "No results from the last 24 hours". Also, within the new table, none of the custom properties are created.
Has anybody observed a similar problem? (Some people seem to be using the C# code successfully.) Thanks!
Crazy... on the next day, all the events had turned up in the Log Analytics workspace. Even new events that I generated turned up immediately.
It seems this was a glitch just on that day. Well, the API is in "preview"...

Retrieve Azure AppInsights Live Metrics through API

There is an one year old question How can I retrieve through an API *Live Metrics* of Microsoft Application Insights about is it possible to pull LiveMetrics data that appInsights generate for the application trough some API
Right now i don't see anything live related in the official documentation - https://dev.applicationinsights.io/reference . And the answer for old question was also that there is no any way to get them.
But maybe someone knows if AppInsights team plans were changed in this year and they are working on that API?
It might be really useful to pull that data in realtime through API to own alerting\metrics system to process data from different microservices\applications and display them in aggregated way in realtime.
As example we can build something like OpServer has but based on different applications and their AppInsights data .
As right now there is no any way to get it
Note: I work in Application Insights team at Microsoft.
LiveMetrics data is not persistently stored anywhere, and there is no API to retrieve it. The data is collected only when someone is actively on the Live Metrics portal page. The moment browser window is closed, data is gone as well.
If your goal is to get metrics/other in real-time, then you can do that by implementing own ITelemetryProcessor. Most people use ITelemetryProcessor to "filter" out unwanted telemetry. But that is not a rule. All telemetry passes through TelemetryProcessor, and you can chose to filter the data or do something else with it. In your case you want to send it instantly to some real-time service. In fact, LiveMetrics (internally known as QuickPulse) is implemented as a TelemetryProcessor. (https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/WEB/Src/PerformanceCollector/Perf.Shared/QuickPulseTelemetryProcessor.cs#L158)
General doc about TelemetryProcessor:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling#create-a-telemetry-processor-c

Azure Logic App fails to send message to slack

We have some Logic Apps setup that monitor our various sites and a Slack connection set up. If a non-200 status code is returned, it sends a message to our alerts channel in Slack. We have about 10 sites that are monitored.
The first was setup, tested the cloned for the other sites.
The issue we're having is that they all seem to work bar one.
The site in question was offline this morning (after host updated the server at 3am this morning) and I can in the Azure log the trigger was fired - but no message in Slack.
I changed the Condition to "status equals 200" (to ensure it always fires), ran it manually and still see no message.
As mentioned this logic app was cloned from one that did work so the only thing that changes from app to app is the site URL and the contents of the slack message.
Being relatively new to various Azure features this was a bit of "R&D" for Logic Apps so I'm not really sure what to check.
Any obvious gotchas we should be aware of? Any pointers you can give to help resolve this would be great.
NB: I added Slack API as a tag to this but as this part is handled by Azure and it's working for other Logic Apps feel free to remove.

Send message to azure queue Microsoft.ServiceBus.Messaging.MessagingEntityNotFoundException

I'm trying to follow along with this tutorial https://azure.microsoft.com/en-us/documentation/articles/service-bus-dotnet-multi-tier-app-using-service-bus-queues/ on azure queues but I opted for using an MVC app instead of the web role. I have everything working up to step 9 of the create a web role where it says you should now be able to hit submit and watch the message count increase of your queue on page.
Instead I get An exception of type 'Microsoft.ServiceBus.Messaging.MessagingEntityNotFoundException' occurred in Microsoft.ServiceBus.dll but was not handled in user code
Additional information: 40400: Endpoint not found.
on the step 8 line when it send the message to the queue. It detects the queue as being there or it wouldn't skip over the check for is it created so I have to think it's some kind of access issue.
Can someone please assist me?
So funny enough I had all the code correct as per the tutorial but after checking the error definition metadata it says that entity not found usually means it can't find the queue. So as a shot in the dark I looked at this line
OrdersQueueClient = messagingFactory.CreateQueueClient(
"OrdersQueue");
and guessed that maybe the OrdersQueue was actually supposed to match the name of my queue which I overlooked during my first go through. So if you get entity not found make sure you check your connection string and queue name in the azure portal. Hope this is helpful.

Resources