Azure Functions

Azure Functions monitoring from trigger to dependency

by Obseria · Cloud platforms
  • OpenTelemetry
  • Application Observability
  • Cloud platforms
Category
Cloud platforms
Key metrics
9
Ready-made
5 dashboards & alerts
Setup
3 steps
Standard
OTLP

Switch the Functions host to OpenTelemetry, add the worker package and Obseria traces every invocation, with execution counts and errors from Azure Monitor alongside.

OpenTelemetry built into the host

With telemetryMode set to OpenTelemetry in host.json, the Functions host exports its own traces and logs via OTLP, not only your code.

Platform metrics included

The Collector's azuremonitor receiver pulls execution counts, execution units, HTTP errors and response times for your function apps.

From failed execution to cause

Obseria Intelligence links failing executions with the deploy, the slow dependency or the exception that caused them and shows the evidence.

Obseria interface

Obseria apps and capabilities: observability, APM, infrastructure and integrations
Obseria home dashboard with service health, open problems, SLO compliance and ingestion
Obseria trace explorer with span list and span attributes

Ready the moment data arrives

  • Function app overview: executions, errors, duration
  • Slowest functions and their dependencies
  • Alert on rising Http5xx per function app
  • Alert on failed executions for queue triggers
  • Execution units per app over time

What Obseria monitors in Azure Functions

Function invocations

A span per execution with trigger type, function name, duration and outcome, including the host's own spans.

Triggers and bindings

HTTP, Service Bus, Event Hubs, Storage Queue and Timer triggers, with trace context carried through messages where supported.

Outbound dependencies

HTTP calls, database queries and Azure SDK calls as child spans, instrumented by the language worker's OpenTelemetry setup.

Function app metrics

Execution count, execution units, requests, HTTP 4xx and 5xx and response time from Azure Monitor.

Logs

Host and worker logs exported over OTLP with trace and span IDs attached.

Hosting plans

Function apps on Consumption, Flex Consumption, Premium and Dedicated plans, as far as the platform publishes the metric.

The Azure Functions signals that matter

Obseria collects these values automatically and shows them in ready-made dashboards and alerts.

MetricUnitWhat it tells you
FunctionExecutionCountCountNumber of function executions per app, the baseline for error rates.
FunctionExecutionUnitsMB-msMemory multiplied by execution time, the consumption measure for Consumption plan billing.
RequestsCountHTTP requests handled by the function app.
Http5xxCountServer errors returned by HTTP-triggered functions.
Http4xxCountClient errors, useful to catch broken callers or authentication problems.
HttpResponseTimeSecondsTime the app takes to respond to HTTP requests.
MemoryWorkingSetBytesMemory used by the function app, to spot leaks across warm executions.
faas.invoke_durationsOpenTelemetry semantic convention histogram for invocation duration, where the runtime or your instrumentation records it.
faas.coldstarts{coldstart}OpenTelemetry semantic convention counter for cold starts, where recorded by the instrumentation.

Set up Azure Functions monitoring in minutes

  1. 1

    Enable OpenTelemetry in the host

    Set telemetryMode to OpenTelemetry in host.json and add OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS as app settings.

  2. 2

    Instrument the worker

    For .NET isolated, add Microsoft.Azure.Functions.Worker.OpenTelemetry and call UseFunctionsWorkerDefaults and UseOtlpExporter; other languages follow Microsoft's guide.

  3. 3

    Add platform metrics

    Run the OpenTelemetry Collector with the azuremonitor receiver, a service principal with Monitoring Reader and services set to Microsoft.Web/sites.

Example configuration · BASH
# host.json: let the Functions host emit OpenTelemetry instead of
# Application Insights telemetry
#   { "version": "2.0", "telemetryMode": "OpenTelemetry" }

# App settings: OTLP export to Obseria for host and worker
az functionapp config appsettings set \
  --name orders-func --resource-group rg-prod \
  --settings \
    OTEL_SERVICE_NAME=orders-func \
    OTEL_EXPORTER_OTLP_ENDPOINT=${OBSERIA_OTLP_ENDPOINT} \
    "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20${OBSERIA_TOKEN}"

# .NET isolated worker: add the packages ...
dotnet add package Microsoft.Azure.Functions.Worker.OpenTelemetry
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol

# ... and register them in Program.cs:
#   builder.Services.AddOpenTelemetry()
#       .UseFunctionsWorkerDefaults()
#       .UseOtlpExporter();

Why Azure Functions monitoring needs traces and platform metrics

Azure Functions lets teams run event-driven code without managing servers, but the operational questions remain. Why did a Service Bus message take minutes to process? Which dependency made an HTTP function slow after the last release? Did executions fail because of the code, a downstream service or a scaling limit? Azure Functions monitoring answers these questions only when you combine two views: traces from inside each execution, and platform metrics for the function app as a whole.

