Skip to content

[PR] Webhook Exporter for OpenTelemetry: Push Data to HTTP Endpoint #38496

Open
@capiisco

Description

@capiisco

The purpose and use-cases of the new component

**Context : **
Currently, OpenTelemetry does not have a native exporter designed to push data to a custom HTTP endpoint. This PR introduces a Webhook Exporter that allows OpenTelemetry to send log data, metrics, or traces to an HTTP endpoint. This feature is useful for pushing OpenTelemetry data to systems that accept HTTP-based ingestion but do not have specific OpenTelemetry support.

Problem :
There are cases where organizations need to push telemetry data to external systems that accept HTTP requests, such as custom logging systems, third-party services, or RESTful APIs. OpenTelemetry's existing exporters might not fit the needs for sending data via webhooks or HTTP.

**Proposed Solution : **
This PR introduces a new Webhook Exporter that allows OpenTelemetry to send data to any configured HTTP endpoint using a simple HTTP POST request. This exporter supports sending logs, traces, or metrics in a configurable payload format (JSON, etc.).

The key features of the Webhook Exporter include:

Customizable HTTP Endpoint: Users can specify the HTTP endpoint URL to send the data.
Payload Format: Supports configuring the format (e.g., JSON or raw data) for the POST request body.
Authentication: Ability to configure basic authentication, API keys, or other methods for HTTP requests.
Retry Mechanism: Configurable retry logic in case of network failures or HTTP errors.

Example Configuration
Here’s an example configuration for the Webhook Exporter:

yaml :

exporters:
webhook:
endpoint: "https://example.com/telemetry" # The endpoint to send data
encoding: json # Encoding format for payload (e.g., json, raw)
headers:
Content-Type: application/json
Authorization: "Bearer "
retry:
enabled: true
max_retries: 5
backoff_interval: 2s

Implementation Details

HTTP POST Requests: The exporter sends telemetry data using HTTP POST requests. The payload will contain serialized telemetry data in the specified encoding format (e.g., JSON).
Custom Headers & Authentication: The exporter supports configuring custom HTTP headers, which may include authorization tokens, API keys, or other authentication mechanisms.
Error Handling & Retries: If the HTTP request fails, the exporter will automatically retry based on the configured retry logic.

Benefits :

  • Flexibility: Users can send telemetry data to any external HTTP-based system.
  • Customizability: Full control over the payload format, authentication, and headers.
  • Reliability: Built-in retry mechanism to handle transient network failures.

Example configuration for the component


yaml :

exporters:
webhook:
endpoint: "https://example.com/telemetry" # The endpoint to send data
encoding: json # Encoding format for payload (e.g., json, raw)
headers:
Content-Type: application/json
Authorization: "Bearer "
retry:
enabled: true
max_retries: 5
backoff_interval: 2s

Telemetry data types supported

log data, metrics, or traces

Code Owner(s)

No response

Sponsor (optional)

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions