@ciq-dev/neoiq-foundation-node 1.0.1-beta.2 → 1.0.1-beta.3
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/bootstrap.d.mts +1 -0
- package/dist/bootstrap.d.ts +1 -0
- package/dist/bootstrap.js +31 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bootstrap.mjs +30 -0
- package/dist/bootstrap.mjs.map +1 -0
- package/dist/index.d.mts +77 -60
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +77 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +154 -300
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -244
- package/dist/index.mjs.map +1 -1
- package/dist/tracing-Cv-Y3fZx.mjs +196 -0
- package/dist/tracing-Cv-Y3fZx.mjs.map +1 -0
- package/dist/tracing-DM5OFo7l.js +316 -0
- package/dist/tracing-DM5OFo7l.js.map +1 -0
- package/package.json +13 -6
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
3
|
+
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
|
|
4
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
5
|
+
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
6
|
+
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
|
|
7
|
+
import { SpanStatusCode as SpanStatusCode$1, context as context$1, propagation as propagation$1, trace as trace$1 } from "@opentelemetry/api";
|
|
8
|
+
import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
//#region rolldown:runtime
|
|
12
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/config.ts
|
|
16
|
+
const AutoInstrumentationConfigSchema = z.object({
|
|
17
|
+
http: z.boolean().default(true),
|
|
18
|
+
fastify: z.boolean().default(true),
|
|
19
|
+
express: z.boolean().default(true),
|
|
20
|
+
mongodb: z.boolean().default(true),
|
|
21
|
+
pg: z.boolean().default(true),
|
|
22
|
+
mysql: z.boolean().default(true),
|
|
23
|
+
redis: z.boolean().default(true),
|
|
24
|
+
ioredis: z.boolean().default(true),
|
|
25
|
+
grpc: z.boolean().default(true),
|
|
26
|
+
fs: z.boolean().default(false),
|
|
27
|
+
dns: z.boolean().default(false)
|
|
28
|
+
}).partial();
|
|
29
|
+
const FeaturesConfigSchema = z.object({
|
|
30
|
+
tracing: z.boolean().default(true),
|
|
31
|
+
metrics: z.boolean().default(true),
|
|
32
|
+
logging: z.boolean().default(true),
|
|
33
|
+
autoInstrumentation: AutoInstrumentationConfigSchema.default({})
|
|
34
|
+
}).partial();
|
|
35
|
+
const DEFAULT_OTEL_ENDPOINT = "http://otel-stack-deployment-collector.observability.svc.cluster.local:4317";
|
|
36
|
+
const OtelConfigSchema = z.object({
|
|
37
|
+
endpoint: z.string().default(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT),
|
|
38
|
+
metricsIntervalMs: z.number().min(1e3).default(5e3),
|
|
39
|
+
traceSampleRate: z.number().min(0).max(1).default(1)
|
|
40
|
+
});
|
|
41
|
+
const LoggingConfigSchema = z.object({
|
|
42
|
+
level: z.enum([
|
|
43
|
+
"debug",
|
|
44
|
+
"info",
|
|
45
|
+
"warn",
|
|
46
|
+
"error"
|
|
47
|
+
]).default("info"),
|
|
48
|
+
prettyPrint: z.boolean().optional()
|
|
49
|
+
}).partial();
|
|
50
|
+
const RequestLoggingConfigSchema = z.object({
|
|
51
|
+
logHeaders: z.boolean().default(true),
|
|
52
|
+
logBody: z.boolean().default(false),
|
|
53
|
+
logResponseBody: z.boolean().default(false),
|
|
54
|
+
maxBodySize: z.number().default(10 * 1024),
|
|
55
|
+
redactHeaders: z.array(z.string()).optional()
|
|
56
|
+
}).partial();
|
|
57
|
+
const RedactionConfigSchema = z.object({ additionalPaths: z.array(z.string()).default([]) }).partial();
|
|
58
|
+
const ShutdownConfigSchema = z.object({
|
|
59
|
+
flushOnCrash: z.boolean().default(false),
|
|
60
|
+
flushTimeoutMs: z.number().min(100).default(5e3)
|
|
61
|
+
}).partial();
|
|
62
|
+
const FoundationConfigSchema = z.object({
|
|
63
|
+
serviceName: z.string().min(1, "serviceName is required"),
|
|
64
|
+
serviceVersion: z.string().default(process.env.SERVICE_VERSION || "1.0.0"),
|
|
65
|
+
environment: z.enum([
|
|
66
|
+
"development",
|
|
67
|
+
"staging",
|
|
68
|
+
"qa",
|
|
69
|
+
"production"
|
|
70
|
+
]).default([
|
|
71
|
+
"development",
|
|
72
|
+
"staging",
|
|
73
|
+
"qa",
|
|
74
|
+
"production"
|
|
75
|
+
].includes(process.env.NODE_ENV ?? "") ? process.env.NODE_ENV : "development"),
|
|
76
|
+
features: FeaturesConfigSchema.default({}),
|
|
77
|
+
otel: OtelConfigSchema.default({}),
|
|
78
|
+
logging: LoggingConfigSchema.default({}),
|
|
79
|
+
requestLogging: RequestLoggingConfigSchema.default({}),
|
|
80
|
+
redaction: RedactionConfigSchema.default({}),
|
|
81
|
+
shutdown: ShutdownConfigSchema.default({})
|
|
82
|
+
});
|
|
83
|
+
/** Parse and validate configuration */
|
|
84
|
+
function parseConfig(input) {
|
|
85
|
+
const result = FoundationConfigSchema.safeParse(input);
|
|
86
|
+
if (!result.success) {
|
|
87
|
+
const errors = result.error.errors.map((e) => ` - ${e.path.join(".")}: ${e.message}`).join("\n");
|
|
88
|
+
throw new Error(`Invalid foundation configuration:\n${errors}`);
|
|
89
|
+
}
|
|
90
|
+
return result.data;
|
|
91
|
+
}
|
|
92
|
+
/** Get default OTEL endpoint */
|
|
93
|
+
function getDefaultOtelEndpoint() {
|
|
94
|
+
return process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/features/tracing.ts
|
|
99
|
+
let sdk = null;
|
|
100
|
+
let isInitialized = false;
|
|
101
|
+
const MONITORED_MODULES = [
|
|
102
|
+
"pg",
|
|
103
|
+
"mongodb",
|
|
104
|
+
"ioredis",
|
|
105
|
+
"mysql2",
|
|
106
|
+
"express",
|
|
107
|
+
"@grpc/grpc-js"
|
|
108
|
+
];
|
|
109
|
+
function warnPreloadedModules() {
|
|
110
|
+
if (typeof __require === "undefined" || typeof __require.cache === "undefined") return;
|
|
111
|
+
for (const mod of MONITORED_MODULES) try {
|
|
112
|
+
const resolved = __require.resolve(mod);
|
|
113
|
+
if (__require.cache[resolved]) console.warn(`[neoiq-foundation] "${mod}" was imported before tracing init. Auto-instrumentation may not work for this module. Use node -r @ciq-dev/neoiq-foundation-node/bootstrap or call createFoundation() first.`);
|
|
114
|
+
} catch {}
|
|
115
|
+
}
|
|
116
|
+
/** Initialize OpenTelemetry tracing */
|
|
117
|
+
function setupTracing(options) {
|
|
118
|
+
if (isInitialized) {
|
|
119
|
+
console.warn("[neoiq-foundation] Tracing already initialized");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
warnPreloadedModules();
|
|
123
|
+
const { serviceName, serviceVersion, environment, endpoint = getDefaultOtelEndpoint(), sampleRate, autoInstrumentation = {} } = options;
|
|
124
|
+
const resource = resourceFromAttributes({
|
|
125
|
+
[ATTR_SERVICE_NAME]: serviceName,
|
|
126
|
+
[ATTR_SERVICE_VERSION]: serviceVersion,
|
|
127
|
+
"deployment.environment": environment
|
|
128
|
+
});
|
|
129
|
+
const traceExporter = new OTLPTraceExporter({ url: endpoint });
|
|
130
|
+
const instrumentationConfig = buildInstrumentationConfig(autoInstrumentation);
|
|
131
|
+
const sampler = sampleRate !== void 0 && sampleRate < 1 ? new ParentBasedSampler({ root: new TraceIdRatioBasedSampler(sampleRate) }) : void 0;
|
|
132
|
+
sdk = new NodeSDK({
|
|
133
|
+
resource,
|
|
134
|
+
traceExporter,
|
|
135
|
+
sampler,
|
|
136
|
+
instrumentations: [getNodeAutoInstrumentations(instrumentationConfig)]
|
|
137
|
+
});
|
|
138
|
+
sdk.start();
|
|
139
|
+
isInitialized = true;
|
|
140
|
+
}
|
|
141
|
+
function buildInstrumentationConfig(config) {
|
|
142
|
+
const mapping = {
|
|
143
|
+
http: "@opentelemetry/instrumentation-http",
|
|
144
|
+
fastify: "@opentelemetry/instrumentation-fastify",
|
|
145
|
+
express: "@opentelemetry/instrumentation-express",
|
|
146
|
+
mongodb: "@opentelemetry/instrumentation-mongodb",
|
|
147
|
+
pg: "@opentelemetry/instrumentation-pg",
|
|
148
|
+
mysql: "@opentelemetry/instrumentation-mysql",
|
|
149
|
+
redis: "@opentelemetry/instrumentation-redis",
|
|
150
|
+
ioredis: "@opentelemetry/instrumentation-ioredis",
|
|
151
|
+
grpc: "@opentelemetry/instrumentation-grpc",
|
|
152
|
+
fs: "@opentelemetry/instrumentation-fs",
|
|
153
|
+
dns: "@opentelemetry/instrumentation-dns"
|
|
154
|
+
};
|
|
155
|
+
const result = {};
|
|
156
|
+
for (const [key, instrumentationName] of Object.entries(mapping)) {
|
|
157
|
+
const userSetting = config[key];
|
|
158
|
+
const defaultValue = key !== "fs" && key !== "dns";
|
|
159
|
+
result[instrumentationName] = { enabled: userSetting ?? defaultValue };
|
|
160
|
+
}
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
/** Shutdown tracing gracefully */
|
|
164
|
+
async function shutdownTracing() {
|
|
165
|
+
if (!sdk) return;
|
|
166
|
+
try {
|
|
167
|
+
await sdk.shutdown();
|
|
168
|
+
isInitialized = false;
|
|
169
|
+
sdk = null;
|
|
170
|
+
} catch (error) {
|
|
171
|
+
console.error("[neoiq-foundation] Error shutting down tracing:", error);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function getTracer(name) {
|
|
176
|
+
return trace$1.getTracer(name);
|
|
177
|
+
}
|
|
178
|
+
function getActiveSpan() {
|
|
179
|
+
return trace$1.getActiveSpan();
|
|
180
|
+
}
|
|
181
|
+
function getTraceContext() {
|
|
182
|
+
const span = trace$1.getActiveSpan();
|
|
183
|
+
if (!span) return {};
|
|
184
|
+
const ctx = span.spanContext();
|
|
185
|
+
return {
|
|
186
|
+
traceId: ctx.traceId,
|
|
187
|
+
spanId: ctx.spanId
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function isTracingEnabled() {
|
|
191
|
+
return isInitialized;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
export { AutoInstrumentationConfigSchema, FeaturesConfigSchema, FoundationConfigSchema, LoggingConfigSchema, OtelConfigSchema, RedactionConfigSchema, RequestLoggingConfigSchema, ShutdownConfigSchema, SpanStatusCode$1 as SpanStatusCode, context$1 as context, getActiveSpan, getDefaultOtelEndpoint, getTraceContext, getTracer, isTracingEnabled, parseConfig, propagation$1 as propagation, setupTracing, shutdownTracing, trace$1 as trace };
|
|
196
|
+
//# sourceMappingURL=tracing-Cv-Y3fZx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-Cv-Y3fZx.mjs","names":["input: FoundationConfigInput","sdk: NodeSDK | null","options: TracingOptions","config: AutoInstrumentationConfig","mapping: Record<string, string>","result: Record<string, { enabled: boolean }>","name: string"],"sources":["../src/config.ts","../src/features/tracing.ts"],"sourcesContent":["/**\n * Foundation Configuration with Zod Validation\n */\n\nimport { z } from 'zod';\n\n// Auto-Instrumentation Config\nexport const AutoInstrumentationConfigSchema = z\n .object({\n http: z.boolean().default(true),\n fastify: z.boolean().default(true),\n express: z.boolean().default(true),\n mongodb: z.boolean().default(true),\n pg: z.boolean().default(true),\n mysql: z.boolean().default(true),\n redis: z.boolean().default(true),\n ioredis: z.boolean().default(true),\n grpc: z.boolean().default(true),\n fs: z.boolean().default(false),\n dns: z.boolean().default(false),\n })\n .partial();\n\nexport type AutoInstrumentationConfig = z.infer<typeof AutoInstrumentationConfigSchema>;\n\n// Features Config\nexport const FeaturesConfigSchema = z\n .object({\n tracing: z.boolean().default(true),\n metrics: z.boolean().default(true),\n logging: z.boolean().default(true),\n autoInstrumentation: AutoInstrumentationConfigSchema.default({}),\n })\n .partial();\n\nexport type FeaturesConfig = z.infer<typeof FeaturesConfigSchema>;\n\n// OTEL Config\nconst DEFAULT_OTEL_ENDPOINT =\n 'http://otel-stack-deployment-collector.observability.svc.cluster.local:4317';\n\nexport const OtelConfigSchema = z.object({\n endpoint: z\n .string()\n .default(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT),\n metricsIntervalMs: z.number().min(1000).default(5000),\n traceSampleRate: z.number().min(0).max(1).default(1.0),\n});\n\nexport type OtelConfig = z.infer<typeof OtelConfigSchema>;\n\n// Logging Config\nexport const LoggingConfigSchema = z\n .object({\n level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),\n prettyPrint: z.boolean().optional(),\n })\n .partial();\n\nexport type LoggingConfig = z.infer<typeof LoggingConfigSchema>;\n\n// Request Logging Config\nexport const RequestLoggingConfigSchema = z\n .object({\n logHeaders: z.boolean().default(true),\n logBody: z.boolean().default(false),\n logResponseBody: z.boolean().default(false),\n maxBodySize: z.number().default(10 * 1024),\n redactHeaders: z.array(z.string()).optional(),\n })\n .partial();\n\nexport type RequestLoggingConfig = z.infer<typeof RequestLoggingConfigSchema>;\n\n// Redaction Config\nexport const RedactionConfigSchema = z\n .object({\n additionalPaths: z.array(z.string()).default([]),\n })\n .partial();\n\nexport type RedactionConfig = z.infer<typeof RedactionConfigSchema>;\n\n// Shutdown Config\nexport const ShutdownConfigSchema = z\n .object({\n /** Flush telemetry on uncaughtException / unhandledRejection before process exits */\n flushOnCrash: z.boolean().default(false),\n /** Grace period (ms) for flushing before forcing exit */\n flushTimeoutMs: z.number().min(100).default(5000),\n })\n .partial();\n\nexport type ShutdownConfig = z.infer<typeof ShutdownConfigSchema>;\n\n// Main Foundation Config\nexport const FoundationConfigSchema = z.object({\n serviceName: z.string().min(1, 'serviceName is required'),\n serviceVersion: z.string().default(process.env.SERVICE_VERSION || '1.0.0'),\n environment: z\n .enum(['development', 'staging', 'qa', 'production'])\n .default(\n (['development', 'staging', 'qa', 'production'].includes(process.env.NODE_ENV ?? '')\n ? (process.env.NODE_ENV as 'development' | 'staging' | 'qa' | 'production')\n : 'development'),\n ),\n features: FeaturesConfigSchema.default({}),\n otel: OtelConfigSchema.default({}),\n logging: LoggingConfigSchema.default({}),\n requestLogging: RequestLoggingConfigSchema.default({}),\n redaction: RedactionConfigSchema.default({}),\n shutdown: ShutdownConfigSchema.default({}),\n});\n\nexport type FoundationConfig = z.infer<typeof FoundationConfigSchema>;\n\nexport type FoundationConfigInput = z.input<typeof FoundationConfigSchema> & {\n serviceName: string;\n};\n\n/** Parse and validate configuration */\nexport function parseConfig(input: FoundationConfigInput): FoundationConfig {\n const result = FoundationConfigSchema.safeParse(input);\n\n if (!result.success) {\n const errors = result.error.errors\n .map((e) => ` - ${e.path.join('.')}: ${e.message}`)\n .join('\\n');\n throw new Error(`Invalid foundation configuration:\\n${errors}`);\n }\n\n return result.data;\n}\n\n/** Get default OTEL endpoint */\nexport function getDefaultOtelEndpoint(): string {\n return process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT;\n}\n","/**\n * OpenTelemetry Tracing Setup\n */\n\nimport { NodeSDK } from '@opentelemetry/sdk-node';\nimport { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';\nimport { trace, context, propagation, SpanStatusCode, type Tracer } from '@opentelemetry/api';\nimport { TraceIdRatioBasedSampler, ParentBasedSampler } from '@opentelemetry/sdk-trace-base';\nimport { type AutoInstrumentationConfig, getDefaultOtelEndpoint } from '../config';\n\nexport interface TracingOptions {\n serviceName: string;\n serviceVersion: string;\n environment: string;\n endpoint?: string;\n sampleRate?: number;\n autoInstrumentation?: AutoInstrumentationConfig;\n}\n\nlet sdk: NodeSDK | null = null;\nlet isInitialized = false;\n\nconst MONITORED_MODULES = ['pg', 'mongodb', 'ioredis', 'mysql2', 'express', '@grpc/grpc-js'];\n\nfunction warnPreloadedModules(): void {\n // require.resolve / require.cache are only available in CJS contexts\n if (typeof require === 'undefined' || typeof require.cache === 'undefined') return;\n\n for (const mod of MONITORED_MODULES) {\n try {\n const resolved = require.resolve(mod);\n if (require.cache[resolved]) {\n console.warn(\n `[neoiq-foundation] \"${mod}\" was imported before tracing init. ` +\n 'Auto-instrumentation may not work for this module. ' +\n 'Use node -r @ciq-dev/neoiq-foundation-node/bootstrap or call createFoundation() first.',\n );\n }\n } catch {\n // Module not installed — no warning needed\n }\n }\n}\n\n/** Initialize OpenTelemetry tracing */\nexport function setupTracing(options: TracingOptions): void {\n if (isInitialized) {\n console.warn('[neoiq-foundation] Tracing already initialized');\n return;\n }\n\n warnPreloadedModules();\n\n const {\n serviceName,\n serviceVersion,\n environment,\n endpoint = getDefaultOtelEndpoint(),\n sampleRate,\n autoInstrumentation = {},\n } = options;\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: serviceName,\n [ATTR_SERVICE_VERSION]: serviceVersion,\n 'deployment.environment': environment,\n });\n\n const traceExporter = new OTLPTraceExporter({ url: endpoint });\n const instrumentationConfig = buildInstrumentationConfig(autoInstrumentation);\n\n const sampler =\n sampleRate !== undefined && sampleRate < 1.0\n ? new ParentBasedSampler({ root: new TraceIdRatioBasedSampler(sampleRate) })\n : undefined;\n\n sdk = new NodeSDK({\n resource,\n traceExporter,\n sampler,\n instrumentations: [getNodeAutoInstrumentations(instrumentationConfig)],\n });\n\n sdk.start();\n isInitialized = true;\n}\n\nfunction buildInstrumentationConfig(\n config: AutoInstrumentationConfig\n): Record<string, { enabled: boolean }> {\n const mapping: Record<string, string> = {\n http: '@opentelemetry/instrumentation-http',\n fastify: '@opentelemetry/instrumentation-fastify',\n express: '@opentelemetry/instrumentation-express',\n mongodb: '@opentelemetry/instrumentation-mongodb',\n pg: '@opentelemetry/instrumentation-pg',\n mysql: '@opentelemetry/instrumentation-mysql',\n redis: '@opentelemetry/instrumentation-redis',\n ioredis: '@opentelemetry/instrumentation-ioredis',\n grpc: '@opentelemetry/instrumentation-grpc',\n fs: '@opentelemetry/instrumentation-fs',\n dns: '@opentelemetry/instrumentation-dns',\n };\n\n const result: Record<string, { enabled: boolean }> = {};\n for (const [key, instrumentationName] of Object.entries(mapping)) {\n const userSetting = config[key as keyof AutoInstrumentationConfig];\n const defaultValue = key !== 'fs' && key !== 'dns';\n result[instrumentationName] = { enabled: userSetting ?? defaultValue };\n }\n return result;\n}\n\n/** Shutdown tracing gracefully */\nexport async function shutdownTracing(): Promise<void> {\n if (!sdk) return;\n try {\n await sdk.shutdown();\n isInitialized = false;\n sdk = null;\n } catch (error) {\n console.error('[neoiq-foundation] Error shutting down tracing:', error);\n throw error;\n }\n}\n\nexport function getTracer(name: string): Tracer {\n return trace.getTracer(name);\n}\n\nexport function getActiveSpan(): ReturnType<typeof trace.getActiveSpan> {\n return trace.getActiveSpan();\n}\n\nexport function getTraceContext(): { traceId?: string; spanId?: string } {\n const span = trace.getActiveSpan();\n if (!span) return {};\n const ctx = span.spanContext();\n return { traceId: ctx.traceId, spanId: ctx.spanId };\n}\n\nexport function isTracingEnabled(): boolean {\n return isInitialized;\n}\n\nexport { trace, context, propagation, SpanStatusCode };\nexport type { Tracer };\n"],"mappings":";;;;;;;;;;;;;;;AAOA,MAAa,kCAAkC,EAC5C,OAAO;CACN,MAAM,EAAE,SAAS,CAAC,QAAQ,KAAK;CAC/B,SAAS,EAAE,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AM;EACN,IAAI;EACJ,KAAK;CACN;CAED,MAAMC,SAA+C,CAAE;AACvD,MAAK,MAAM,CAAC,KAAK,oBAAoB,IAAI,OAAO,QAAQ,QAAQ,EAAE;EAChE,MAAM,cAAc,OAAO;EAC3B,MAAM,eAAe,QAAQ,QAAQ,QAAQ;AAC7C,SAAO,uBAAuB,EAAE,SAAS,eAAe,aAAc;CACvE;AACD,QAAO;AACR;;AAGD,eAAsB,kBAAiC;AACrD,MAAK,IAAK;AACV,KAAI;AACF,QAAM,IAAI,UAAU;AACpB,kBAAgB;AAChB,QAAM;CACP,SAAQ,OAAO;AACd,UAAQ,MAAM,mDAAmD,MAAM;AACvE,QAAM;CACP;AACF;AAED,SAAgB,UAAUC,MAAsB;AAC9C,QAAO,QAAM,UAAU,KAAK;AAC7B;AAED,SAAgB,gBAAwD;AACtE,QAAO,QAAM,eAAe;AAC7B;AAED,SAAgB,kBAAyD;CACvE,MAAM,OAAO,QAAM,eAAe;AAClC,MAAK,KAAM,QAAO,CAAE;CACpB,MAAM,MAAM,KAAK,aAAa;AAC9B,QAAO;EAAE,SAAS,IAAI;EAAS,QAAQ,IAAI;CAAQ;AACpD;AAED,SAAgB,mBAA4B;AAC1C,QAAO;AACR"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
const __opentelemetry_sdk_node = __toESM(require("@opentelemetry/sdk-node"));
|
|
26
|
+
const __opentelemetry_auto_instrumentations_node = __toESM(require("@opentelemetry/auto-instrumentations-node"));
|
|
27
|
+
const __opentelemetry_exporter_trace_otlp_grpc = __toESM(require("@opentelemetry/exporter-trace-otlp-grpc"));
|
|
28
|
+
const __opentelemetry_resources = __toESM(require("@opentelemetry/resources"));
|
|
29
|
+
const __opentelemetry_semantic_conventions = __toESM(require("@opentelemetry/semantic-conventions"));
|
|
30
|
+
const __opentelemetry_api = __toESM(require("@opentelemetry/api"));
|
|
31
|
+
const __opentelemetry_sdk_trace_base = __toESM(require("@opentelemetry/sdk-trace-base"));
|
|
32
|
+
const zod = __toESM(require("zod"));
|
|
33
|
+
|
|
34
|
+
//#region src/config.ts
|
|
35
|
+
const AutoInstrumentationConfigSchema = zod.z.object({
|
|
36
|
+
http: zod.z.boolean().default(true),
|
|
37
|
+
fastify: zod.z.boolean().default(true),
|
|
38
|
+
express: zod.z.boolean().default(true),
|
|
39
|
+
mongodb: zod.z.boolean().default(true),
|
|
40
|
+
pg: zod.z.boolean().default(true),
|
|
41
|
+
mysql: zod.z.boolean().default(true),
|
|
42
|
+
redis: zod.z.boolean().default(true),
|
|
43
|
+
ioredis: zod.z.boolean().default(true),
|
|
44
|
+
grpc: zod.z.boolean().default(true),
|
|
45
|
+
fs: zod.z.boolean().default(false),
|
|
46
|
+
dns: zod.z.boolean().default(false)
|
|
47
|
+
}).partial();
|
|
48
|
+
const FeaturesConfigSchema = zod.z.object({
|
|
49
|
+
tracing: zod.z.boolean().default(true),
|
|
50
|
+
metrics: zod.z.boolean().default(true),
|
|
51
|
+
logging: zod.z.boolean().default(true),
|
|
52
|
+
autoInstrumentation: AutoInstrumentationConfigSchema.default({})
|
|
53
|
+
}).partial();
|
|
54
|
+
const DEFAULT_OTEL_ENDPOINT = "http://otel-stack-deployment-collector.observability.svc.cluster.local:4317";
|
|
55
|
+
const OtelConfigSchema = zod.z.object({
|
|
56
|
+
endpoint: zod.z.string().default(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT),
|
|
57
|
+
metricsIntervalMs: zod.z.number().min(1e3).default(5e3),
|
|
58
|
+
traceSampleRate: zod.z.number().min(0).max(1).default(1)
|
|
59
|
+
});
|
|
60
|
+
const LoggingConfigSchema = zod.z.object({
|
|
61
|
+
level: zod.z.enum([
|
|
62
|
+
"debug",
|
|
63
|
+
"info",
|
|
64
|
+
"warn",
|
|
65
|
+
"error"
|
|
66
|
+
]).default("info"),
|
|
67
|
+
prettyPrint: zod.z.boolean().optional()
|
|
68
|
+
}).partial();
|
|
69
|
+
const RequestLoggingConfigSchema = zod.z.object({
|
|
70
|
+
logHeaders: zod.z.boolean().default(true),
|
|
71
|
+
logBody: zod.z.boolean().default(false),
|
|
72
|
+
logResponseBody: zod.z.boolean().default(false),
|
|
73
|
+
maxBodySize: zod.z.number().default(10 * 1024),
|
|
74
|
+
redactHeaders: zod.z.array(zod.z.string()).optional()
|
|
75
|
+
}).partial();
|
|
76
|
+
const RedactionConfigSchema = zod.z.object({ additionalPaths: zod.z.array(zod.z.string()).default([]) }).partial();
|
|
77
|
+
const ShutdownConfigSchema = zod.z.object({
|
|
78
|
+
flushOnCrash: zod.z.boolean().default(false),
|
|
79
|
+
flushTimeoutMs: zod.z.number().min(100).default(5e3)
|
|
80
|
+
}).partial();
|
|
81
|
+
const FoundationConfigSchema = zod.z.object({
|
|
82
|
+
serviceName: zod.z.string().min(1, "serviceName is required"),
|
|
83
|
+
serviceVersion: zod.z.string().default(process.env.SERVICE_VERSION || "1.0.0"),
|
|
84
|
+
environment: zod.z.enum([
|
|
85
|
+
"development",
|
|
86
|
+
"staging",
|
|
87
|
+
"qa",
|
|
88
|
+
"production"
|
|
89
|
+
]).default([
|
|
90
|
+
"development",
|
|
91
|
+
"staging",
|
|
92
|
+
"qa",
|
|
93
|
+
"production"
|
|
94
|
+
].includes(process.env.NODE_ENV ?? "") ? process.env.NODE_ENV : "development"),
|
|
95
|
+
features: FeaturesConfigSchema.default({}),
|
|
96
|
+
otel: OtelConfigSchema.default({}),
|
|
97
|
+
logging: LoggingConfigSchema.default({}),
|
|
98
|
+
requestLogging: RequestLoggingConfigSchema.default({}),
|
|
99
|
+
redaction: RedactionConfigSchema.default({}),
|
|
100
|
+
shutdown: ShutdownConfigSchema.default({})
|
|
101
|
+
});
|
|
102
|
+
/** Parse and validate configuration */
|
|
103
|
+
function parseConfig(input) {
|
|
104
|
+
const result = FoundationConfigSchema.safeParse(input);
|
|
105
|
+
if (!result.success) {
|
|
106
|
+
const errors = result.error.errors.map((e) => ` - ${e.path.join(".")}: ${e.message}`).join("\n");
|
|
107
|
+
throw new Error(`Invalid foundation configuration:\n${errors}`);
|
|
108
|
+
}
|
|
109
|
+
return result.data;
|
|
110
|
+
}
|
|
111
|
+
/** Get default OTEL endpoint */
|
|
112
|
+
function getDefaultOtelEndpoint() {
|
|
113
|
+
return process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/features/tracing.ts
|
|
118
|
+
let sdk = null;
|
|
119
|
+
let isInitialized = false;
|
|
120
|
+
const MONITORED_MODULES = [
|
|
121
|
+
"pg",
|
|
122
|
+
"mongodb",
|
|
123
|
+
"ioredis",
|
|
124
|
+
"mysql2",
|
|
125
|
+
"express",
|
|
126
|
+
"@grpc/grpc-js"
|
|
127
|
+
];
|
|
128
|
+
function warnPreloadedModules() {
|
|
129
|
+
if (typeof require === "undefined" || typeof require.cache === "undefined") return;
|
|
130
|
+
for (const mod of MONITORED_MODULES) try {
|
|
131
|
+
const resolved = require.resolve(mod);
|
|
132
|
+
if (require.cache[resolved]) console.warn(`[neoiq-foundation] "${mod}" was imported before tracing init. Auto-instrumentation may not work for this module. Use node -r @ciq-dev/neoiq-foundation-node/bootstrap or call createFoundation() first.`);
|
|
133
|
+
} catch {}
|
|
134
|
+
}
|
|
135
|
+
/** Initialize OpenTelemetry tracing */
|
|
136
|
+
function setupTracing(options) {
|
|
137
|
+
if (isInitialized) {
|
|
138
|
+
console.warn("[neoiq-foundation] Tracing already initialized");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
warnPreloadedModules();
|
|
142
|
+
const { serviceName, serviceVersion, environment, endpoint = getDefaultOtelEndpoint(), sampleRate, autoInstrumentation = {} } = options;
|
|
143
|
+
const resource = (0, __opentelemetry_resources.resourceFromAttributes)({
|
|
144
|
+
[__opentelemetry_semantic_conventions.ATTR_SERVICE_NAME]: serviceName,
|
|
145
|
+
[__opentelemetry_semantic_conventions.ATTR_SERVICE_VERSION]: serviceVersion,
|
|
146
|
+
"deployment.environment": environment
|
|
147
|
+
});
|
|
148
|
+
const traceExporter = new __opentelemetry_exporter_trace_otlp_grpc.OTLPTraceExporter({ url: endpoint });
|
|
149
|
+
const instrumentationConfig = buildInstrumentationConfig(autoInstrumentation);
|
|
150
|
+
const sampler = sampleRate !== void 0 && sampleRate < 1 ? new __opentelemetry_sdk_trace_base.ParentBasedSampler({ root: new __opentelemetry_sdk_trace_base.TraceIdRatioBasedSampler(sampleRate) }) : void 0;
|
|
151
|
+
sdk = new __opentelemetry_sdk_node.NodeSDK({
|
|
152
|
+
resource,
|
|
153
|
+
traceExporter,
|
|
154
|
+
sampler,
|
|
155
|
+
instrumentations: [(0, __opentelemetry_auto_instrumentations_node.getNodeAutoInstrumentations)(instrumentationConfig)]
|
|
156
|
+
});
|
|
157
|
+
sdk.start();
|
|
158
|
+
isInitialized = true;
|
|
159
|
+
}
|
|
160
|
+
function buildInstrumentationConfig(config) {
|
|
161
|
+
const mapping = {
|
|
162
|
+
http: "@opentelemetry/instrumentation-http",
|
|
163
|
+
fastify: "@opentelemetry/instrumentation-fastify",
|
|
164
|
+
express: "@opentelemetry/instrumentation-express",
|
|
165
|
+
mongodb: "@opentelemetry/instrumentation-mongodb",
|
|
166
|
+
pg: "@opentelemetry/instrumentation-pg",
|
|
167
|
+
mysql: "@opentelemetry/instrumentation-mysql",
|
|
168
|
+
redis: "@opentelemetry/instrumentation-redis",
|
|
169
|
+
ioredis: "@opentelemetry/instrumentation-ioredis",
|
|
170
|
+
grpc: "@opentelemetry/instrumentation-grpc",
|
|
171
|
+
fs: "@opentelemetry/instrumentation-fs",
|
|
172
|
+
dns: "@opentelemetry/instrumentation-dns"
|
|
173
|
+
};
|
|
174
|
+
const result = {};
|
|
175
|
+
for (const [key, instrumentationName] of Object.entries(mapping)) {
|
|
176
|
+
const userSetting = config[key];
|
|
177
|
+
const defaultValue = key !== "fs" && key !== "dns";
|
|
178
|
+
result[instrumentationName] = { enabled: userSetting ?? defaultValue };
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
/** Shutdown tracing gracefully */
|
|
183
|
+
async function shutdownTracing() {
|
|
184
|
+
if (!sdk) return;
|
|
185
|
+
try {
|
|
186
|
+
await sdk.shutdown();
|
|
187
|
+
isInitialized = false;
|
|
188
|
+
sdk = null;
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error("[neoiq-foundation] Error shutting down tracing:", error);
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function getTracer(name) {
|
|
195
|
+
return __opentelemetry_api.trace.getTracer(name);
|
|
196
|
+
}
|
|
197
|
+
function getActiveSpan() {
|
|
198
|
+
return __opentelemetry_api.trace.getActiveSpan();
|
|
199
|
+
}
|
|
200
|
+
function getTraceContext() {
|
|
201
|
+
const span = __opentelemetry_api.trace.getActiveSpan();
|
|
202
|
+
if (!span) return {};
|
|
203
|
+
const ctx = span.spanContext();
|
|
204
|
+
return {
|
|
205
|
+
traceId: ctx.traceId,
|
|
206
|
+
spanId: ctx.spanId
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function isTracingEnabled() {
|
|
210
|
+
return isInitialized;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
Object.defineProperty(exports, 'AutoInstrumentationConfigSchema', {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function () {
|
|
217
|
+
return AutoInstrumentationConfigSchema;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(exports, 'FeaturesConfigSchema', {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () {
|
|
223
|
+
return FeaturesConfigSchema;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, 'FoundationConfigSchema', {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function () {
|
|
229
|
+
return FoundationConfigSchema;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(exports, 'LoggingConfigSchema', {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
get: function () {
|
|
235
|
+
return LoggingConfigSchema;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(exports, 'OtelConfigSchema', {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
get: function () {
|
|
241
|
+
return OtelConfigSchema;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(exports, 'RedactionConfigSchema', {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: function () {
|
|
247
|
+
return RedactionConfigSchema;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, 'RequestLoggingConfigSchema', {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function () {
|
|
253
|
+
return RequestLoggingConfigSchema;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
Object.defineProperty(exports, 'ShutdownConfigSchema', {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
get: function () {
|
|
259
|
+
return ShutdownConfigSchema;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(exports, '__toESM', {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
get: function () {
|
|
265
|
+
return __toESM;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(exports, 'getActiveSpan', {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function () {
|
|
271
|
+
return getActiveSpan;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
Object.defineProperty(exports, 'getDefaultOtelEndpoint', {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function () {
|
|
277
|
+
return getDefaultOtelEndpoint;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(exports, 'getTraceContext', {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: function () {
|
|
283
|
+
return getTraceContext;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(exports, 'getTracer', {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
get: function () {
|
|
289
|
+
return getTracer;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(exports, 'isTracingEnabled', {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function () {
|
|
295
|
+
return isTracingEnabled;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(exports, 'parseConfig', {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
get: function () {
|
|
301
|
+
return parseConfig;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
Object.defineProperty(exports, 'setupTracing', {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function () {
|
|
307
|
+
return setupTracing;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
Object.defineProperty(exports, 'shutdownTracing', {
|
|
311
|
+
enumerable: true,
|
|
312
|
+
get: function () {
|
|
313
|
+
return shutdownTracing;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
//# sourceMappingURL=tracing-DM5OFo7l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-DM5OFo7l.js","names":["input: FoundationConfigInput","sdk: NodeSDK | null","options: TracingOptions","config: AutoInstrumentationConfig","mapping: Record<string, string>","result: Record<string, { enabled: boolean }>","name: string"],"sources":["../src/config.ts","../src/features/tracing.ts"],"sourcesContent":["/**\n * Foundation Configuration with Zod Validation\n */\n\nimport { z } from 'zod';\n\n// Auto-Instrumentation Config\nexport const AutoInstrumentationConfigSchema = z\n .object({\n http: z.boolean().default(true),\n fastify: z.boolean().default(true),\n express: z.boolean().default(true),\n mongodb: z.boolean().default(true),\n pg: z.boolean().default(true),\n mysql: z.boolean().default(true),\n redis: z.boolean().default(true),\n ioredis: z.boolean().default(true),\n grpc: z.boolean().default(true),\n fs: z.boolean().default(false),\n dns: z.boolean().default(false),\n })\n .partial();\n\nexport type AutoInstrumentationConfig = z.infer<typeof AutoInstrumentationConfigSchema>;\n\n// Features Config\nexport const FeaturesConfigSchema = z\n .object({\n tracing: z.boolean().default(true),\n metrics: z.boolean().default(true),\n logging: z.boolean().default(true),\n autoInstrumentation: AutoInstrumentationConfigSchema.default({}),\n })\n .partial();\n\nexport type FeaturesConfig = z.infer<typeof FeaturesConfigSchema>;\n\n// OTEL Config\nconst DEFAULT_OTEL_ENDPOINT =\n 'http://otel-stack-deployment-collector.observability.svc.cluster.local:4317';\n\nexport const OtelConfigSchema = z.object({\n endpoint: z\n .string()\n .default(process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT),\n metricsIntervalMs: z.number().min(1000).default(5000),\n traceSampleRate: z.number().min(0).max(1).default(1.0),\n});\n\nexport type OtelConfig = z.infer<typeof OtelConfigSchema>;\n\n// Logging Config\nexport const LoggingConfigSchema = z\n .object({\n level: z.enum(['debug', 'info', 'warn', 'error']).default('info'),\n prettyPrint: z.boolean().optional(),\n })\n .partial();\n\nexport type LoggingConfig = z.infer<typeof LoggingConfigSchema>;\n\n// Request Logging Config\nexport const RequestLoggingConfigSchema = z\n .object({\n logHeaders: z.boolean().default(true),\n logBody: z.boolean().default(false),\n logResponseBody: z.boolean().default(false),\n maxBodySize: z.number().default(10 * 1024),\n redactHeaders: z.array(z.string()).optional(),\n })\n .partial();\n\nexport type RequestLoggingConfig = z.infer<typeof RequestLoggingConfigSchema>;\n\n// Redaction Config\nexport const RedactionConfigSchema = z\n .object({\n additionalPaths: z.array(z.string()).default([]),\n })\n .partial();\n\nexport type RedactionConfig = z.infer<typeof RedactionConfigSchema>;\n\n// Shutdown Config\nexport const ShutdownConfigSchema = z\n .object({\n /** Flush telemetry on uncaughtException / unhandledRejection before process exits */\n flushOnCrash: z.boolean().default(false),\n /** Grace period (ms) for flushing before forcing exit */\n flushTimeoutMs: z.number().min(100).default(5000),\n })\n .partial();\n\nexport type ShutdownConfig = z.infer<typeof ShutdownConfigSchema>;\n\n// Main Foundation Config\nexport const FoundationConfigSchema = z.object({\n serviceName: z.string().min(1, 'serviceName is required'),\n serviceVersion: z.string().default(process.env.SERVICE_VERSION || '1.0.0'),\n environment: z\n .enum(['development', 'staging', 'qa', 'production'])\n .default(\n (['development', 'staging', 'qa', 'production'].includes(process.env.NODE_ENV ?? '')\n ? (process.env.NODE_ENV as 'development' | 'staging' | 'qa' | 'production')\n : 'development'),\n ),\n features: FeaturesConfigSchema.default({}),\n otel: OtelConfigSchema.default({}),\n logging: LoggingConfigSchema.default({}),\n requestLogging: RequestLoggingConfigSchema.default({}),\n redaction: RedactionConfigSchema.default({}),\n shutdown: ShutdownConfigSchema.default({}),\n});\n\nexport type FoundationConfig = z.infer<typeof FoundationConfigSchema>;\n\nexport type FoundationConfigInput = z.input<typeof FoundationConfigSchema> & {\n serviceName: string;\n};\n\n/** Parse and validate configuration */\nexport function parseConfig(input: FoundationConfigInput): FoundationConfig {\n const result = FoundationConfigSchema.safeParse(input);\n\n if (!result.success) {\n const errors = result.error.errors\n .map((e) => ` - ${e.path.join('.')}: ${e.message}`)\n .join('\\n');\n throw new Error(`Invalid foundation configuration:\\n${errors}`);\n }\n\n return result.data;\n}\n\n/** Get default OTEL endpoint */\nexport function getDefaultOtelEndpoint(): string {\n return process.env.OTEL_EXPORTER_OTLP_ENDPOINT || DEFAULT_OTEL_ENDPOINT;\n}\n","/**\n * OpenTelemetry Tracing Setup\n */\n\nimport { NodeSDK } from '@opentelemetry/sdk-node';\nimport { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';\nimport { trace, context, propagation, SpanStatusCode, type Tracer } from '@opentelemetry/api';\nimport { TraceIdRatioBasedSampler, ParentBasedSampler } from '@opentelemetry/sdk-trace-base';\nimport { type AutoInstrumentationConfig, getDefaultOtelEndpoint } from '../config';\n\nexport interface TracingOptions {\n serviceName: string;\n serviceVersion: string;\n environment: string;\n endpoint?: string;\n sampleRate?: number;\n autoInstrumentation?: AutoInstrumentationConfig;\n}\n\nlet sdk: NodeSDK | null = null;\nlet isInitialized = false;\n\nconst MONITORED_MODULES = ['pg', 'mongodb', 'ioredis', 'mysql2', 'express', '@grpc/grpc-js'];\n\nfunction warnPreloadedModules(): void {\n // require.resolve / require.cache are only available in CJS contexts\n if (typeof require === 'undefined' || typeof require.cache === 'undefined') return;\n\n for (const mod of MONITORED_MODULES) {\n try {\n const resolved = require.resolve(mod);\n if (require.cache[resolved]) {\n console.warn(\n `[neoiq-foundation] \"${mod}\" was imported before tracing init. ` +\n 'Auto-instrumentation may not work for this module. ' +\n 'Use node -r @ciq-dev/neoiq-foundation-node/bootstrap or call createFoundation() first.',\n );\n }\n } catch {\n // Module not installed — no warning needed\n }\n }\n}\n\n/** Initialize OpenTelemetry tracing */\nexport function setupTracing(options: TracingOptions): void {\n if (isInitialized) {\n console.warn('[neoiq-foundation] Tracing already initialized');\n return;\n }\n\n warnPreloadedModules();\n\n const {\n serviceName,\n serviceVersion,\n environment,\n endpoint = getDefaultOtelEndpoint(),\n sampleRate,\n autoInstrumentation = {},\n } = options;\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: serviceName,\n [ATTR_SERVICE_VERSION]: serviceVersion,\n 'deployment.environment': environment,\n });\n\n const traceExporter = new OTLPTraceExporter({ url: endpoint });\n const instrumentationConfig = buildInstrumentationConfig(autoInstrumentation);\n\n const sampler =\n sampleRate !== undefined && sampleRate < 1.0\n ? new ParentBasedSampler({ root: new TraceIdRatioBasedSampler(sampleRate) })\n : undefined;\n\n sdk = new NodeSDK({\n resource,\n traceExporter,\n sampler,\n instrumentations: [getNodeAutoInstrumentations(instrumentationConfig)],\n });\n\n sdk.start();\n isInitialized = true;\n}\n\nfunction buildInstrumentationConfig(\n config: AutoInstrumentationConfig\n): Record<string, { enabled: boolean }> {\n const mapping: Record<string, string> = {\n http: '@opentelemetry/instrumentation-http',\n fastify: '@opentelemetry/instrumentation-fastify',\n express: '@opentelemetry/instrumentation-express',\n mongodb: '@opentelemetry/instrumentation-mongodb',\n pg: '@opentelemetry/instrumentation-pg',\n mysql: '@opentelemetry/instrumentation-mysql',\n redis: '@opentelemetry/instrumentation-redis',\n ioredis: '@opentelemetry/instrumentation-ioredis',\n grpc: '@opentelemetry/instrumentation-grpc',\n fs: '@opentelemetry/instrumentation-fs',\n dns: '@opentelemetry/instrumentation-dns',\n };\n\n const result: Record<string, { enabled: boolean }> = {};\n for (const [key, instrumentationName] of Object.entries(mapping)) {\n const userSetting = config[key as keyof AutoInstrumentationConfig];\n const defaultValue = key !== 'fs' && key !== 'dns';\n result[instrumentationName] = { enabled: userSetting ?? defaultValue };\n }\n return result;\n}\n\n/** Shutdown tracing gracefully */\nexport async function shutdownTracing(): Promise<void> {\n if (!sdk) return;\n try {\n await sdk.shutdown();\n isInitialized = false;\n sdk = null;\n } catch (error) {\n console.error('[neoiq-foundation] Error shutting down tracing:', error);\n throw error;\n }\n}\n\nexport function getTracer(name: string): Tracer {\n return trace.getTracer(name);\n}\n\nexport function getActiveSpan(): ReturnType<typeof trace.getActiveSpan> {\n return trace.getActiveSpan();\n}\n\nexport function getTraceContext(): { traceId?: string; spanId?: string } {\n const span = trace.getActiveSpan();\n if (!span) return {};\n const ctx = span.spanContext();\n return { traceId: ctx.traceId, spanId: ctx.spanId };\n}\n\nexport function isTracingEnabled(): boolean {\n return isInitialized;\n}\n\nexport { trace, context, propagation, SpanStatusCode };\nexport type { Tracer };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAa,kCAAkC,MAC5C,OAAO;CACN,MAAM,MAAE,SAAS,CAAC,QAAQ,KAAK;CAC/B,SAAS,MAAE,SAAS,CAAC,QAAQ,KAAK;CAClC,SAAS,MAAE,SAAS,CAAC,QAAQ,KAAK;CAClC,SAAS,MAAE,SAAS,CAAC,QAAQ,KAAK;CAClC,IAAI,MAAE,SAAS,CAAC,QAAQ,KAAK;CAC7B,OAAO,MAAE,SAAS,CAAC,QAAQ,KAAK;CAChC,OAAO,MAAE,SAAS,CAAC,QAAQ,KAAK;CAChC,SAAS,MAAE,SAAS,CAAC,QAAQ,KAAK;CAClC,MAAM,MAAE,SAAS,CAAC,QAAQ,KAAK;CAC/B,IAAI,MAAE,SAAS,CAAC,QAAQ,MAAM;CAC9B,KAA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AAQ,OAAO;AACd,UAAQ,MAAM,mDAAmD,MAAM;AACvE,QAAM;CACP;AACF;AAED,SAAgB,UAAUC,MAAsB;AAC9C,QAAO,0BAAM,UAAU,KAAK;AAC7B;AAED,SAAgB,gBAAwD;AACtE,QAAO,0BAAM,eAAe;AAC7B;AAED,SAAgB,kBAAyD;CACvE,MAAM,OAAO,0BAAM,eAAe;AAClC,MAAK,KAAM,QAAO,CAAE;CACpB,MAAM,MAAM,KAAK,aAAa;AAC9B,QAAO;EAAE,SAAS,IAAI;EAAS,QAAQ,IAAI;CAAQ;AACpD;AAED,SAAgB,mBAA4B;AAC1C,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciq-dev/neoiq-foundation-node",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.3",
|
|
4
4
|
"description": "Node.js observability foundation for CommerceIQ services. Integrates with Groundcover via OpenTelemetry.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -17,8 +17,14 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"./bootstrap": {
|
|
20
|
-
"import":
|
|
21
|
-
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/bootstrap.d.mts",
|
|
22
|
+
"default": "./dist/bootstrap.mjs"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/bootstrap.d.ts",
|
|
26
|
+
"default": "./dist/bootstrap.js"
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
},
|
|
24
30
|
"files": [
|
|
@@ -40,7 +46,8 @@
|
|
|
40
46
|
"node": ">=18.0.0"
|
|
41
47
|
},
|
|
42
48
|
"peerDependencies": {
|
|
43
|
-
"
|
|
49
|
+
"@aws-sdk/client-s3": "^3.0.0",
|
|
50
|
+
"@aws-sdk/s3-request-presigner": "^3.0.0",
|
|
44
51
|
"@opentelemetry/api": "^1.7.0",
|
|
45
52
|
"@opentelemetry/auto-instrumentations-node": ">=0.41.0",
|
|
46
53
|
"@opentelemetry/exporter-metrics-otlp-grpc": ">=0.48.0",
|
|
@@ -48,6 +55,7 @@
|
|
|
48
55
|
"@opentelemetry/resources": ">=1.21.0",
|
|
49
56
|
"@opentelemetry/sdk-metrics": ">=1.21.0",
|
|
50
57
|
"@opentelemetry/sdk-node": ">=0.48.0",
|
|
58
|
+
"@opentelemetry/sdk-trace-base": ">=1.21.0",
|
|
51
59
|
"@opentelemetry/semantic-conventions": "^1.21.0",
|
|
52
60
|
"axios": "^1.6.0",
|
|
53
61
|
"axios-retry": "^4.0.0",
|
|
@@ -56,8 +64,7 @@
|
|
|
56
64
|
"opossum": ">=8.1.0",
|
|
57
65
|
"pino": ">=8.17.0",
|
|
58
66
|
"pino-pretty": ">=10.3.0",
|
|
59
|
-
"
|
|
60
|
-
"@aws-sdk/s3-request-presigner": "^3.0.0"
|
|
67
|
+
"zod": "^3.22.0"
|
|
61
68
|
},
|
|
62
69
|
"peerDependenciesMeta": {
|
|
63
70
|
"@aws-sdk/client-s3": {
|