> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Azurefunctions

> OpenTelemetry receiver for Azurefunctions

# Azurefunctions Receiver

![Status](https://img.shields.io/badge/status-development-orange)

**Maintainers:** [@jmacd](https://github.com/jmacd), [@MichaelKatsoulis](https://github.com/MichaelKatsoulis), [@constanca-m](https://github.com/constanca-m)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azurefunctionsreceiver)

## Supported Telemetry

![Logs](https://img.shields.io/badge/logs-development-blue) ![Metrics](https://img.shields.io/badge/metrics-development-green)

## Overview

## Overview

The Azure Functions receiver is an OpenTelemetry Collector receiver that integrates with Azure Functions as a custom handler. It receives **logs** and **metrics** from Azure Event Hubs via the Azure Functions runtime and converts them to OpenTelemetry format for further processing and export. The receiver is structured by trigger type (e.g. Event Hub); each trigger can expose multiple log and/or metrics bindings, each with its own encoding.

## How It Works

The receiver is designed to operate as part of an Azure Functions custom handler:

1. Azure Functions runtime consumes events from Azure Event Hubs (e.g. separate hubs or bindings for logs and metrics).
2. The runtime sends HTTP POST requests to the receiver (e.g. `POST /logs`, `POST /metrics`) for each binding name in your `function.json`.
3. The receiver decodes Azure Functions invoke requests containing Event Hub message batches.
4. Payloads are converted to OpenTelemetry logs or metrics using the encoding extension configured per binding.
5. Data is sent to the **logs** and/or **metrics** pipeline that references this receiver (independent pipelines; a shared HTTP server is used when both are configured).

## Configuration

The following receiver configuration parameters are supported.

| Name | Type | Description |
| - | - | - |
| `http` | confighttp.ServerConfig | **Required.** HTTP server settings (e.g. `endpoint: :9090`). Typically use `FUNCTIONS_CUSTOMHANDLER_PORT`. |
| `auth` | component.ID | Optional. Component ID of the extension that provides Azure authentication (e.g. token credential). |
| `triggers` | object | **Required.** Trigger configuration (e.g. Event Hub). At least one trigger with at least one log or metrics binding is required. |
| `triggers.event_hub` | object | Event Hub trigger configuration. Defines log and metrics bindings and metadata behavior. |
| `triggers.event_hub.logs` | list | List of log bindings. Each entry has `name` (binding name; maps to path `/<name>`) and `encoding` (component.ID). Binding names must be unique within this list and must not overlap with `triggers.event_hub.metrics`. |
| `triggers.event_hub.metrics` | list | List of metrics bindings. Same shape as `logs` (`name`, `encoding`). Binding names must be unique within this list and must not overlap with `triggers.event_hub.logs`. |
| `triggers.event_hub.include_metadata` | bool | Optional. When true, add Azure Functions invoke metadata (e.g. Event Hub partition context) to resource attributes. Default: false. |

The `triggers` section and at least one trigger with at least one log or metrics binding are required. Required fields must be set for the receiver to start.

* Use a **logs** pipeline with `receivers: [azure_functions]` to activate log bindings (HTTP routes are registered for each `triggers.event_hub.logs` entry when the logs pipeline exists).
* Use a **metrics** pipeline with the same receiver to activate metrics bindings (`triggers.event_hub.metrics`). The same `azure_functions` receiver name can appear in both pipelines.

### Example configuration

```yaml theme={null}
receivers:
  azure_functions:
    # HTTP server configuration
    http:
      endpoint: :${env:FUNCTIONS_CUSTOMHANDLER_PORT:-9090}

    # Optional: Azure auth extension
    auth: azureauth

    # Triggers: Event Hub with log and/or metrics bindings, each with its own encoding
    triggers:
      event_hub:
        logs:
          - name: logs
            encoding: azure_encoding
          - name: raw_logs
            encoding: azureresourcelogs_encoding
        metrics:
          - name: metrics
            encoding: azure_encoding
        include_metadata: true

extensions:
  azureauth:
    # Azure auth extension configuration
  azure_encoding:
    # Encoding extension configuration
  azureresourcelogs_encoding:
    # Encoding extension configuration

service:
  extensions: [azureauth, azure_encoding, azureresourcelogs_encoding]
  pipelines:
    logs:
      receivers: [azure_functions]
      exporters: [otlp]
    metrics:
      receivers: [azure_functions]
      exporters: [otlp]
```

## Supported Signal Decoders

* **Logs** — Per binding, an encoding extension (e.g. `azure_encoding`) that implements `plog.Unmarshaler` decodes the binding payload to OpenTelemetry logs.
* **Metrics** — Per binding, an encoding extension that implements `pmetric.Unmarshaler` decodes the payload to OpenTelemetry metrics.

## Requirements

* Deployed as an Azure Functions custom handler.
* Azure Functions host configuration (`host.json`) with custom handler settings.
* Event Hub trigger bindings configured in `function.json`; binding names should match the `triggers.event_hub.logs[].name` and `triggers.event_hub.metrics[].name` values (e.g. `logs`, `raw_logs`, `metrics`).

## Configuration

### Example Configuration

```yaml theme={null}
azure_functions:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding
        - name: raw_logs
          encoding: azureresourcelogs_encoding
      include_metadata: true

azure_functions/no_auth:
  http:
    endpoint: test:123
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding

azure_functions/no_http_config:
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding

azure_functions/no_triggers:
  http:
    endpoint: test:123
  auth: azureauth

azure_functions/no_event_hub:
  http:
    endpoint: test:123
  auth: azureauth
  triggers: {}

azure_functions/empty_event_hub_logs:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs: []

azure_functions/missing_binding_name:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - encoding: azure_encoding

azure_functions/missing_binding_encoding:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs

azure_functions/duplicate_binding_name:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding
        - name: logs
          encoding: azureresourcelogs_encoding

azure_functions/metrics_only:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      metrics:
        - name: metrics
          encoding: azure_encoding

azure_functions/logs_and_metrics:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding
      metrics:
        - name: metrics
          encoding: azure_encoding

azure_functions/empty_event_hub_logs_and_metrics:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs: []
      metrics: []

azure_functions/missing_metrics_binding_name:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      metrics:
        - encoding: azure_encoding

azure_functions/missing_metrics_binding_encoding:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      metrics:
        - name: metrics

azure_functions/duplicate_metrics_binding_name:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      metrics:
        - name: m
          encoding: azure_encoding
        - name: m
          encoding: azure_encoding

azure_functions/duplicate_binding_name_logs_and_metrics:
  http:
    endpoint: test:123
  auth: azureauth
  triggers:
    event_hub:
      logs:
        - name: logs
          encoding: azure_encoding
      metrics:
        - name: logs
          encoding: azure_encoding
```

***

*Last generated: 2026-10-05*
