@crossdelta/infrastructure 0.2.24 → 0.2.25
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/helpers/index.d.ts +1 -0
- package/dist/helpers/otel.d.ts +62 -0
- package/dist/index.cjs +10552 -13703
- package/dist/index.js +10549 -13700
- package/package.json +1 -1
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './discover-services';
|
|
|
3
3
|
export * from './docker-hub-image';
|
|
4
4
|
export * from './droplet-builder';
|
|
5
5
|
export * from './image';
|
|
6
|
+
export * from './otel';
|
|
6
7
|
export * from './service-builder';
|
|
7
8
|
export * from './service-runtime';
|
|
8
9
|
export * from './service-urls';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type * as pulumi from '@pulumi/pulumi';
|
|
2
|
+
/**
|
|
3
|
+
* OpenTelemetry configuration for OTLP export.
|
|
4
|
+
*/
|
|
5
|
+
export interface OtelConfig {
|
|
6
|
+
/** OTLP endpoint for traces (e.g., https://in-otel.logs.betterstack.com/v1/traces) */
|
|
7
|
+
tracesEndpoint?: pulumi.Input<string>;
|
|
8
|
+
/** OTLP endpoint for metrics (e.g., https://in-otel.logs.betterstack.com/v1/metrics) */
|
|
9
|
+
metricsEndpoint?: pulumi.Input<string>;
|
|
10
|
+
/** OTLP headers (e.g., "Authorization=Bearer xxx") */
|
|
11
|
+
headers?: pulumi.Input<string>;
|
|
12
|
+
/** Deployment environment (e.g., "production", "staging") */
|
|
13
|
+
environment?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Builds OpenTelemetry environment variables for a service.
|
|
17
|
+
*
|
|
18
|
+
* @param serviceName - Unique service name (e.g., "orderboss-storefront")
|
|
19
|
+
* @param config - OTel configuration from Pulumi config
|
|
20
|
+
* @returns Record of environment variables for OTel SDK auto-instrumentation
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const otelConfig = {
|
|
25
|
+
* tracesEndpoint: cfg.get('otelTracesEndpoint'),
|
|
26
|
+
* metricsEndpoint: cfg.get('otelMetricsEndpoint'),
|
|
27
|
+
* headers: cfg.getSecret('otelHeaders'),
|
|
28
|
+
* environment: 'production',
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* const serviceConfig = {
|
|
32
|
+
* name: 'orders',
|
|
33
|
+
* env: {
|
|
34
|
+
* ...buildOtelEnv('orderboss-orders', otelConfig),
|
|
35
|
+
* // other env vars
|
|
36
|
+
* },
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildOtelEnv(serviceName: string, config: OtelConfig): Record<string, pulumi.Input<string>>;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a function that builds OTel env vars with pre-configured endpoints.
|
|
43
|
+
* Useful for applying the same OTel config to multiple services.
|
|
44
|
+
*
|
|
45
|
+
* @param config - OTel configuration from Pulumi config
|
|
46
|
+
* @returns Function that takes a service name and returns OTel env vars
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const withOtelEnv = createOtelEnvBuilder({
|
|
51
|
+
* tracesEndpoint: cfg.get('otelTracesEndpoint'),
|
|
52
|
+
* headers: cfg.getSecret('otelHeaders'),
|
|
53
|
+
* environment: getStack(),
|
|
54
|
+
* })
|
|
55
|
+
*
|
|
56
|
+
* // In each service config:
|
|
57
|
+
* env: {
|
|
58
|
+
* ...withOtelEnv('orderboss-orders'),
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function createOtelEnvBuilder(config: OtelConfig): (serviceName: string) => Record<string, pulumi.Input<string>>;
|