Monitoring request duration on azure aks - azure

I'm working on a project hosted on Azure using AKS. I was asked to monitor the performance of some requests. I remember I could use Application Insights to see requested URLs and their duration when hosting an application in Azure AppService.
Is there something similar for AKS? I'd like to see the URLs I'm hitting and the completion times of those requests.

Yes, you can. Adding to #ZakiMa's comment above, codeless instrumentation of Azure Kubernetes Service is currently available for only for Java applications through the standalone agent. To monitor applications in other languages use the SDKs.

Related

Handling Azure Event Hub events via Azure Functions vs .NET Console App using Azure.Messaging.EventHub SDK, any practical differences?

My app needs a background service that constantly receives and handles events streamed from an Azure Event Hub.
I see that Azure Functions has built-in triggers for this, but the problem is that my app is written in .NET 5 and Azure Function support for it is fairly immature at this point.
I also see from this documentation that .NET has an readily-made SDK Azure.Messaging.EventHubs. My understanding is that this will run as a console app.
I'm already using the Azure App Service (Linux plan) to host the main web app.
So if I create a console app using Azure.Messaging.EventHubs, I'd want to deploy it as something like a web job, but the Linux app service plan doesn't support it. I guess I can deploy the console app it to a separate Windows App Service plan.
What's the next best option? Are there any practical differences compared to using Azure Functions?
There's also this .NET Core Worker Service that's more optimized for background services. I wonder if there's a place for it in this use case.
These options are confusing me a bit. Your advices would be greatly appreciated.
Azure function should be the best choice. It has the built-in eventhub trigger and process logic, and easy to setup / configure(like logging via Application Insights) / less code to write. And recently(Mar 10 2021), it is supported for running production .NET 5 apps on Azure Functions. I suggest you can give it a try and use it if no issues.
For azure webjobs, in this case, if you're directly using the SDK, you need to write many codes and configure something like logging.
For .NET Core Worker Service, it can also be published as azure webjobs if you want to use it. You can follow this doc on how to publish worker service as azure webjob.

Azure Deploy: No Worker assigned to App Service Plan. Site Cannot Serve any requests. How To?

