autolemetry-backends
v2.0.1
Published
Vendor backend configurations for Autolemetry (Honeycomb, Datadog, etc.)
Maintainers
Readme
Autolemetry Backends
Vendor backend configurations for Autolemetry - simplified setup helpers for popular observability platforms.
What are Backends?
Backends are vendor-specific configuration helpers that simplify setting up Autolemetry with observability platforms like Honeycomb, Datadog, New Relic, etc.
They handle:
- Correct endpoint URLs for each vendor
- Authentication headers and API key formats
- Protocol selection (gRPC vs HTTP)
- Region-specific configurations
- Best practice defaults
Backends vs Plugins
| Package | Purpose | Examples | | ------------------------ | ----------------------------------------------------- | --------------------------- | | autolemetry-backends | Configure where telemetry goes (outputs) | Honeycomb, Datadog, Grafana | | autolemetry-plugins | Instrument libraries to create telemetry (inputs) | Drizzle ORM, custom SDKs |
Think of it this way: Plugins create the data, backends send it somewhere.
Installation
npm install autolemetry autolemetry-backendsQuick Start
Honeycomb
import { init } from 'autolemetry';
import { createHoneycombConfig } from 'autolemetry-backends/honeycomb';
init(
createHoneycombConfig({
apiKey: process.env.HONEYCOMB_API_KEY!,
service: 'my-app',
}),
);Datadog
import { init } from 'autolemetry';
import { createDatadogConfig } from 'autolemetry-backends/datadog';
// Direct cloud ingestion (serverless, edge)
init(
createDatadogConfig({
apiKey: process.env.DATADOG_API_KEY!,
service: 'my-lambda',
}),
);
// Or use local Datadog Agent (Kubernetes, long-running services)
init(
createDatadogConfig({
service: 'my-api',
useAgent: true,
}),
);Available Backends
🍯 Honeycomb
Honeycomb provides powerful distributed tracing and observability.
import { createHoneycombConfig } from 'autolemetry-backends/honeycomb';
init(
createHoneycombConfig({
apiKey: process.env.HONEYCOMB_API_KEY!,
service: 'my-app',
environment: 'production',
version: '1.0.0',
dataset: 'my-dataset', // Optional: for classic accounts
}),
);Features:
- Auto-configures gRPC protocol (Honeycomb's preferred)
- Supports both classic datasets and modern service-based routing
- Environment and version tagging
- Head-based sampling configuration
View full Honeycomb configuration options →
🐕 Datadog
Datadog provides comprehensive APM, infrastructure monitoring, and logs.
import { createDatadogConfig } from 'autolemetry-backends/datadog';
// Cloud ingestion (best for serverless/edge)
init(
createDatadogConfig({
apiKey: process.env.DATADOG_API_KEY!,
site: 'datadoghq.com', // or 'datadoghq.eu', 'us3.datadoghq.com', etc.
service: 'my-lambda',
environment: 'production',
enableLogs: true, // Optional: also send logs
}),
);
// Agent-based (best for Kubernetes/VMs)
init(
createDatadogConfig({
service: 'my-api',
useAgent: true,
agentHost: 'localhost', // or 'datadog-agent.default.svc.cluster.local'
agentPort: 4318,
}),
);Features:
- Direct cloud ingestion OR local agent
- Multi-region support (US1, US3, US5, EU, AP1, FedRAMP)
- Unified service tagging (service, env, version)
- Optional log export via OTLP
- Kubernetes-friendly agent configuration
View full Datadog configuration options →
Why Use Backend Configs?
Without backend configs (manual):
import { init } from 'autolemetry';
init({
service: 'my-app',
endpoint: 'https://api.honeycomb.io:443',
protocol: 'grpc',
otlpHeaders: {
'x-honeycomb-team': process.env.HONEYCOMB_API_KEY!,
'x-honeycomb-dataset': 'production',
},
environment: 'production',
version: '1.0.0',
});With backend configs:
import { init } from 'autolemetry';
import { createHoneycombConfig } from 'autolemetry-backends/honeycomb';
init(
createHoneycombConfig({
apiKey: process.env.HONEYCOMB_API_KEY!,
service: 'my-app',
environment: 'production',
version: '1.0.0',
}),
);Benefits:
- Less code, fewer mistakes
- Vendor best practices built-in
- Validated configurations
- Easy to switch vendors
Using Environment Variables
All backends work great with environment variables:
import { createHoneycombConfig } from 'autolemetry-backends/honeycomb';
init(
createHoneycombConfig({
apiKey: process.env.HONEYCOMB_API_KEY!,
service: process.env.SERVICE_NAME || 'my-app',
environment: process.env.NODE_ENV,
}),
);Or use Autolemetry's built-in env var support:
# .env
OTEL_SERVICE_NAME=my-app
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=YOUR_API_KEYimport { init } from 'autolemetry';
// Reads from env vars automatically
init({});Migration from autolemetry/presets
If you were using autolemetry/presets/*, migration is simple:
Before (v1.x):
import { createHoneycombConfig } from 'autolemetry/presets/honeycomb';After (v2.x):
npm install autolemetry-backendsimport { createHoneycombConfig } from 'autolemetry-backends/honeycomb';The configuration options are identical - only the import path changed.
Philosophy
Autolemetry follows the principle: "Write once, observe everywhere".
Backend configurations are:
- Optional: Use raw
init()config if you prefer - Vendor-agnostic at core: Keeping these separate maintains the vendor-neutral philosophy
- Best practices: Configurations follow vendor recommendations
- Tree-shakeable: Import only what you need
TypeScript
Full type safety with TypeScript:
import type {
HoneycombPresetConfig,
DatadogPresetConfig,
} from 'autolemetry-backends';
const honeycombConfig: HoneycombPresetConfig = {
apiKey: process.env.HONEYCOMB_API_KEY!,
service: 'my-app',
};
const datadogConfig: DatadogPresetConfig = {
apiKey: process.env.DATADOG_API_KEY!,
service: 'my-app',
site: 'datadoghq.com',
};Contributing
Want to add a new backend configuration? Please open an issue to discuss.
Popular backends we'd love to support:
- Grafana Cloud
- New Relic
- Lightstep
- Elastic APM
- AWS X-Ray
- Google Cloud Trace
License
MIT
