Azure function monitoring with Azure Monitor and Application Insights

September 26, 2022 – Samuli Seppänen

Microsoft Azure provides a metrics and monitoring framework called Azure Monitor. With it you can monitor your Cloud infrastructure and services running there. You can view graphs of the metrics, alert on threshold and all that usual stuff, just like in AWS Cloudwatch.

Some Cloud resources like Azure Functions expose "a limited number of useful metrics" in Azure Monitor. This is a polite way of saying that the metrics are "completely useless" for most intents and purposes. For example, an Azure Function that gets triggered a few times a week on an irregular schedule by real people you don't really have any useful metrics in Azure Monitor which you could alert on if something is off.

Fortunately you can use Application Insights to get more useful metrics. Application Insights extends Azure Monitor, but is not particularly tightly coupled with it. This is clear from the fact that both in Azure Portal and with Azure command-line they're completely separate things. Fortunately for us both Azure Monitor and Application Insights are supported by azure-metrics-exporter, which allows getting both metrics into Prometheus.

We are command-line guys, so here how you can get a list of metrics available in Azure Monitor and Application Insights. First log in to Azure - you can skip the tenant part if you only have access one:

$ az login --tenant example.onmicrosoft.com

First we get Azure Monitor metrics. Note that the resource-uri is the URI of the Azure Function itself:

$ az monitor metrics list-definitions --resource <resource-uri>

Then Application Insights metrics. Note that the --app parameter expect an URI of the Application Insights "component" of a Function, not a Function's resource URI:

az monitor app-insights metrics get-metadata --app <app-insights-component-uri>

Prometheus integration will follow up in future blog post, stay tuned!

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!
Categories

Tags

#aad #Access #acl #alertmanager #ansible #ansible module development #Apache #API #augeas #authentication #authorization #automation #automatization #aws #azure #backup #bash #bitbucket #buildbot #cache #centos #cloud #cloud-init #cloudflare #cloudfront #cluster #connectionsJpa #control repo #custom fact #database #debian #devops #digital sovereignty #DNS #docker #domain mode #duplo #ejabberd #email #encryption #erb #europe #eyaml #fabric #facter #facts #fargate #fedora #file #finnish #foreman #freeipa #git #github #gitlab #gnome #google #grafana #hammer #hiera #IAM #import #infinispan #Infrastructure as Code #ipmi #irc #jboss #jdk #jenkins #JMESPath #kanban #keycloak #librarian-puppet #librenms #linkedin #Linux #Location #loop #marketing #mautic #Mellon #mfa #monitoring #mysql #nagios #network-manager #oauth #oauth2 #office365 #open source #openvpn #oxygen #packer #paranormal #pdk #people #php #pkcs7 #pomodoro #Powershell #preseed #presentation #profiles #prometheus #provisioning #puppet #puppet-bolt #puppet-litmus #puppetboard #puppetdb #Puppetfile #puppetserver #puppet types and providers #pxeboot #qemu #quality #r10k #recruitment #redirect #Restrict #Reverse Proxy #roles #rspec #ruby #SAML #sem #shell #showsql #snmp #snmpd #software developement #spam #ssh #sso #standardization #systemd #systemd-resolved #teams #terraform #ubuntu #user-data #vagrant #vanity awards #variable #vim #virtualbox #visualstudio #webdevelopment #wildfly #Windows #wireguard #wordpress #workflow #x11 #xmpp #zimbra
We are
 Puppeteers
menucross-circle