I'm trying to deploy my solution to Azure so my website can be accessed through the Internet.
When I deploy, Azure DevOps tells me Release/Deploy succeeds, but when I open the azurewebsties.net-URL, I get a 404.
After running some diagnostics, it tells me:
Currently no worker is assigned to the app service plan. The site cannot serve any requests.
When I research on how to Add a worker I find this link
https://learn.microsoft.com/en-us/azure-stack/operator/azure-stack-app-service-add-worker-roles?view=azs-2008&tabs=azurerm
But when I try and follow it, my azure interface is too different from theirs, and things don't add up. It says:
Azure App Service on Azure Stack Hub supports free and shared worker tiers by default.
I don't see any worker tiers at all, the tutorial-mentioned tab Roles, deals with userPermissions.
JSON resource seem to show there are no workers indeed.
But diagnostics also says following information is logged by... a worker.
Though I cannot exclude problems elsewhere for a 100%, It really seems to be a worker-problem.
Build- & ReleasePipeline succeed, Artifact get uploaded & deployed, Authentication & KeyVault is good, I get Request&Response Activity in AzurePortal-Graphs. But no website.
So my questions are:
What are these workers, what do they do high-level? Operate like some kind of ServiceBus between WebApp & Azure? What language/format are they in?
How and where can I add one? Is it in code (angular/c#), JSON or in azure portal?
Where can I find up to date documentation
Anybody know how to tackle this?
Thanks in advance!

Production web api hosting, web app for containers or azure container instances?

I have an ASP.NET core 3.1 based web api ready to deploy to Azure for production use. For test / development, I have been deploying it to a traditional app service on Azure which I believe is a shared Windows VM under the hood. I have been on F1 tier and it suits my needs for test and dev.
But for production, even the cheapest plan costs me $93.44 per month which I would like to avoid if I can.
In order to lower the cost, I have decided to containerize my app and deploy it using "web app for containers" or "azure container instances". My question is, based on your experience, which method will give me reasonable production-scale performance while minimize my monthly cost? Or would containerize my app save me any money at all?
Please note that I have evaluated Azure Functions and decided it is not what I would like to use.
For your requirements, first of all, you need to know that the Azure Container Instance benefits for its quick start and running. See this:
Azure Container Instances is a great solution for any scenario that
can operate in isolated containers, including simple applications,
task automation, and build jobs.
It's good for the simple application, but not good for scenarios where you need full container orchestration, including service discovery across multiple containers, automatic scaling, and coordinated application upgrades. And I think it's also not stable for the production use, it's more appropriate for the test.
And the Azure App Service is cost according to the service plan, the service plan billed on a per second basis. You can plan the use with time as you need and the App Service has more features than Container Instance. Or if you do not satisfied with App Service, maybe you can take a look at the Azure Kubernetes Service, it has more control and feature then the Container Instance.
As of beginning of 2022 looks like Container Instances and Web Apps for containers will be the same ~32eur which is a bit better than the app service ~50eur.

Azure: Can I deploy Web Jobs to a Worker Role?

Azure Web Jobs are a big time saver in that they solve the plumbing of triggers, continuous running, dashboard, etc. But I've only seen them run in Web sites. It'd be great to be able to move them to a Worker Role. Do you have suggestions about how to do it?
I'd personally love to see how they implement it, so that I can replicate it in my worker role, without reinventing the wheel...
The answer to the main question is No Azure WebJobs are part of Azure Websites and only run in an Azure Website context/host.
But Azure WebJobs SDK which is an SDK that allows you to write code that is triggered on Azure storage blobs/queues and Azure service bus queues including some great logging capabilities, can be used outside of Azure WebJobs and so they can run anywhere (locally, VMs, WebRoles).
It is important to understand that Azure WebJobs are a framework that is part of Azure Websites that allows (almost) any console application (and .bat, .php, .js, ... scripts) to run continuously or triggered (manually/scheduled).
WebJobs SDK and WebJobs are not dependent on each other although they work great together.
Also to see how it's implemented go to https://github.com/projectkudu/kudu as it's open sourced (for now The WebJobs part, SDK may be open sourced in the future).
Yes, you can use Azure WebJobs outside of Azure Web Sites. You use the Azure WebJobs SDK to do so. There is a sample on MSDN on how to use the SDK in an console app. It then goes on to host it in a web site, but you can of course host it in other ways. There is another article, "Hosting Azure webjobs outside Azure, with the logging benefits from an Azure hosted webjob" that explicitly talks about using WebJobs outside of Azure. With a little work this should work in a Worker role as well.
I'll stipulate that I've not actually done this myself, but the SDK does make it possible.
I'd also recommend this treasure trove of resources for WebJobs.

Is it possible to use Azure diagnostics without being in a hosted service

I have several web and worker roles in my solution, but I also have a non-Azure application running on a Azure hosted VM. That application connects to Azure storage for various things like reading and writing blobs and queues, and that works fine.
I'd like to use Azure diagnostics from within that same application (a .NET app running on a VM hosted in Azure). However, if I try to initialize diagnostics I get an exception that:
System.InvalidOperationException: Not running in a hosted service or the Development Fabric.
This makes sense, but I'm wondering if it's possible to use the diagnostics in some way without being a hosted service. In particular, I'm using azure diagnostics to gather logging information, written out by System.Diagnostics.Trace, and that's all hidden away from the application code, so if there were some other APIs I have a place I can probably slot that in.
Any ideas?
Thanks,
JC
Unfortunately, no. At least not today. The agent has some hard-coded checks for the RoleEnvironment stuff and when it is not there, it fails. This is also the reason you cannot use the agent in the IaaS stuff today either.

Resources