Documentation
¶
Overview ¶
Package vercelreceiver implements an OpenTelemetry Collector receiver for Vercel Drains.
The Vercel receiver accepts observability data from Vercel's drain system via HTTP endpoints. It supports logs, traces (OTLP), speed insights (metrics), and web analytics data.
Configuration ¶
The receiver uses a unified configuration with a single HTTP endpoint for all data types. By default, it listens on port 8080 and exposes the following routes:
- POST /logs - Receives log drain data
- POST /traces - Receives trace drain data (OTLP JSON or Protobuf)
- POST /speed-insights - Receives speed insights/web vitals data
- POST /analytics - Receives web analytics events
- GET /health - Health check endpoint
Basic configuration example:
receivers:
vercel:
endpoint: "0.0.0.0:8080"
secret: "your-secret-key"
Advanced configuration with per-signal overrides:
receivers:
vercel:
endpoint: "0.0.0.0:8080"
secret: "default-secret"
logs:
route: "/custom-logs"
secret: "logs-specific-secret"
traces:
route: "/custom-traces"
speed_insights:
secret: "metrics-secret"
web_analytics:
# Uses defaults
Authentication ¶
The receiver supports Vercel's signature verification using the x-vercel-signature header. Signatures are computed using HMAC-SHA256. Authentication can be configured globally or per signal type. If no secret is configured, signature verification is disabled.
Data Formats ¶
The receiver accepts multiple data formats:
- Logs: JSON array or NDJSON (newline-delimited JSON)
- Traces: OTLP JSON or OTLP Protobuf
- Speed Insights: JSON array or NDJSON
- Web Analytics: JSON array or NDJSON
All data is converted to OpenTelemetry's internal data model (pdata) before being passed to the configured consumers.
Index ¶
Constants ¶
const (
TypeStr = "vercel"
)
Variables ¶
var ( LogsStability = component.StabilityLevelBeta TracesStability = component.StabilityLevelBeta MetricsStability = component.StabilityLevelBeta )
var Type = component.MustNewType(TypeStr)
Functions ¶
func NewFactory ¶
Types ¶
type Config ¶
type Config struct {
// Single endpoint for all data types (host:port format)
Endpoint string `mapstructure:"endpoint"`
// Default secret for all endpoints (can be overridden per signal type)
Secret string `mapstructure:"secret"`
// Default signature algorithm for all endpoints (can be overridden per signal type)
SignatureAlgorithm string `mapstructure:"signature_algorithm"`
// Per-signal configuration (optional overrides for routes and secrets)
Logs SignalConfig `mapstructure:"logs"`
Traces SignalConfig `mapstructure:"traces"`
SpeedInsights SignalConfig `mapstructure:"speed_insights"`
WebAnalytics SignalConfig `mapstructure:"web_analytics"`
}
func (*Config) GetLogsSecret ¶
GetLogsSecret returns the secret for logs (per-signal override or default)
func (*Config) GetSignatureAlgorithm ¶
GetSignatureAlgorithm returns the signature algorithm (global for all signals)
func (*Config) GetSpeedInsightsSecret ¶
GetSpeedInsightsSecret returns the secret for speed insights (per-signal override or default)
func (*Config) GetTracesSecret ¶
GetTracesSecret returns the secret for traces (per-signal override or default)
func (*Config) GetWebAnalyticsSecret ¶
GetWebAnalyticsSecret returns the secret for web analytics (per-signal override or default)
type SharedComponent ¶
type SharedComponent struct {
// contains filtered or unexported fields
}
SharedComponent ensures that the wrapped component is started and stopped only once. When stopped it is removed from the SharedComponents map.
func (*SharedComponent) Shutdown ¶
func (r *SharedComponent) Shutdown(ctx context.Context) error
Shutdown implements component.Component.
func (*SharedComponent) Unwrap ¶
func (r *SharedComponent) Unwrap() component.Component
Unwrap returns the original component.
type SharedComponents ¶
type SharedComponents struct {
// contains filtered or unexported fields
}
SharedComponents a map that keeps reference of all created instances for a given configuration, and ensures that the shared state is started and stopped only once.
func NewSharedComponents ¶
func NewSharedComponents() *SharedComponents
NewSharedComponents returns a new empty SharedComponents.
func (*SharedComponents) GetOrAdd ¶
func (scs *SharedComponents) GetOrAdd(key any, create func() component.Component) *SharedComponent
GetOrAdd returns the already created instance if exists, otherwise creates a new instance and adds it to the map of references.
type SignalConfig ¶
type SignalConfig struct {
Route string `mapstructure:"route"` // Optional: Override default route
Secret string `mapstructure:"secret"` // Optional: Override default secret
}
SignalConfig defines configuration for a specific signal type (logs, traces, metrics, analytics) Both route and secret are optional and will use defaults if not provided
type SignatureAlgorithm ¶
type SignatureAlgorithm string
SignatureAlgorithm defines the supported signature algorithms
const ( SignatureAlgorithmSHA1 SignatureAlgorithm = "sha1" SignatureAlgorithmSHA256 SignatureAlgorithm = "sha256" )