autotel-backends 2.2.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/datadog.js CHANGED
@@ -37,7 +37,7 @@ function createDatadogConfig(config) {
37
37
  const cloudConfig = {
38
38
  ...baseConfig,
39
39
  endpoint: otlpEndpoint,
40
- otlpHeaders: authHeaders
40
+ headers: authHeaders
41
41
  };
42
42
  if (enableLogs) {
43
43
  if (logRecordProcessors) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/datadog.ts"],"names":[],"mappings":";;;AA+KO,SAAS,oBACd,MAAA,EACe;AACf,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,IAAA,GAAO,eAAA;AAAA,IACP,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA,GAAa,KAAA;AAAA,IACb,QAAA,GAAW,KAAA;AAAA,IACX,SAAA,GAAY,WAAA;AAAA,IACZ,SAAA,GAAY,IAAA;AAAA,IACZ;AAAA,GACF,GAAI,MAAA;AAGJ,EAAA,IAAI,CAAC,QAAA,IAAY,CAAC,MAAA,EAAQ;AACxB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KAEF;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAA4B;AAAA,IAChC,OAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AAGA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,MAAM,aAAA,GAAgB,CAAA,OAAA,EAAU,SAAS,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AAEtD,IAAA,OAAO;AAAA,MACL,GAAG,UAAA;AAAA,MACH,QAAA,EAAU;AAAA;AAAA,KAEZ;AAAA,EACF;AAIA,EAAA,MAAM,YAAA,GAAe,gBAAgB,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,WAAA,GAAc,cAAc,MAAM,CAAA,CAAA;AAExC,EAAA,MAAM,WAAA,GAA6B;AAAA,IACjC,GAAG,UAAA;AAAA,IACH,QAAA,EAAU,YAAA;AAAA,IACV,WAAA,EAAa;AAAA,GACf;AAGA,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,IAAI,mBAAA,EAAqB;AAEvB,MAAA,WAAA,CAAY,mBAAA,GAAsB,mBAAA;AAAA,IACpC,CAAA,MAAO;AAEL,MAAA,IAAI;AAGF,QAAA,MAAM,WAAA,GAAc,aAAA,CAAc,OAAA,CAAQ,GAAA,KAAQ,eAAe,CAAA;AAEjE,QAAA,MAAM,EAAE,yBAAwB,GAAI,WAAA;AAAA,UAClC;AAAA,SACF;AACA,QAAA,MAAM,EAAE,iBAAgB,GAAI,WAAA;AAAA,UAC1B;AAAA,SACF;AAEA,QAAA,WAAA,CAAY,mBAAA,GAAsB;AAAA,UAChC,IAAI,uBAAA;AAAA,YACF,IAAI,eAAA,CAAgB;AAAA;AAAA,cAElB,GAAA,EAAK,GAAG,YAAY,CAAA,QAAA,CAAA;AAAA,cACpB,OAAA,EAAS;AAAA,gBACP,YAAA,EAAc;AAAA;AAChB,aACD;AAAA;AACH,SACF;AAAA,MACF,CAAA,CAAA,MAAQ;AACN,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SAEF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,WAAA;AACT","file":"datadog.js","sourcesContent":["/**\n * Datadog preset for autotel\n *\n * Provides a simplified configuration helper for Datadog integration\n * with best practices built-in.\n *\n * @example Direct cloud ingestion (serverless, edge)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-lambda',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Local Datadog Agent (long-running services, Kubernetes)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true, // No API key needed - Agent handles it\n * }));\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { AutotelConfig } from 'autotel';\nimport type { LogRecordProcessor } from '@opentelemetry/sdk-logs';\n\n/**\n * Datadog site regions\n */\nexport type DatadogSite =\n | 'datadoghq.com' // US1 (default)\n | 'datadoghq.eu' // EU\n | 'us3.datadoghq.com' // US3\n | 'us5.datadoghq.com' // US5\n | 'ap1.datadoghq.com' // AP1\n | 'ddog-gov.com'; // US1-FED\n\n/**\n * Configuration options for Datadog preset\n */\nexport interface DatadogPresetConfig {\n /**\n * Datadog API key (required for direct cloud ingestion).\n * Not needed if using local Datadog Agent (useAgent: true).\n *\n * Get your API key from:\n * https://app.datadoghq.com/organization-settings/api-keys\n */\n apiKey?: string;\n\n /**\n * Datadog site/region.\n * Determines which Datadog intake endpoint to use.\n *\n * @default 'datadoghq.com' (US1)\n */\n site?: DatadogSite;\n\n /**\n * Service name (required).\n * Appears in Datadog APM, Service Catalog, and all telemetry.\n */\n service: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Datadog.\n *\n * @default process.env.DD_ENV || process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n * Enables Deployment Tracking in Datadog APM.\n *\n * @default process.env.DD_VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Enable log export to Datadog via OTLP.\n * Requires peer dependencies: @opentelemetry/sdk-logs, @opentelemetry/exporter-logs-otlp-http\n *\n * @default false\n */\n enableLogs?: boolean;\n\n /**\n * Use local Datadog Agent instead of direct cloud ingestion.\n *\n * Benefits:\n * - Lower egress costs (Agent aggregates locally)\n * - Advanced features: trace-log correlation, multi-line logs, data scrubbing\n * - 500+ integrations for enrichment\n * - Infrastructure metrics collection\n *\n * Requires: Datadog Agent 7.35+ with OTLP enabled\n *\n * @default false\n */\n useAgent?: boolean;\n\n /**\n * Datadog Agent hostname (when useAgent: true).\n *\n * @default 'localhost'\n */\n agentHost?: string;\n\n /**\n * Datadog Agent OTLP port (when useAgent: true).\n *\n * @default 4318 (OTLP HTTP)\n */\n agentPort?: number;\n\n /**\n * Custom log record processors (advanced).\n * Overrides the default log processor if enableLogs is true.\n */\n logRecordProcessors?: LogRecordProcessor[];\n}\n\n/**\n * Create an autotel configuration optimized for Datadog.\n *\n * This preset handles:\n * - Proper OTLP endpoint configuration (Agent vs direct ingestion)\n * - Direct: https://otlp.{site} → SDK appends /v1/traces, /v1/metrics, /v1/logs\n * - Agent: http://localhost:4318 (default)\n * - Datadog API key authentication headers (direct ingestion only)\n * - Unified service tagging (service, env, version)\n * - Resource attribute best practices\n * - Optional log export configuration\n *\n * @param config - Datadog-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple cloud ingestion\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With logs and custom environment\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * environment: 'production',\n * version: '2.1.0',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Using local Datadog Agent\n * ```typescript\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true,\n * agentHost: 'datadog-agent.default.svc.cluster.local', // Kubernetes\n * }));\n * ```\n */\nexport function createDatadogConfig(\n config: DatadogPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n site = 'datadoghq.com',\n service,\n environment,\n version,\n enableLogs = false,\n useAgent = false,\n agentHost = 'localhost',\n agentPort = 4318,\n logRecordProcessors,\n } = config;\n\n // Validation: API key required for direct ingestion\n if (!useAgent && !apiKey) {\n throw new Error(\n 'Datadog API key is required for direct cloud ingestion. ' +\n 'Either provide apiKey or set useAgent: true to use local Datadog Agent.',\n );\n }\n\n const baseConfig: AutotelConfig = {\n service,\n environment,\n version,\n };\n\n // Local Datadog Agent configuration\n if (useAgent) {\n const agentEndpoint = `http://${agentHost}:${agentPort}`;\n\n return {\n ...baseConfig,\n endpoint: agentEndpoint,\n // No API key or headers needed - Agent handles authentication\n };\n }\n\n // Direct cloud ingestion configuration\n // Datadog OTLP endpoint: base URL without path (SDK appends /v1/traces, /v1/metrics, /v1/logs)\n const otlpEndpoint = `https://otlp.${site}`;\n const authHeaders = `dd-api-key=${apiKey}`;\n\n const cloudConfig: AutotelConfig = {\n ...baseConfig,\n endpoint: otlpEndpoint,\n otlpHeaders: authHeaders,\n };\n\n // Add log export if enabled\n if (enableLogs) {\n if (logRecordProcessors) {\n // Use custom processors if provided\n cloudConfig.logRecordProcessors = logRecordProcessors;\n } else {\n // Create default OTLP log exporter\n try {\n // Lazy-load to preserve optional peer dependencies\n // Use createRequire to resolve from user's project directory\n const userRequire = createRequire(process.cwd() + '/package.json');\n\n const { BatchLogRecordProcessor } = userRequire(\n '@opentelemetry/sdk-logs',\n );\n const { OTLPLogExporter } = userRequire(\n '@opentelemetry/exporter-logs-otlp-http',\n );\n\n cloudConfig.logRecordProcessors = [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({\n // Logs use /v1/logs path (SDK appends this to endpoint)\n url: `${otlpEndpoint}/v1/logs`,\n headers: {\n 'dd-api-key': apiKey,\n },\n }),\n ),\n ];\n } catch {\n throw new Error(\n 'Log export requires peer dependencies: @opentelemetry/sdk-logs and @opentelemetry/exporter-logs-otlp-http. ' +\n 'Install them with: npm install @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http',\n );\n }\n }\n }\n\n return cloudConfig;\n}\n"]}
1
+ {"version":3,"sources":["../src/datadog.ts"],"names":[],"mappings":";;;AA+KO,SAAS,oBACd,MAAA,EACe;AACf,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,IAAA,GAAO,eAAA;AAAA,IACP,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA,GAAa,KAAA;AAAA,IACb,QAAA,GAAW,KAAA;AAAA,IACX,SAAA,GAAY,WA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AAA,CAAA;AAAA,cACpB,OAAA,EAAS;AAAA,gBACP,YAAA,EAAc;AAAA;AAChB,aACD;AAAA;AACH,SACF;AAAA,MACF,CAAA,CAAA,MAAQ;AACN,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SAEF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,WAAA;AACT","file":"datadog.js","sourcesContent":["/**\n * Datadog preset for autotel\n *\n * Provides a simplified configuration helper for Datadog integration\n * with best practices built-in.\n *\n * @example Direct cloud ingestion (serverless, edge)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-lambda',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Local Datadog Agent (long-running services, Kubernetes)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true, // No API key needed - Agent handles it\n * }));\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { AutotelConfig } from 'autotel';\nimport type { LogRecordProcessor } from '@opentelemetry/sdk-logs';\n\n/**\n * Datadog site regions\n */\nexport type DatadogSite =\n | 'datadoghq.com' // US1 (default)\n | 'datadoghq.eu' // EU\n | 'us3.datadoghq.com' // US3\n | 'us5.datadoghq.com' // US5\n | 'ap1.datadoghq.com' // AP1\n | 'ddog-gov.com'; // US1-FED\n\n/**\n * Configuration options for Datadog preset\n */\nexport interface DatadogPresetConfig {\n /**\n * Datadog API key (required for direct cloud ingestion).\n * Not needed if using local Datadog Agent (useAgent: true).\n *\n * Get your API key from:\n * https://app.datadoghq.com/organization-settings/api-keys\n */\n apiKey?: string;\n\n /**\n * Datadog site/region.\n * Determines which Datadog intake endpoint to use.\n *\n * @default 'datadoghq.com' (US1)\n */\n site?: DatadogSite;\n\n /**\n * Service name (required).\n * Appears in Datadog APM, Service Catalog, and all telemetry.\n */\n service: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Datadog.\n *\n * @default process.env.DD_ENV || process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n * Enables Deployment Tracking in Datadog APM.\n *\n * @default process.env.DD_VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Enable log export to Datadog via OTLP.\n * Requires peer dependencies: @opentelemetry/sdk-logs, @opentelemetry/exporter-logs-otlp-http\n *\n * @default false\n */\n enableLogs?: boolean;\n\n /**\n * Use local Datadog Agent instead of direct cloud ingestion.\n *\n * Benefits:\n * - Lower egress costs (Agent aggregates locally)\n * - Advanced features: trace-log correlation, multi-line logs, data scrubbing\n * - 500+ integrations for enrichment\n * - Infrastructure metrics collection\n *\n * Requires: Datadog Agent 7.35+ with OTLP enabled\n *\n * @default false\n */\n useAgent?: boolean;\n\n /**\n * Datadog Agent hostname (when useAgent: true).\n *\n * @default 'localhost'\n */\n agentHost?: string;\n\n /**\n * Datadog Agent OTLP port (when useAgent: true).\n *\n * @default 4318 (OTLP HTTP)\n */\n agentPort?: number;\n\n /**\n * Custom log record processors (advanced).\n * Overrides the default log processor if enableLogs is true.\n */\n logRecordProcessors?: LogRecordProcessor[];\n}\n\n/**\n * Create an autotel configuration optimized for Datadog.\n *\n * This preset handles:\n * - Proper OTLP endpoint configuration (Agent vs direct ingestion)\n * - Direct: https://otlp.{site} → SDK appends /v1/traces, /v1/metrics, /v1/logs\n * - Agent: http://localhost:4318 (default)\n * - Datadog API key authentication headers (direct ingestion only)\n * - Unified service tagging (service, env, version)\n * - Resource attribute best practices\n * - Optional log export configuration\n *\n * @param config - Datadog-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple cloud ingestion\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With logs and custom environment\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * environment: 'production',\n * version: '2.1.0',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Using local Datadog Agent\n * ```typescript\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true,\n * agentHost: 'datadog-agent.default.svc.cluster.local', // Kubernetes\n * }));\n * ```\n */\nexport function createDatadogConfig(\n config: DatadogPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n site = 'datadoghq.com',\n service,\n environment,\n version,\n enableLogs = false,\n useAgent = false,\n agentHost = 'localhost',\n agentPort = 4318,\n logRecordProcessors,\n } = config;\n\n // Validation: API key required for direct ingestion\n if (!useAgent && !apiKey) {\n throw new Error(\n 'Datadog API key is required for direct cloud ingestion. ' +\n 'Either provide apiKey or set useAgent: true to use local Datadog Agent.',\n );\n }\n\n const baseConfig: AutotelConfig = {\n service,\n environment,\n version,\n };\n\n // Local Datadog Agent configuration\n if (useAgent) {\n const agentEndpoint = `http://${agentHost}:${agentPort}`;\n\n return {\n ...baseConfig,\n endpoint: agentEndpoint,\n // No API key or headers needed - Agent handles authentication\n };\n }\n\n // Direct cloud ingestion configuration\n // Datadog OTLP endpoint: base URL without path (SDK appends /v1/traces, /v1/metrics, /v1/logs)\n const otlpEndpoint = `https://otlp.${site}`;\n const authHeaders = `dd-api-key=${apiKey}`;\n\n const cloudConfig: AutotelConfig = {\n ...baseConfig,\n endpoint: otlpEndpoint,\n headers: authHeaders,\n };\n\n // Add log export if enabled\n if (enableLogs) {\n if (logRecordProcessors) {\n // Use custom processors if provided\n cloudConfig.logRecordProcessors = logRecordProcessors;\n } else {\n // Create default OTLP log exporter\n try {\n // Lazy-load to preserve optional peer dependencies\n // Use createRequire to resolve from user's project directory\n const userRequire = createRequire(process.cwd() + '/package.json');\n\n const { BatchLogRecordProcessor } = userRequire(\n '@opentelemetry/sdk-logs',\n );\n const { OTLPLogExporter } = userRequire(\n '@opentelemetry/exporter-logs-otlp-http',\n );\n\n cloudConfig.logRecordProcessors = [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({\n // Logs use /v1/logs path (SDK appends this to endpoint)\n url: `${otlpEndpoint}/v1/logs`,\n headers: {\n 'dd-api-key': apiKey,\n },\n }),\n ),\n ];\n } catch {\n throw new Error(\n 'Log export requires peer dependencies: @opentelemetry/sdk-logs and @opentelemetry/exporter-logs-otlp-http. ' +\n 'Install them with: npm install @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http',\n );\n }\n }\n }\n\n return cloudConfig;\n}\n"]}
package/dist/honeycomb.js CHANGED
@@ -30,7 +30,7 @@ function createHoneycombConfig(config) {
30
30
  protocol: "grpc",
31
31
  // Honeycomb uses gRPC for better performance
32
32
  endpoint,
33
- otlpHeaders: headers
33
+ headers
34
34
  };
35
35
  }
36
36
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/honeycomb.ts"],"names":[],"mappings":";AA4IO,SAAS,sBACd,MAAA,EACe;AACf,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA,GAAW,sBAAA;AAAA,IACX;AAAA,GACF,GAAI,MAAA;AAGJ,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AAGA,EAAA,MAAM,OAAA,GAAkC;AAAA,IACtC,kBAAA,EAAoB;AAAA,GACtB;AAGA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAA,CAAQ,qBAAqB,CAAA,GAAI,OAAA;AAAA,EACnC;AAGA,EAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,IAAA,OAAA,CAAQ,wBAAwB,CAAA,GAAI,MAAA,CAAO,UAAU,CAAA;AAAA,EACvD;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA,EAAU,MAAA;AAAA;AAAA,IACV,QAAA;AAAA,IACA,WAAA,EAAa;AAAA,GACf;AACF","file":"honeycomb.js","sourcesContent":["/**\n * Honeycomb preset for autotel\n *\n * Provides a simplified configuration helper for Honeycomb integration\n * with best practices built-in.\n *\n * @example Using Honeycomb with API key\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * }));\n * ```\n */\n\nimport type { AutotelConfig } from 'autotel';\n\n/**\n * Configuration options for Honeycomb preset\n */\nexport interface HoneycombPresetConfig {\n /**\n * Honeycomb API key (required).\n *\n * Get your API key from:\n * https://ui.honeycomb.io/account\n *\n * For classic environments, use an environment-specific key.\n * For newer environments, use a team-level API key.\n */\n apiKey: string;\n\n /**\n * Service name (required).\n * Appears as service.name in Honeycomb traces and determines dataset routing.\n */\n service: string;\n\n /**\n * Dataset name (optional).\n * For classic Honeycomb accounts that use datasets.\n * Modern environments route based on service.name instead.\n *\n * @default service name\n */\n dataset?: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Honeycomb.\n *\n * @default process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n *\n * @default process.env.VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Honeycomb API endpoint.\n * Use this to configure for different regions or on-premises installations.\n *\n * @default 'api.honeycomb.io:443'\n */\n endpoint?: string;\n\n /**\n * Sample rate for traces (1 = 100%, 10 = 10%, 100 = 1%).\n * Honeycomb's head-based sampling rate.\n *\n * Note: Autotel uses tail-based sampling by default.\n * This setting applies additional head-based sampling if specified.\n *\n * @default undefined (no head-based sampling, relies on tail sampling)\n */\n sampleRate?: number;\n}\n\n/**\n * Create an autotel configuration optimized for Honeycomb.\n *\n * This preset handles:\n * - gRPC protocol configuration (Honeycomb's preferred protocol)\n * - Proper endpoint and authentication headers\n * - Dataset routing (for classic accounts)\n * - Unified service tagging (service, env, version)\n *\n * Honeycomb uses gRPC by default for better performance and lower overhead.\n * This preset automatically configures the gRPC protocol.\n *\n * @param config - Honeycomb-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple configuration\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset and environment\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * environment: 'production',\n * version: '2.1.0',\n * }));\n * ```\n *\n * @example With sample rate\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * sampleRate: 10, // Sample 10% of traces (head-based sampling)\n * }));\n * ```\n */\nexport function createHoneycombConfig(\n config: HoneycombPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n service,\n dataset,\n environment,\n version,\n endpoint = 'api.honeycomb.io:443',\n sampleRate,\n } = config;\n\n // Validation: API key is required\n if (!apiKey) {\n throw new Error(\n 'Honeycomb API key is required. Get your API key from: https://ui.honeycomb.io/account',\n );\n }\n\n // Build headers\n const headers: Record<string, string> = {\n 'x-honeycomb-team': apiKey,\n };\n\n // Add dataset header if specified (for classic Honeycomb accounts)\n if (dataset) {\n headers['x-honeycomb-dataset'] = dataset;\n }\n\n // Add sample rate header if specified\n if (sampleRate !== undefined) {\n headers['x-honeycomb-samplerate'] = String(sampleRate);\n }\n\n return {\n service,\n environment,\n version,\n protocol: 'grpc', // Honeycomb uses gRPC for better performance\n endpoint,\n otlpHeaders: headers,\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/honeycomb.ts"],"names":[],"mappings":";AA4IO,SAAS,sBACd,MAAA,EACe;AACf,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA,GAAW,sBAAA;AAAA,IACX;AAAA,GACF,GAAI,MAAA;AAGJ,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AAGA,EAAA,MAAM,OAAA,GAAkC;AAAA,IACtC,kBAAA,EAAoB;AAAA,GACtB;AAGA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,OAAA,CAAQ,qBAAqB,CAAA,GAAI,OAAA;AAAA,EACnC;AAGA,EAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,IAAA,OAAA,CAAQ,wBAAwB,CAAA,GAAI,MAAA,CAAO,UAAU,CAAA;AAAA,EACvD;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA,EAAU,MAAA;AAAA;AAAA,IACV,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"honeycomb.js","sourcesContent":["/**\n * Honeycomb preset for autotel\n *\n * Provides a simplified configuration helper for Honeycomb integration\n * with best practices built-in.\n *\n * @example Using Honeycomb with API key\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * }));\n * ```\n */\n\nimport type { AutotelConfig } from 'autotel';\n\n/**\n * Configuration options for Honeycomb preset\n */\nexport interface HoneycombPresetConfig {\n /**\n * Honeycomb API key (required).\n *\n * Get your API key from:\n * https://ui.honeycomb.io/account\n *\n * For classic environments, use an environment-specific key.\n * For newer environments, use a team-level API key.\n */\n apiKey: string;\n\n /**\n * Service name (required).\n * Appears as service.name in Honeycomb traces and determines dataset routing.\n */\n service: string;\n\n /**\n * Dataset name (optional).\n * For classic Honeycomb accounts that use datasets.\n * Modern environments route based on service.name instead.\n *\n * @default service name\n */\n dataset?: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Honeycomb.\n *\n * @default process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n *\n * @default process.env.VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Honeycomb API endpoint.\n * Use this to configure for different regions or on-premises installations.\n *\n * @default 'api.honeycomb.io:443'\n */\n endpoint?: string;\n\n /**\n * Sample rate for traces (1 = 100%, 10 = 10%, 100 = 1%).\n * Honeycomb's head-based sampling rate.\n *\n * Note: Autotel uses tail-based sampling by default.\n * This setting applies additional head-based sampling if specified.\n *\n * @default undefined (no head-based sampling, relies on tail sampling)\n */\n sampleRate?: number;\n}\n\n/**\n * Create an autotel configuration optimized for Honeycomb.\n *\n * This preset handles:\n * - gRPC protocol configuration (Honeycomb's preferred protocol)\n * - Proper endpoint and authentication headers\n * - Dataset routing (for classic accounts)\n * - Unified service tagging (service, env, version)\n *\n * Honeycomb uses gRPC by default for better performance and lower overhead.\n * This preset automatically configures the gRPC protocol.\n *\n * @param config - Honeycomb-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple configuration\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset and environment\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * environment: 'production',\n * version: '2.1.0',\n * }));\n * ```\n *\n * @example With sample rate\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * sampleRate: 10, // Sample 10% of traces (head-based sampling)\n * }));\n * ```\n */\nexport function createHoneycombConfig(\n config: HoneycombPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n service,\n dataset,\n environment,\n version,\n endpoint = 'api.honeycomb.io:443',\n sampleRate,\n } = config;\n\n // Validation: API key is required\n if (!apiKey) {\n throw new Error(\n 'Honeycomb API key is required. Get your API key from: https://ui.honeycomb.io/account',\n );\n }\n\n // Build headers\n const headers: Record<string, string> = {\n 'x-honeycomb-team': apiKey,\n };\n\n // Add dataset header if specified (for classic Honeycomb accounts)\n if (dataset) {\n headers['x-honeycomb-dataset'] = dataset;\n }\n\n // Add sample rate header if specified\n if (sampleRate !== undefined) {\n headers['x-honeycomb-samplerate'] = String(sampleRate);\n }\n\n return {\n service,\n environment,\n version,\n protocol: 'grpc', // Honeycomb uses gRPC for better performance\n endpoint,\n headers,\n };\n}\n"]}
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ function createHoneycombConfig(config) {
32
32
  protocol: "grpc",
33
33
  // Honeycomb uses gRPC for better performance
34
34
  endpoint,
35
- otlpHeaders: headers
35
+ headers
36
36
  };
37
37
  }
