How to monitor container app metrics in azure - azure

I'm new to the azure environment and wondering how it's possible to monitor an azure container app? Currently I've deployed a nodejs application by running a container app and I know how to query some logs by using the protocols section.
What I'm really looking into is how to get metrics like incoming requests or vcpu usage but I don't know how to get those metrics using azure monitoring.
How can I access those values?

It is possible to add Azure application insights SDK to your nodejs project. It will monitor your app activity like incoming/outcoming requests, database operations and etc. Also there is an option to add automatic metrics gathering:
See this documentation link for details.
let appInsights = require("applicationinsights");
appInsights.setup("<instrumentation_key>")
.setAutoDependencyCorrelation(true)
.setAutoCollectRequests(true)
.setAutoCollectPerformance(true, true)
.setAutoCollectExceptions(true)
.setAutoCollectDependencies(true)
.setAutoCollectConsole(true)
.setUseDiskRetryCaching(true)
.setSendLiveMetrics(true)
.start();

Related

Connect Azure IoTHub to application insights

I am building an application in Azure, and I really like the application Insights "Application Map". I would like to integrate IoTHub to the map, so I can check the entire stack from device to webinterface in one central place.
What I have tried:
I tried creating a diagnostic setting directly in the IoTHub.
For destination I used the same Log Analytics workspace as my application insights is using.
Results:
I can see logs using the "Logs" tab under the IoTHub, but nothing in the application insights.
The actual question:
How do I connect the IoTHub to the application insights? If this is not possible, what do you normally do to check if everything is as it should be inside the IoTHub?
Application Insights is a feature of Azure Monitor that provides extensible application performance management (APM) and monitoring for live web apps.
What metrics do you plan to track through Application Insights?
When you have critical applications and business processes relying on Azure resources, you want to monitor those resources for their availability, performance, and operation. You can use the features of Azure Monitor to analyze, monitor data generated by Azure IoT Hub and setup alerts.
Azure IoT Hub creates monitoring data using Azure Monitor, which is a full stack monitoring service in Azure that provides a complete set of features to monitor your Azure resources in addition to resources in other clouds and on-premises.
Start with the article Monitoring Azure resources with Azure Monitor, which describes the following concepts:
What is Azure Monitor?
Costs associated with monitoring
Monitoring data collected in Azure
Configuring data collection
Standard tools in Azure for analyzing and alerting on monitoring data
Please see Monitoring Azure IoT Hub and Set up and use metrics and logs with an IoT hub for more details.

Kafka monitoring in Azure

We are hosting Confluent Platform services(broker, zookeeper, schema-registry etc.) in Azure VMs. What is the best option to scrape metrics from these and visualize in Azure monitor or application insights?
I am thinking to scrape JMX metrics and visualize in azure monitor/app insights. Monitoring will include things like health status, message flow in topics, produce/consume rate, VM health etc.
What are some good options to implement this? Any better ideas?
PS- I only want to use Azure native services for monitoring/dashboards.
You can add java agents by exporting the environment variable KAFKA_OPTS. Through that, you can add any additional JVM monitoring
Azure docs - https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent

Azure monitor for containers v/s Application insights

We are designing an application which will be hosted on AKS(Azure kubernetes service). The application will consist of a set of services written in asp .net core running in docker containers. I want to monitor the services as well as the containers/nodes and have the observability across the cluster. Azure monitor for containers seems to be a good solution for monitoring containers, nodes and the cluster as a whole however I want the advanced monitoring capabilities of the application insights for the asp .net core services for example application maps, live metrics streams, transaction tracing and such features. Moreover, I don't want to have overlapping solutions. Is the Azure monitor for containers able to provide all or most of these application insights features or do I have to have both solutions in order to get proper cluster monitoring and also the advanced application monitoring?
Azure Monitor for containers provide infrastructure level monitoring and basic application logs with stdout and stderr, Kubernetes events captured out of the box.
It does not provide instrumentation for your apps or distributed tracing capabilities today, which is possible with Application Insights.
If you are looking for application map & instrumentation for events metrics and logs for your app, you can use both together and it's possible to correlate data from both and create dashboards and views.
The long term road map has Azure Monitor for containers & Application insights combined offering
In this (https://learn.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-overview) guide, you can find all the features of AKS monitoring. If these covers all your use cases then you don't need to install any other tool. If not, then you cover only those features which are missing.

How to generate an alert if deployment becomes 'Unhealthy' in Azure Machine Learning?

I deployed an Azure Machine Learning model to AKS, and would like to know how to set an alert if the deployment status changes to any value other than 'Healhty'. I looked at the monitoring metrics in the workspace, but it looks like they are more related to the training process (Model and Run) and Quotas. Please let me know if you have any suggestions
Thanks!
Aazure Machine Learning does not provide a way to continuously monitor the health of your webservice and generate alerts.
You can set up this fairly easily using Application Insights(AML Workspace comes with a provisioned Application Insights).
You can monitor the webservice scoring endpoint using URL ping or web test in App Insights.

How to see request logs Service Fabric Application

I want to know if is there a way to see all the requests made to my service fabric application while it is already published on azure servers, or at least capture all requests and save them in some place, I need informations like source and body.
Thanks in advance!
To see all the requests and responses, you first need to log them in somewhere. Here are the available approaches:
Streaming into VS Cloud Explorer
You could use ServiceEventSource to log the valuable information and
then you will be able to see it by attaching to your SF cluster via
CloudExplorer in VS. Here is you could find more info - Debug your
Service Fabric application by using Visual
Studio.
Windows Azure Diagnostics
WAD extension that you could install on your VM-s uploads logs to Azure Storage, and also has the option to send logs to Azure Application Insights or Event Hubs. Check out Event aggregation and collection using Windows Azure Diagnostics.
EventFlow
Using EventFlow allows you to have services send their logs directly to an analysis and visualization platform, and/or to storage. Other libraries (ILogger, Serilog, etc.) might be used for the same purpose, but EventFlow has the benefit of having been designed specifically for in-process log collection and to support Service Fabric services.
Event analysis and visualization with OMS
When OMS is configured, you will have access to a specific OMS workspace, from where data can be queried or visualized in dashboards.
After data is received by Log Analytics, OMS has several Management Solutions that are prepackaged solutions to monitor incoming data, customized to several scenarios. These include a Service Fabric Analytics solution and a Containers solution, which are the two most relevant ones to diagnostics and monitoring when using Service Fabric clusters. Find more info on Event analysis and visualization with OMS and Assess Service Fabric applications and micro-services with the Azure portal.
And there is a number of ways how you could capture source and body, or whatever you need. Below you could find some:
Apply ActionFilterAttribute on your controller class if you don't
have one, and log all the information you need within OnActionExecuted method
Add the middleware in Startup class -
public static void ConfigureApp(IAppBuilder appBuilder)
{
// Configure Web API for self-host.
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
appBuilder.Use(async (IOwinContext context, Func<Task> next) =>
{
await next.Invoke();
// log anything you want here
ServiceEventSource.Current.Message($"Response status code = {context.Response.StatusCode}");
});
appBuilder.UseWebApi(config);
}

Resources