autotel-backends 2.12.33 → 2.12.34

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/src/honeycomb.ts DELETED
@@ -1,184 +0,0 @@
1
- /**
2
- * Honeycomb preset for autotel
3
- *
4
- * Provides a simplified configuration helper for Honeycomb integration
5
- * with best practices built-in.
6
- *
7
- * @example Using Honeycomb with API key
8
- * ```typescript
9
- * import { init } from 'autotel';
10
- * import { createHoneycombConfig } from 'autotel-backends/honeycomb';
11
- *
12
- * init(createHoneycombConfig({
13
- * apiKey: process.env.HONEYCOMB_API_KEY!,
14
- * service: 'my-app',
15
- * }));
16
- * ```
17
- *
18
- * @example With custom dataset
19
- * ```typescript
20
- * import { init } from 'autotel';
21
- * import { createHoneycombConfig } from 'autotel-backends/honeycomb';
22
- *
23
- * init(createHoneycombConfig({
24
- * apiKey: process.env.HONEYCOMB_API_KEY!,
25
- * service: 'my-app',
26
- * dataset: 'production',
27
- * }));
28
- * ```
29
- */
30
-
31
- import type { AutotelConfig } from 'autotel';
32
-
33
- /**
34
- * Configuration options for Honeycomb preset
35
- */
36
- export interface HoneycombPresetConfig {
37
- /**
38
- * Honeycomb API key (required).
39
- *
40
- * Get your API key from:
41
- * https://ui.honeycomb.io/account
42
- *
43
- * For classic environments, use an environment-specific key.
44
- * For newer environments, use a team-level API key.
45
- */
46
- apiKey: string;
47
-
48
- /**
49
- * Service name (required).
50
- * Appears as service.name in Honeycomb traces and determines dataset routing.
51
- */
52
- service: string;
53
-
54
- /**
55
- * Dataset name (optional).
56
- * For classic Honeycomb accounts that use datasets.
57
- * Modern environments route based on service.name instead.
58
- *
59
- * @default service name
60
- */
61
- dataset?: string;
62
-
63
- /**
64
- * Deployment environment (e.g., 'production', 'staging', 'development').
65
- * Used for environment filtering in Honeycomb.
66
- *
67
- * @default process.env.NODE_ENV || 'development'
68
- */
69
- environment?: string;
70
-
71
- /**
72
- * Service version for deployment tracking.
73
- *
74
- * @default process.env.VERSION || auto-detected from package.json
75
- */
76
- version?: string;
77
-
78
- /**
79
- * Honeycomb API endpoint.
80
- * Use this to configure for different regions or on-premises installations.
81
- *
82
- * @default 'api.honeycomb.io:443'
83
- */
84
- endpoint?: string;
85
-
86
- /**
87
- * Sample rate for traces (1 = 100%, 10 = 10%, 100 = 1%).
88
- * Honeycomb's head-based sampling rate.
89
- *
90
- * Note: Autotel uses tail-based sampling by default.
91
- * This setting applies additional head-based sampling if specified.
92
- *
93
- * @default undefined (no head-based sampling, relies on tail sampling)
94
- */
95
- sampleRate?: number;
96
- }
97
-
98
- /**
99
- * Create an autotel configuration optimized for Honeycomb.
100
- *
101
- * This preset handles:
102
- * - gRPC protocol configuration (Honeycomb's preferred protocol)
103
- * - Proper endpoint and authentication headers
104
- * - Dataset routing (for classic accounts)
105
- * - Unified service tagging (service, env, version)
106
- *
107
- * Honeycomb uses gRPC by default for better performance and lower overhead.
108
- * This preset automatically configures the gRPC protocol.
109
- *
110
- * @param config - Honeycomb-specific configuration options
111
- * @returns AutotelConfig ready to pass to init()
112
- *
113
- * @example Simple configuration
114
- * ```typescript
115
- * init(createHoneycombConfig({
116
- * apiKey: process.env.HONEYCOMB_API_KEY!,
117
- * service: 'my-app',
118
- * }));
119
- * ```
120
- *
121
- * @example With custom dataset and environment
122
- * ```typescript
123
- * init(createHoneycombConfig({
124
- * apiKey: process.env.HONEYCOMB_API_KEY!,
125
- * service: 'my-app',
126
- * dataset: 'production',
127
- * environment: 'production',
128
- * version: '2.1.0',
129
- * }));
130
- * ```
131
- *
132
- * @example With sample rate
133
- * ```typescript
134
- * init(createHoneycombConfig({
135
- * apiKey: process.env.HONEYCOMB_API_KEY!,
136
- * service: 'my-app',
137
- * sampleRate: 10, // Sample 10% of traces (head-based sampling)
138
- * }));
139
- * ```
140
- */
141
- export function createHoneycombConfig(
142
- config: HoneycombPresetConfig,
143
- ): AutotelConfig {
144
- const {
145
- apiKey,
146
- service,
147
- dataset,
148
- environment,
149
- version,
150
- endpoint = 'api.honeycomb.io:443',
151
- sampleRate,
152
- } = config;
153
-
154
- // Validation: API key is required
155
- if (!apiKey) {
156
- throw new Error(
157
- 'Honeycomb API key is required. Get your API key from: https://ui.honeycomb.io/account',
158
- );
159
- }
160
-
161
- // Build headers
162
- const headers: Record<string, string> = {
163
- 'x-honeycomb-team': apiKey,
164
- };
165
-
166
- // Add dataset header if specified (for classic Honeycomb accounts)
167
- if (dataset) {
168
- headers['x-honeycomb-dataset'] = dataset;
169
- }
170
-
171
- // Add sample rate header if specified
172
- if (sampleRate !== undefined) {
173
- headers['x-honeycomb-samplerate'] = String(sampleRate);
174
- }
175
-
176
- return {
177
- service,
178
- environment,
179
- version,
180
- protocol: 'grpc', // Honeycomb uses gRPC for better performance
181
- endpoint,
182
- headers,
183
- };
184
- }
package/src/index.ts DELETED
@@ -1,43 +0,0 @@
1
- /**
2
- * Autotel Backends
3
- *
4
- * Vendor backend configurations for simplified setup with
5
- * popular observability platforms.
6
- *
7
- * @example Honeycomb
8
- * ```typescript
9
- * import { init } from 'autotel';
10
- * import { createHoneycombConfig } from 'autotel-backends/honeycomb';
11
- *
12
- * init(createHoneycombConfig({
13
- * apiKey: process.env.HONEYCOMB_API_KEY!,
14
- * service: 'my-app',
15
- * }));
16
- * ```
17
- *
18
- * @example Datadog
19
- * ```typescript
20
- * import { init } from 'autotel';
21
- * import { createDatadogConfig } from 'autotel-backends/datadog';
22
- *
23
- * init(createDatadogConfig({
24
- * apiKey: process.env.DATADOG_API_KEY!,
25
- * service: 'my-app',
26
- * }));
27
- * ```
28
- */
29
-
30
- export { createHoneycombConfig, type HoneycombPresetConfig } from './honeycomb';
31
-
32
- export {
33
- createDatadogConfig,
34
- type DatadogPresetConfig,
35
- type DatadogSite,
36
- } from './datadog';
37
-
38
- export {
39
- createGoogleCloudConfig,
40
- type GoogleCloudPresetConfig,
41
- } from './google-cloud';
42
-
43
- export { createGrafanaConfig, type GrafanaPresetConfig } from './grafana';