38
38
  function createDatadogConfig(config) {
@@ -71,7 +71,7 @@ function createDatadogConfig(config) {
71
71
  const cloudConfig = {
72
72
  ...baseConfig,
73
73
  endpoint: otlpEndpoint,
74
- otlpHeaders: authHeaders
74
+ headers: authHeaders
75
75
  };
76
76
  if (enableLogs) {
77
77
  if (logRecordProcessors) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/honeycomb.ts","../src/datadog.ts"],"names":[],"mappings":";;;AA4IO,SAAS,sBACd,MAAA,EACe;AACf,E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;AACZ,IAAA,MAAM,aAAA,GAAgB,CAAA,OAAA,EAAU,SAAS,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AAEtD,IAAA,OAAO;AAAA,MACL,GAAG,UAAA;AAAA,MACH,QAAA,EAAU;AAAA;AAAA,KAEZ;AAAA,EACF;AAIA,EAAA,MAAM,YAAA,GAAe,gBAAgB,IAAI,CAAA,CAAA;AACzC,EAAA,MAAM,WAAA,GAAc,cAAc,MAAM,CAAA,CAAA;AAExC,EAAA,MAAM,WAAA,GAA6B;AAAA,IACjC,GAAG,UAAA;AAAA,IACH,QAAA,EAAU,YAAA;AAAA,IACV,WAAA,EAAa;AAAA,GACf;AAGA,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,IAAI,mBAAA,EAAqB;AAEvB,MAAA,WAAA,CAAY,mBAAA,GAAsB,mBAAA;AAAA,IACpC,CAAA,MAAO;AAEL,MAAA,IAAI;AAGF,QAAA,MAAM,WAAA,GAAc,aAAA,CAAc,OAAA,CAAQ,GAAA,KAAQ,eAAe,CAAA;AAEjE,QAAA,MAAM,EAAE,yBAAwB,GAAI,WAAA;AAAA,UAClC;AAAA,SACF;AACA,QAAA,MAAM,EAAE,iBAAgB,GAAI,WAAA;AAAA,UAC1B;AAAA,SACF;AAEA,QAAA,WAAA,CAAY,mBAAA,GAAsB;AAAA,UAChC,IAAI,uBAAA;AAAA,YACF,IAAI,eAAA,CAAgB;AAAA;AAAA,cAElB,GAAA,EAAK,GAAG,YAAY,CAAA,QAAA,CAAA;AAAA,cACpB,OAAA,EAAS;AAAA,gBACP,YAAA,EAAc;AAAA;AAChB,aACD;AAAA;AACH,SACF;AAAA,MACF,CAAA,CAAA,MAAQ;AACN,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SAEF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["/**\n * Honeycomb preset for autotel\n *\n * Provides a simplified configuration helper for Honeycomb integration\n * with best practices built-in.\n *\n * @example Using Honeycomb with API key\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * }));\n * ```\n */\n\nimport type { AutotelConfig } from 'autotel';\n\n/**\n * Configuration options for Honeycomb preset\n */\nexport interface HoneycombPresetConfig {\n /**\n * Honeycomb API key (required).\n *\n * Get your API key from:\n * https://ui.honeycomb.io/account\n *\n * For classic environments, use an environment-specific key.\n * For newer environments, use a team-level API key.\n */\n apiKey: string;\n\n /**\n * Service name (required).\n * Appears as service.name in Honeycomb traces and determines dataset routing.\n */\n service: string;\n\n /**\n * Dataset name (optional).\n * For classic Honeycomb accounts that use datasets.\n * Modern environments route based on service.name instead.\n *\n * @default service name\n */\n dataset?: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Honeycomb.\n *\n * @default process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n *\n * @default process.env.VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Honeycomb API endpoint.\n * Use this to configure for different regions or on-premises installations.\n *\n * @default 'api.honeycomb.io:443'\n */\n endpoint?: string;\n\n /**\n * Sample rate for traces (1 = 100%, 10 = 10%, 100 = 1%).\n * Honeycomb's head-based sampling rate.\n *\n * Note: Autotel uses tail-based sampling by default.\n * This setting applies additional head-based sampling if specified.\n *\n * @default undefined (no head-based sampling, relies on tail sampling)\n */\n sampleRate?: number;\n}\n\n/**\n * Create an autotel configuration optimized for Honeycomb.\n *\n * This preset handles:\n * - gRPC protocol configuration (Honeycomb's preferred protocol)\n * - Proper endpoint and authentication headers\n * - Dataset routing (for classic accounts)\n * - Unified service tagging (service, env, version)\n *\n * Honeycomb uses gRPC by default for better performance and lower overhead.\n * This preset automatically configures the gRPC protocol.\n *\n * @param config - Honeycomb-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple configuration\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset and environment\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * environment: 'production',\n * version: '2.1.0',\n * }));\n * ```\n *\n * @example With sample rate\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * sampleRate: 10, // Sample 10% of traces (head-based sampling)\n * }));\n * ```\n */\nexport function createHoneycombConfig(\n config: HoneycombPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n service,\n dataset,\n environment,\n version,\n endpoint = 'api.honeycomb.io:443',\n sampleRate,\n } = config;\n\n // Validation: API key is required\n if (!apiKey) {\n throw new Error(\n 'Honeycomb API key is required. Get your API key from: https://ui.honeycomb.io/account',\n );\n }\n\n // Build headers\n const headers: Record<string, string> = {\n 'x-honeycomb-team': apiKey,\n };\n\n // Add dataset header if specified (for classic Honeycomb accounts)\n if (dataset) {\n headers['x-honeycomb-dataset'] = dataset;\n }\n\n // Add sample rate header if specified\n if (sampleRate !== undefined) {\n headers['x-honeycomb-samplerate'] = String(sampleRate);\n }\n\n return {\n service,\n environment,\n version,\n protocol: 'grpc', // Honeycomb uses gRPC for better performance\n endpoint,\n otlpHeaders: headers,\n };\n}\n","/**\n * Datadog preset for autotel\n *\n * Provides a simplified configuration helper for Datadog integration\n * with best practices built-in.\n *\n * @example Direct cloud ingestion (serverless, edge)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-lambda',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Local Datadog Agent (long-running services, Kubernetes)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true, // No API key needed - Agent handles it\n * }));\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { AutotelConfig } from 'autotel';\nimport type { LogRecordProcessor } from '@opentelemetry/sdk-logs';\n\n/**\n * Datadog site regions\n */\nexport type DatadogSite =\n | 'datadoghq.com' // US1 (default)\n | 'datadoghq.eu' // EU\n | 'us3.datadoghq.com' // US3\n | 'us5.datadoghq.com' // US5\n | 'ap1.datadoghq.com' // AP1\n | 'ddog-gov.com'; // US1-FED\n\n/**\n * Configuration options for Datadog preset\n */\nexport interface DatadogPresetConfig {\n /**\n * Datadog API key (required for direct cloud ingestion).\n * Not needed if using local Datadog Agent (useAgent: true).\n *\n * Get your API key from:\n * https://app.datadoghq.com/organization-settings/api-keys\n */\n apiKey?: string;\n\n /**\n * Datadog site/region.\n * Determines which Datadog intake endpoint to use.\n *\n * @default 'datadoghq.com' (US1)\n */\n site?: DatadogSite;\n\n /**\n * Service name (required).\n * Appears in Datadog APM, Service Catalog, and all telemetry.\n */\n service: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Datadog.\n *\n * @default process.env.DD_ENV || process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n * Enables Deployment Tracking in Datadog APM.\n *\n * @default process.env.DD_VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Enable log export to Datadog via OTLP.\n * Requires peer dependencies: @opentelemetry/sdk-logs, @opentelemetry/exporter-logs-otlp-http\n *\n * @default false\n */\n enableLogs?: boolean;\n\n /**\n * Use local Datadog Agent instead of direct cloud ingestion.\n *\n * Benefits:\n * - Lower egress costs (Agent aggregates locally)\n * - Advanced features: trace-log correlation, multi-line logs, data scrubbing\n * - 500+ integrations for enrichment\n * - Infrastructure metrics collection\n *\n * Requires: Datadog Agent 7.35+ with OTLP enabled\n *\n * @default false\n */\n useAgent?: boolean;\n\n /**\n * Datadog Agent hostname (when useAgent: true).\n *\n * @default 'localhost'\n */\n agentHost?: string;\n\n /**\n * Datadog Agent OTLP port (when useAgent: true).\n *\n * @default 4318 (OTLP HTTP)\n */\n agentPort?: number;\n\n /**\n * Custom log record processors (advanced).\n * Overrides the default log processor if enableLogs is true.\n */\n logRecordProcessors?: LogRecordProcessor[];\n}\n\n/**\n * Create an autotel configuration optimized for Datadog.\n *\n * This preset handles:\n * - Proper OTLP endpoint configuration (Agent vs direct ingestion)\n * - Direct: https://otlp.{site} → SDK appends /v1/traces, /v1/metrics, /v1/logs\n * - Agent: http://localhost:4318 (default)\n * - Datadog API key authentication headers (direct ingestion only)\n * - Unified service tagging (service, env, version)\n * - Resource attribute best practices\n * - Optional log export configuration\n *\n * @param config - Datadog-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple cloud ingestion\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With logs and custom environment\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * environment: 'production',\n * version: '2.1.0',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Using local Datadog Agent\n * ```typescript\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true,\n * agentHost: 'datadog-agent.default.svc.cluster.local', // Kubernetes\n * }));\n * ```\n */\nexport function createDatadogConfig(\n config: DatadogPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n site = 'datadoghq.com',\n service,\n environment,\n version,\n enableLogs = false,\n useAgent = false,\n agentHost = 'localhost',\n agentPort = 4318,\n logRecordProcessors,\n } = config;\n\n // Validation: API key required for direct ingestion\n if (!useAgent && !apiKey) {\n throw new Error(\n 'Datadog API key is required for direct cloud ingestion. ' +\n 'Either provide apiKey or set useAgent: true to use local Datadog Agent.',\n );\n }\n\n const baseConfig: AutotelConfig = {\n service,\n environment,\n version,\n };\n\n // Local Datadog Agent configuration\n if (useAgent) {\n const agentEndpoint = `http://${agentHost}:${agentPort}`;\n\n return {\n ...baseConfig,\n endpoint: agentEndpoint,\n // No API key or headers needed - Agent handles authentication\n };\n }\n\n // Direct cloud ingestion configuration\n // Datadog OTLP endpoint: base URL without path (SDK appends /v1/traces, /v1/metrics, /v1/logs)\n const otlpEndpoint = `https://otlp.${site}`;\n const authHeaders = `dd-api-key=${apiKey}`;\n\n const cloudConfig: AutotelConfig = {\n ...baseConfig,\n endpoint: otlpEndpoint,\n otlpHeaders: authHeaders,\n };\n\n // Add log export if enabled\n if (enableLogs) {\n if (logRecordProcessors) {\n // Use custom processors if provided\n cloudConfig.logRecordProcessors = logRecordProcessors;\n } else {\n // Create default OTLP log exporter\n try {\n // Lazy-load to preserve optional peer dependencies\n // Use createRequire to resolve from user's project directory\n const userRequire = createRequire(process.cwd() + '/package.json');\n\n const { BatchLogRecordProcessor } = userRequire(\n '@opentelemetry/sdk-logs',\n );\n const { OTLPLogExporter } = userRequire(\n '@opentelemetry/exporter-logs-otlp-http',\n );\n\n cloudConfig.logRecordProcessors = [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({\n // Logs use /v1/logs path (SDK appends this to endpoint)\n url: `${otlpEndpoint}/v1/logs`,\n headers: {\n 'dd-api-key': apiKey,\n },\n }),\n ),\n ];\n } catch {\n throw new Error(\n 'Log export requires peer dependencies: @opentelemetry/sdk-logs and @opentelemetry/exporter-logs-otlp-http. ' +\n 'Install them with: npm install @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http',\n );\n }\n }\n }\n\n return cloudConfig;\n}\n"]}
1
+ {"version":3,"sources":["../src/hone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ourcesContent":["/**\n * Honeycomb preset for autotel\n *\n * Provides a simplified configuration helper for Honeycomb integration\n * with best practices built-in.\n *\n * @example Using Honeycomb with API key\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset\n * ```typescript\n * import { init } from 'autotel';\n * import { createHoneycombConfig } from 'autotel-backends/honeycomb';\n *\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * }));\n * ```\n */\n\nimport type { AutotelConfig } from 'autotel';\n\n/**\n * Configuration options for Honeycomb preset\n */\nexport interface HoneycombPresetConfig {\n /**\n * Honeycomb API key (required).\n *\n * Get your API key from:\n * https://ui.honeycomb.io/account\n *\n * For classic environments, use an environment-specific key.\n * For newer environments, use a team-level API key.\n */\n apiKey: string;\n\n /**\n * Service name (required).\n * Appears as service.name in Honeycomb traces and determines dataset routing.\n */\n service: string;\n\n /**\n * Dataset name (optional).\n * For classic Honeycomb accounts that use datasets.\n * Modern environments route based on service.name instead.\n *\n * @default service name\n */\n dataset?: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Honeycomb.\n *\n * @default process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n *\n * @default process.env.VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Honeycomb API endpoint.\n * Use this to configure for different regions or on-premises installations.\n *\n * @default 'api.honeycomb.io:443'\n */\n endpoint?: string;\n\n /**\n * Sample rate for traces (1 = 100%, 10 = 10%, 100 = 1%).\n * Honeycomb's head-based sampling rate.\n *\n * Note: Autotel uses tail-based sampling by default.\n * This setting applies additional head-based sampling if specified.\n *\n * @default undefined (no head-based sampling, relies on tail sampling)\n */\n sampleRate?: number;\n}\n\n/**\n * Create an autotel configuration optimized for Honeycomb.\n *\n * This preset handles:\n * - gRPC protocol configuration (Honeycomb's preferred protocol)\n * - Proper endpoint and authentication headers\n * - Dataset routing (for classic accounts)\n * - Unified service tagging (service, env, version)\n *\n * Honeycomb uses gRPC by default for better performance and lower overhead.\n * This preset automatically configures the gRPC protocol.\n *\n * @param config - Honeycomb-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple configuration\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With custom dataset and environment\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * dataset: 'production',\n * environment: 'production',\n * version: '2.1.0',\n * }));\n * ```\n *\n * @example With sample rate\n * ```typescript\n * init(createHoneycombConfig({\n * apiKey: process.env.HONEYCOMB_API_KEY!,\n * service: 'my-app',\n * sampleRate: 10, // Sample 10% of traces (head-based sampling)\n * }));\n * ```\n */\nexport function createHoneycombConfig(\n config: HoneycombPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n service,\n dataset,\n environment,\n version,\n endpoint = 'api.honeycomb.io:443',\n sampleRate,\n } = config;\n\n // Validation: API key is required\n if (!apiKey) {\n throw new Error(\n 'Honeycomb API key is required. Get your API key from: https://ui.honeycomb.io/account',\n );\n }\n\n // Build headers\n const headers: Record<string, string> = {\n 'x-honeycomb-team': apiKey,\n };\n\n // Add dataset header if specified (for classic Honeycomb accounts)\n if (dataset) {\n headers['x-honeycomb-dataset'] = dataset;\n }\n\n // Add sample rate header if specified\n if (sampleRate !== undefined) {\n headers['x-honeycomb-samplerate'] = String(sampleRate);\n }\n\n return {\n service,\n environment,\n version,\n protocol: 'grpc', // Honeycomb uses gRPC for better performance\n endpoint,\n headers,\n };\n}\n","/**\n * Datadog preset for autotel\n *\n * Provides a simplified configuration helper for Datadog integration\n * with best practices built-in.\n *\n * @example Direct cloud ingestion (serverless, edge)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-lambda',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Local Datadog Agent (long-running services, Kubernetes)\n * ```typescript\n * import { init } from 'autotel';\n * import { createDatadogConfig } from 'autotel-backends/datadog';\n *\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true, // No API key needed - Agent handles it\n * }));\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { AutotelConfig } from 'autotel';\nimport type { LogRecordProcessor } from '@opentelemetry/sdk-logs';\n\n/**\n * Datadog site regions\n */\nexport type DatadogSite =\n | 'datadoghq.com' // US1 (default)\n | 'datadoghq.eu' // EU\n | 'us3.datadoghq.com' // US3\n | 'us5.datadoghq.com' // US5\n | 'ap1.datadoghq.com' // AP1\n | 'ddog-gov.com'; // US1-FED\n\n/**\n * Configuration options for Datadog preset\n */\nexport interface DatadogPresetConfig {\n /**\n * Datadog API key (required for direct cloud ingestion).\n * Not needed if using local Datadog Agent (useAgent: true).\n *\n * Get your API key from:\n * https://app.datadoghq.com/organization-settings/api-keys\n */\n apiKey?: string;\n\n /**\n * Datadog site/region.\n * Determines which Datadog intake endpoint to use.\n *\n * @default 'datadoghq.com' (US1)\n */\n site?: DatadogSite;\n\n /**\n * Service name (required).\n * Appears in Datadog APM, Service Catalog, and all telemetry.\n */\n service: string;\n\n /**\n * Deployment environment (e.g., 'production', 'staging', 'development').\n * Used for environment filtering in Datadog.\n *\n * @default process.env.DD_ENV || process.env.NODE_ENV || 'development'\n */\n environment?: string;\n\n /**\n * Service version for deployment tracking.\n * Enables Deployment Tracking in Datadog APM.\n *\n * @default process.env.DD_VERSION || auto-detected from package.json\n */\n version?: string;\n\n /**\n * Enable log export to Datadog via OTLP.\n * Requires peer dependencies: @opentelemetry/sdk-logs, @opentelemetry/exporter-logs-otlp-http\n *\n * @default false\n */\n enableLogs?: boolean;\n\n /**\n * Use local Datadog Agent instead of direct cloud ingestion.\n *\n * Benefits:\n * - Lower egress costs (Agent aggregates locally)\n * - Advanced features: trace-log correlation, multi-line logs, data scrubbing\n * - 500+ integrations for enrichment\n * - Infrastructure metrics collection\n *\n * Requires: Datadog Agent 7.35+ with OTLP enabled\n *\n * @default false\n */\n useAgent?: boolean;\n\n /**\n * Datadog Agent hostname (when useAgent: true).\n *\n * @default 'localhost'\n */\n agentHost?: string;\n\n /**\n * Datadog Agent OTLP port (when useAgent: true).\n *\n * @default 4318 (OTLP HTTP)\n */\n agentPort?: number;\n\n /**\n * Custom log record processors (advanced).\n * Overrides the default log processor if enableLogs is true.\n */\n logRecordProcessors?: LogRecordProcessor[];\n}\n\n/**\n * Create an autotel configuration optimized for Datadog.\n *\n * This preset handles:\n * - Proper OTLP endpoint configuration (Agent vs direct ingestion)\n * - Direct: https://otlp.{site} → SDK appends /v1/traces, /v1/metrics, /v1/logs\n * - Agent: http://localhost:4318 (default)\n * - Datadog API key authentication headers (direct ingestion only)\n * - Unified service tagging (service, env, version)\n * - Resource attribute best practices\n * - Optional log export configuration\n *\n * @param config - Datadog-specific configuration options\n * @returns AutotelConfig ready to pass to init()\n *\n * @example Simple cloud ingestion\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * }));\n * ```\n *\n * @example With logs and custom environment\n * ```typescript\n * init(createDatadogConfig({\n * apiKey: process.env.DATADOG_API_KEY!,\n * service: 'my-app',\n * environment: 'production',\n * version: '2.1.0',\n * enableLogs: true,\n * }));\n * ```\n *\n * @example Using local Datadog Agent\n * ```typescript\n * init(createDatadogConfig({\n * service: 'my-api',\n * useAgent: true,\n * agentHost: 'datadog-agent.default.svc.cluster.local', // Kubernetes\n * }));\n * ```\n */\nexport function createDatadogConfig(\n config: DatadogPresetConfig,\n): AutotelConfig {\n const {\n apiKey,\n site = 'datadoghq.com',\n service,\n environment,\n version,\n enableLogs = false,\n useAgent = false,\n agentHost = 'localhost',\n agentPort = 4318,\n logRecordProcessors,\n } = config;\n\n // Validation: API key required for direct ingestion\n if (!useAgent && !apiKey) {\n throw new Error(\n 'Datadog API key is required for direct cloud ingestion. ' +\n 'Either provide apiKey or set useAgent: true to use local Datadog Agent.',\n );\n }\n\n const baseConfig: AutotelConfig = {\n service,\n environment,\n version,\n };\n\n // Local Datadog Agent configuration\n if (useAgent) {\n const agentEndpoint = `http://${agentHost}:${agentPort}`;\n\n return {\n ...baseConfig,\n endpoint: agentEndpoint,\n // No API key or headers needed - Agent handles authentication\n };\n }\n\n // Direct cloud ingestion configuration\n // Datadog OTLP endpoint: base URL without path (SDK appends /v1/traces, /v1/metrics, /v1/logs)\n const otlpEndpoint = `https://otlp.${site}`;\n const authHeaders = `dd-api-key=${apiKey}`;\n\n const cloudConfig: AutotelConfig = {\n ...baseConfig,\n endpoint: otlpEndpoint,\n headers: authHeaders,\n };\n\n // Add log export if enabled\n if (enableLogs) {\n if (logRecordProcessors) {\n // Use custom processors if provided\n cloudConfig.logRecordProcessors = logRecordProcessors;\n } else {\n // Create default OTLP log exporter\n try {\n // Lazy-load to preserve optional peer dependencies\n // Use createRequire to resolve from user's project directory\n const userRequire = createRequire(process.cwd() + '/package.json');\n\n const { BatchLogRecordProcessor } = userRequire(\n '@opentelemetry/sdk-logs',\n );\n const { OTLPLogExporter } = userRequire(\n '@opentelemetry/exporter-logs-otlp-http',\n );\n\n cloudConfig.logRecordProcessors = [\n new BatchLogRecordProcessor(\n new OTLPLogExporter({\n // Logs use /v1/logs path (SDK appends this to endpoint)\n url: `${otlpEndpoint}/v1/logs`,\n headers: {\n 'dd-api-key': apiKey,\n },\n }),\n ),\n ];\n } catch {\n throw new Error(\n 'Log export requires peer dependencies: @opentelemetry/sdk-logs and @opentelemetry/exporter-logs-otlp-http. ' +\n 'Install them with: npm install @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http',\n );\n }\n }\n }\n\n return cloudConfig;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-backends",
3
- "version": "2.2.5",
3
+ "version": "2.3.0",
4
4
  "description": "Vendor backend configurations for Autotel (Honeycomb, Datadog, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "author": "Jag Reehal <jag@jagreehal.com> (https://jagreehal.com)",
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "autotel": "2.6.0"
44
+ "autotel": "2.8.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@opentelemetry/exporter-logs-otlp-http": ">=0.57.0",
package/src/datadog.ts CHANGED
@@ -222,7 +222,7 @@ export function createDatadogConfig(
222
222
  const cloudConfig: AutotelConfig = {
223
223
  ...baseConfig,
224
224
  endpoint: otlpEndpoint,
225
- otlpHeaders: authHeaders,
225
+ headers: authHeaders,
226
226
  };
227
227
 
228
228
  // Add log export if enabled
@@ -33,7 +33,7 @@ describe('createHoneycombConfig()', () => {
33
33
  service: 'my-service',
34
34
  protocol: 'grpc',
35
35
  endpoint: 'api.honeycomb.io:443',
36
- otlpHeaders: {
36
+ headers: {
37
37
  'x-honeycomb-team': 'test-api-key',
38
38
  },
39
39
  });
@@ -65,7 +65,7 @@ describe('createHoneycombConfig()', () => {
65
65
  service: 'test-service',
66
66
  });
67
67
 
68
- expect(config.otlpHeaders).toMatchObject({
68
+ expect(config.headers).toMatchObject({
69
69
  'x-honeycomb-team': 'my-secret-key',
70
70
  });
71
71
  });
@@ -77,7 +77,7 @@ describe('createHoneycombConfig()', () => {
77
77
  dataset: 'production',
78
78
  });
79
79
 
80
- expect(config.otlpHeaders).toMatchObject({
80
+ expect(config.headers).toMatchObject({
81
81
  'x-honeycomb-team': 'test-key',
82
82
  'x-honeycomb-dataset': 'production',
83
83
  });
@@ -90,7 +90,7 @@ describe('createHoneycombConfig()', () => {
90
90
  sampleRate: 10,
91
91
  });
92
92
 
93
- expect(config.otlpHeaders).toMatchObject({
93
+ expect(config.headers).toMatchObject({
94
94
  'x-honeycomb-team': 'test-key',
95
95
  'x-honeycomb-samplerate': '10',
96
96
  });
@@ -104,7 +104,7 @@ describe('createHoneycombConfig()', () => {
104
104
  sampleRate: 100,
105
105
  });
106
106
 
107
- expect(config.otlpHeaders).toMatchObject({
107
+ expect(config.headers).toMatchObject({
108
108
  'x-honeycomb-team': 'test-key',
109
109
  'x-honeycomb-dataset': 'my-dataset',
110
110
  'x-honeycomb-samplerate': '100',
@@ -118,10 +118,8 @@ describe('createHoneycombConfig()', () => {
118
118
  sampleRate: 50,
119
119
  });
120
120
 
121
- expect(typeof config.otlpHeaders?.['x-honeycomb-samplerate']).toBe(
122
- 'string',
123
- );
124
- expect(config.otlpHeaders?.['x-honeycomb-samplerate']).toBe('50');
121
+ expect(typeof config.headers?.['x-honeycomb-samplerate']).toBe('string');
122
+ expect(config.headers?.['x-honeycomb-samplerate']).toBe('50');
125
123
  });
126
124
  });
127
125
 
@@ -199,7 +197,7 @@ describe('createHoneycombConfig()', () => {
199
197
  version: '3.2.1',
200
198
  protocol: 'grpc',
201
199
  endpoint: 'custom.endpoint.io:9000',
202
- otlpHeaders: {
200
+ headers: {
203
201
  'x-honeycomb-team': 'complete-test-key',
204
202
  'x-honeycomb-dataset': 'complete-dataset',
205
203
  'x-honeycomb-samplerate': '25',
@@ -217,7 +215,7 @@ describe('createHoneycombConfig()', () => {
217
215
  environment: 'production',
218
216
  });
219
217
 
220
- expect(config.otlpHeaders).toHaveProperty('x-honeycomb-dataset');
218
+ expect(config.headers).toHaveProperty('x-honeycomb-dataset');
221
219
  expect(config.protocol).toBe('grpc');
222
220
  });
223
221
 
@@ -228,7 +226,7 @@ describe('createHoneycombConfig()', () => {
228
226
  environment: 'production',
229
227
  });
230
228
 
231
- expect(config.otlpHeaders).not.toHaveProperty('x-honeycomb-dataset');
229
+ expect(config.headers).not.toHaveProperty('x-honeycomb-dataset');
232
230
  expect(config.protocol).toBe('grpc');
233
231
  });
234
232
 
@@ -239,10 +237,7 @@ describe('createHoneycombConfig()', () => {
239
237
  sampleRate: 100, // Sample 1% of traces
240
238
  });
241
239
 
242
- expect(config.otlpHeaders).toHaveProperty(
243
- 'x-honeycomb-samplerate',
244
- '100',
245
- );
240
+ expect(config.headers).toHaveProperty('x-honeycomb-samplerate', '100');
246
241
  });
247
242
  });
248
243
  });
package/src/honeycomb.ts CHANGED
@@ -179,6 +179,6 @@ export function createHoneycombConfig(
179
179
  version,
180
180
  protocol: 'grpc', // Honeycomb uses gRPC for better performance
181
181
  endpoint,
182
- otlpHeaders: headers,
182
+ headers,
183
183
  };
184
184
  }