Microsoft has added native OpenTelemetry support to Azure Functions. When you set telemetryMode to OpenTelemetry in host.json, the Functions host emits its traces and logs in OpenTelemetry format and exports them to any OTLP endpoint configured through the standard OTEL_EXPORTER_OTLP_* app settings. Your language worker adds spans for your own code and its dependencies. That makes vendor-neutral Azure Functions tracing possible without the Application Insights SDK.

How the setup fits together

  • Functions host: telemetryMode in host.json switches the host to OpenTelemetry. It then sends spans for triggers and executions to the configured OTLP endpoint.
  • Language worker: for the .NET isolated worker, the package Microsoft.Azure.Functions.Worker.OpenTelemetry with UseFunctionsWorkerDefaults() connects worker spans with the host's trace context, and UseOtlpExporter() sends them over OTLP. Java, JavaScript, Python and PowerShell have their own steps in Microsoft's documentation.
  • Platform metrics: the OpenTelemetry Collector's azuremonitor receiver reads Azure Monitor metrics for Microsoft.Web/sites with a service principal that has the Monitoring Reader role. Limiting services to function apps keeps the number of API calls small.

Signals that matter for Azure serverless monitoring

  • Executions and failures: FunctionExecutionCount together with failed execution spans gives an error rate per function, also for non-HTTP triggers.
  • HTTP health: Requests, Http5xx, Http4xx and HttpResponseTime describe the user-facing side of HTTP-triggered functions.
  • Consumption: FunctionExecutionUnits combines memory and execution time, which is how the Consumption plan is billed. A jump after a release usually means slower or more memory-hungry code.
  • Memory: MemoryWorkingSet shows whether warm instances keep growing between executions.
  • Cold starts: the OpenTelemetry semantic conventions define faas.coldstart as a span attribute and faas.coldstarts as a metric. Whether they are populated depends on the runtime and instrumentation, so check the spans you receive before alerting on them.

Common Azure Functions problems and how to detect them

Slow dependencies

Most slow functions wait on something: a database, a storage account or another API. Child spans for each dependency show exactly where the time goes and whether the slowdown started with a deploy.

Growing queue backlogs

If a queue- or Service Bus-triggered function fails or slows down, messages pile up and are retried. Failed execution spans with the exception and the message's trace context reveal the cause, while the backlog itself is visible in the Service Bus or Storage metrics through the Azure integration.

Timeouts

Each hosting plan has a maximum execution time. Executions that approach it show up as long spans, often with one dependency call dominating. Alerting on duration close to the configured timeout catches them before they fail.

Cold starts on the Consumption plan

Functions that scale from zero start new instances, which adds latency to the first requests. Comparing response time after idle periods with steady-state traffic shows whether a Premium plan or always-ready instances are worth it.

Best practices for Function App monitoring

  1. Set OTEL_SERVICE_NAME per function app so each app appears as its own service.
  2. Store the Obseria token in Azure Key Vault and reference it from the app setting instead of entering it in plain text.
  3. Propagate trace context through messages so producer and consumer appear in one trace.
  4. Restrict the azuremonitor receiver to the resource types you need.
  5. Track service.version so regressions can be traced to a specific deployment.

How Obseria helps with Azure Functions monitoring

Obseria receives traces and logs from the Functions host and worker over OTLP and platform metrics through the OpenTelemetry Collector. TopoGraph places function apps next to the services, queues and databases they call. When errors or latency rise, Obseria Intelligence checks deploys, failing dependencies and exceptions and presents the root cause with its chain of evidence. Dashboards, alerts and SLOs are included, EU hosting is available, and all data stays exportable via OTLP.

Learn more

Azure Functions monitoring FAQ

No. With telemetryMode set to OpenTelemetry, the Functions host and the worker export over OTLP to the endpoint you configure. You can keep Application Insights in parallel if other teams rely on it.

Microsoft documents OpenTelemetry for the .NET isolated worker, Java, JavaScript and TypeScript, Python and PowerShell. The setup differs per language, so follow the current Azure Functions OpenTelemetry guide for your runtime.

Run the OpenTelemetry Collector with the azuremonitor receiver and a service principal with Monitoring Reader. It reads Azure Monitor metrics such as FunctionExecutionCount and Http5xx for all function apps in the subscription.

Yes, as long as the trace context travels with the message. Service Bus and Event Hubs carry W3C trace context through the Azure SDKs, so the producer and the triggered function appear in one trace.

OpenTelemetry export works on Consumption, Flex Consumption, Premium and Dedicated plans. The set of Azure Monitor metrics differs slightly per plan, so check which ones your plan publishes.

Start monitoring Azure Functions today

Connect Azure Functions in minutes with OpenTelemetry or the Obseria Agent. Free for 14 days.