SSE Extractor
Connects to HTTP endpoints that stream events via the Server-Sent Events (SSE) protocol. Use it to consume live event streams from services that support push-based streaming.
Configuration
[sources.events.extractor]
type = "sse"
url = "https://events.example.com/stream"
max_retries = 10Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | SSE endpoint URL |
max_retries | integer | 10 | Maximum reconnection attempts |
headers | table | {} | Outgoing request headers (auth, etc.) |
trusted_redirect_hosts | array | [] | Glob patterns of hosts a cross-origin redirect may reach while keeping headers (headers are dropped otherwise; https → http is never trusted) |
user_agent | string | cdviz-collector/<version> | User-Agent header |
metadata | object | — | Static metadata for all events; context.source is auto-populated if unset |
Event Processing
- Body: Parsed as JSON if valid; stored as raw string otherwise
- Metadata:
sse_id,sse_event,sse_urlautomatically merged with extractor metadata - Retry: Exponential backoff (2^retry seconds, max 64s) on connection loss
Authentication
Bearer token
[sources.api_events.extractor.headers]
"authorization" = { type = "secret", value = "Bearer your-api-token" }API key (secret value)
Keep the secret out of the config file. Use the _file suffix to read it from a mounted file:
[sources.api_events.extractor.headers]
"x-api-key" = { type = "secret", value_file = "/run/secrets/api_key" }Or set via environment variable (see Configuration: Environment Variables).
→ Complete Header Authentication Guide
Common CI/CD Use Cases
Jenkins build events via SSE
Jenkins supports Server-Sent Events for build queue and executor events:
[sources.jenkins_builds]
enabled = true
transformer_refs = ["jenkins_to_cdevents"]
[sources.jenkins_builds.extractor]
type = "sse"
url = "https://jenkins.company.com/sse/builds"
[sources.jenkins_builds.extractor.headers]
"authorization" = { type = "secret", value_file = "/run/secrets/jenkins_api_token" }Consume from another CDviz Collector via SSE sink
CDviz Collector has an SSE sink that exposes an endpoint. One collector can consume from another:
[sources.upstream_collector]
enabled = true
transformer_refs = ["filter_events"]
[sources.upstream_collector.extractor]
type = "sse"
url = "https://collector-upstream.internal:8080/sse/events"
max_retries = 20Subscribe to a CI platform event stream
[sources.platform_events]
enabled = true
transformer_refs = ["platform_to_cdevents"]
[sources.platform_events.extractor]
type = "sse"
url = "https://platform.company.com/api/events/stream"
[sources.platform_events.extractor.headers]
"authorization" = { type = "secret", value = "Bearer eyJhbGciOiJSUzI1..." }Reconnection Behavior
The SSE extractor implements automatic reconnection with exponential backoff:
- Retry 1: wait 2s
- Retry 2: wait 4s
- Retry 3: wait 8s
- ... up to max 64s between retries
max_retries counts consecutive failures: once a connection is established, the budget resets, so a stream closed by an idle-timeout proxy reconnects with a fresh budget. When the budget is exhausted the source stops (max_retries = 0 disables reconnection). Events rejected downstream are logged and skipped; they do not break the stream.
Related
- Webhook Source: receive events via HTTP POST (push-based)
- HTTP Polling Source: poll HTTP endpoints on a fixed interval
- SSE Sink: expose an SSE stream from CDviz Collector
- Header Authentication: authenticate to SSE endpoints