@logtape/otel 2.0.0-dev.479 → 2.0.1-dev.481
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/deno.cjs +1 -1
- package/dist/deno.js +1 -1
- package/dist/deno.js.map +1 -1
- package/dist/mod.cjs +65 -17
- package/dist/mod.js +65 -17
- package/dist/mod.js.map +1 -1
- package/package.json +2 -2
package/dist/deno.cjs
CHANGED
package/dist/deno.js
CHANGED
package/dist/deno.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deno.js","names":[],"sources":["../deno.json"],"sourcesContent":["{\n \"name\": \"@logtape/otel\",\n \"version\": \"2.0.
|
|
1
|
+
{"version":3,"file":"deno.js","names":[],"sources":["../deno.json"],"sourcesContent":["{\n \"name\": \"@logtape/otel\",\n \"version\": \"2.0.1-dev.481+5155a5ef\",\n \"license\": \"MIT\",\n \"exports\": {\n \".\": \"./src/mod.ts\"\n },\n \"tasks\": {\n \"build\": \"pnpm build\",\n \"test\": \"deno test --allow-net --allow-env\"\n }\n}\n"],"mappings":";WACU;cACG;cACA;cACA,EACT,KAAK,eACN;YACQ;CACP,SAAS;CACT,QAAQ;AACT;mBAVH;;;;;;AAWC"}
|
package/dist/mod.cjs
CHANGED
|
@@ -203,6 +203,69 @@ function mapLevelToSeverityNumber(level) {
|
|
|
203
203
|
default: return __opentelemetry_api_logs.SeverityNumber.UNSPECIFIED;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Converts a JavaScript value to an OpenTelemetry AnyValue.
|
|
208
|
+
* This function recursively handles nested objects and arrays while preserving
|
|
209
|
+
* their structure according to the OpenTelemetry specification.
|
|
210
|
+
*
|
|
211
|
+
* @param value The value to convert
|
|
212
|
+
* @param objectRenderer How to render objects that can't be converted directly
|
|
213
|
+
* @param exceptionMode How to handle Error objects
|
|
214
|
+
* @returns An AnyValue or null if the value should be skipped
|
|
215
|
+
*/
|
|
216
|
+
function convertValueToAnyValue(value, objectRenderer, exceptionMode) {
|
|
217
|
+
if (value == null) return null;
|
|
218
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
219
|
+
if (Array.isArray(value)) {
|
|
220
|
+
let primitiveType = null;
|
|
221
|
+
let isHomogeneous = true;
|
|
222
|
+
for (const item of value) {
|
|
223
|
+
if (item == null) continue;
|
|
224
|
+
const itemType = typeof item;
|
|
225
|
+
if (itemType !== "string" && itemType !== "number" && itemType !== "boolean") {
|
|
226
|
+
isHomogeneous = false;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (primitiveType === null) primitiveType = itemType;
|
|
230
|
+
else if (primitiveType !== itemType) {
|
|
231
|
+
isHomogeneous = false;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (isHomogeneous && primitiveType !== null) return value;
|
|
236
|
+
const converted = [];
|
|
237
|
+
for (const item of value) {
|
|
238
|
+
const convertedItem = convertValueToAnyValue(item, objectRenderer, exceptionMode);
|
|
239
|
+
if (convertedItem !== null) converted.push(convertedItem);
|
|
240
|
+
}
|
|
241
|
+
return converted;
|
|
242
|
+
}
|
|
243
|
+
if (value instanceof Date) return value.toISOString();
|
|
244
|
+
if (value instanceof Error) {
|
|
245
|
+
const errorObj = serializeValue(value);
|
|
246
|
+
const converted = {};
|
|
247
|
+
for (const [key, val] of Object.entries(errorObj)) {
|
|
248
|
+
const convertedVal = convertValueToAnyValue(val, objectRenderer, exceptionMode);
|
|
249
|
+
if (convertedVal !== null) converted[key] = convertedVal;
|
|
250
|
+
}
|
|
251
|
+
return converted;
|
|
252
|
+
}
|
|
253
|
+
if (typeof value === "object") {
|
|
254
|
+
const proto = Object.getPrototypeOf(value);
|
|
255
|
+
const isPlainObject = proto === Object.prototype || proto === null;
|
|
256
|
+
if (isPlainObject) {
|
|
257
|
+
const converted = {};
|
|
258
|
+
for (const [key, val] of Object.entries(value)) {
|
|
259
|
+
const convertedVal = convertValueToAnyValue(val, objectRenderer, exceptionMode);
|
|
260
|
+
if (convertedVal !== null) converted[key] = convertedVal;
|
|
261
|
+
}
|
|
262
|
+
return converted;
|
|
263
|
+
}
|
|
264
|
+
if (objectRenderer === "inspect") return inspect(value);
|
|
265
|
+
return JSON.stringify(value);
|
|
266
|
+
}
|
|
267
|
+
return String(value);
|
|
268
|
+
}
|
|
206
269
|
function convertToAttributes(properties, objectRenderer, exceptionMode) {
|
|
207
270
|
const attributes = {};
|
|
208
271
|
for (const [name, value] of Object.entries(properties)) {
|
|
@@ -213,23 +276,8 @@ function convertToAttributes(properties, objectRenderer, exceptionMode) {
|
|
|
213
276
|
if (typeof value.stack === "string") attributes["exception.stacktrace"] = value.stack;
|
|
214
277
|
continue;
|
|
215
278
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
for (const v of value) {
|
|
219
|
-
if (v == null) continue;
|
|
220
|
-
if (t != null && typeof v !== t) {
|
|
221
|
-
attributes[name] = value.map((v$1) => convertToString(v$1, objectRenderer, exceptionMode));
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
t = typeof v;
|
|
225
|
-
}
|
|
226
|
-
attributes[name] = value;
|
|
227
|
-
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") attributes[name] = value;
|
|
228
|
-
else {
|
|
229
|
-
const encoded = convertToString(value, objectRenderer, exceptionMode);
|
|
230
|
-
if (encoded == null) continue;
|
|
231
|
-
attributes[name] = encoded;
|
|
232
|
-
}
|
|
279
|
+
const convertedValue = convertValueToAnyValue(value, objectRenderer, exceptionMode);
|
|
280
|
+
if (convertedValue !== null) attributes[name] = convertedValue;
|
|
233
281
|
}
|
|
234
282
|
return attributes;
|
|
235
283
|
}
|
package/dist/mod.js
CHANGED
|
@@ -202,6 +202,69 @@ function mapLevelToSeverityNumber(level) {
|
|
|
202
202
|
default: return SeverityNumber.UNSPECIFIED;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Converts a JavaScript value to an OpenTelemetry AnyValue.
|
|
207
|
+
* This function recursively handles nested objects and arrays while preserving
|
|
208
|
+
* their structure according to the OpenTelemetry specification.
|
|
209
|
+
*
|
|
210
|
+
* @param value The value to convert
|
|
211
|
+
* @param objectRenderer How to render objects that can't be converted directly
|
|
212
|
+
* @param exceptionMode How to handle Error objects
|
|
213
|
+
* @returns An AnyValue or null if the value should be skipped
|
|
214
|
+
*/
|
|
215
|
+
function convertValueToAnyValue(value, objectRenderer, exceptionMode) {
|
|
216
|
+
if (value == null) return null;
|
|
217
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
218
|
+
if (Array.isArray(value)) {
|
|
219
|
+
let primitiveType = null;
|
|
220
|
+
let isHomogeneous = true;
|
|
221
|
+
for (const item of value) {
|
|
222
|
+
if (item == null) continue;
|
|
223
|
+
const itemType = typeof item;
|
|
224
|
+
if (itemType !== "string" && itemType !== "number" && itemType !== "boolean") {
|
|
225
|
+
isHomogeneous = false;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (primitiveType === null) primitiveType = itemType;
|
|
229
|
+
else if (primitiveType !== itemType) {
|
|
230
|
+
isHomogeneous = false;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (isHomogeneous && primitiveType !== null) return value;
|
|
235
|
+
const converted = [];
|
|
236
|
+
for (const item of value) {
|
|
237
|
+
const convertedItem = convertValueToAnyValue(item, objectRenderer, exceptionMode);
|
|
238
|
+
if (convertedItem !== null) converted.push(convertedItem);
|
|
239
|
+
}
|
|
240
|
+
return converted;
|
|
241
|
+
}
|
|
242
|
+
if (value instanceof Date) return value.toISOString();
|
|
243
|
+
if (value instanceof Error) {
|
|
244
|
+
const errorObj = serializeValue(value);
|
|
245
|
+
const converted = {};
|
|
246
|
+
for (const [key, val] of Object.entries(errorObj)) {
|
|
247
|
+
const convertedVal = convertValueToAnyValue(val, objectRenderer, exceptionMode);
|
|
248
|
+
if (convertedVal !== null) converted[key] = convertedVal;
|
|
249
|
+
}
|
|
250
|
+
return converted;
|
|
251
|
+
}
|
|
252
|
+
if (typeof value === "object") {
|
|
253
|
+
const proto = Object.getPrototypeOf(value);
|
|
254
|
+
const isPlainObject = proto === Object.prototype || proto === null;
|
|
255
|
+
if (isPlainObject) {
|
|
256
|
+
const converted = {};
|
|
257
|
+
for (const [key, val] of Object.entries(value)) {
|
|
258
|
+
const convertedVal = convertValueToAnyValue(val, objectRenderer, exceptionMode);
|
|
259
|
+
if (convertedVal !== null) converted[key] = convertedVal;
|
|
260
|
+
}
|
|
261
|
+
return converted;
|
|
262
|
+
}
|
|
263
|
+
if (objectRenderer === "inspect") return inspect(value);
|
|
264
|
+
return JSON.stringify(value);
|
|
265
|
+
}
|
|
266
|
+
return String(value);
|
|
267
|
+
}
|
|
205
268
|
function convertToAttributes(properties, objectRenderer, exceptionMode) {
|
|
206
269
|
const attributes = {};
|
|
207
270
|
for (const [name, value] of Object.entries(properties)) {
|
|
@@ -212,23 +275,8 @@ function convertToAttributes(properties, objectRenderer, exceptionMode) {
|
|
|
212
275
|
if (typeof value.stack === "string") attributes["exception.stacktrace"] = value.stack;
|
|
213
276
|
continue;
|
|
214
277
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
for (const v of value) {
|
|
218
|
-
if (v == null) continue;
|
|
219
|
-
if (t != null && typeof v !== t) {
|
|
220
|
-
attributes[name] = value.map((v$1) => convertToString(v$1, objectRenderer, exceptionMode));
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
t = typeof v;
|
|
224
|
-
}
|
|
225
|
-
attributes[name] = value;
|
|
226
|
-
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") attributes[name] = value;
|
|
227
|
-
else {
|
|
228
|
-
const encoded = convertToString(value, objectRenderer, exceptionMode);
|
|
229
|
-
if (encoded == null) continue;
|
|
230
|
-
attributes[name] = encoded;
|
|
231
|
-
}
|
|
278
|
+
const convertedValue = convertValueToAnyValue(value, objectRenderer, exceptionMode);
|
|
279
|
+
if (convertedValue !== null) attributes[name] = convertedValue;
|
|
232
280
|
}
|
|
233
281
|
return attributes;
|
|
234
282
|
}
|
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","names":["name: string","config?: OTLPExporterNodeConfigBase","noopLoggerProvider: ILoggerProvider","options: OpenTelemetrySinkExporterOptions","LoggerProvider","logger: OTLogger","record: LogRecord","options: OpenTelemetrySinkOptions","loggerProvider","logger","metadata","sink: OpenTelemetrySink","sink","loggerProvider: ILoggerProvider | null","logger: OTLogger | null","initPromise: Promise<void> | null","initError: Error | null","pendingRecords: LogRecord[]","level: string","properties: Record<string, unknown>","objectRenderer: ObjectRenderer","exceptionMode: ExceptionAttributeMode","attributes: Record<string, AnyValue>","v","value: unknown","serialized: Record<string, unknown>","message: readonly unknown[]","body: (string | null | undefined)[]","bodyFormatter: BodyFormatter","inspect: (value: unknown) => string","msg: string","#escape"],"sources":["../src/mod.ts"],"sourcesContent":["import {\n getLogger,\n type Logger,\n type LogRecord,\n type Sink,\n} from \"@logtape/logtape\";\nimport { diag, type DiagLogger, DiagLogLevel } from \"@opentelemetry/api\";\nimport {\n type AnyValue,\n type Logger as OTLogger,\n type LoggerProvider as LoggerProviderBase,\n type LogRecord as OTLogRecord,\n NOOP_LOGGER,\n SeverityNumber,\n} from \"@opentelemetry/api-logs\";\nimport type { OTLPExporterNodeConfigBase } from \"@opentelemetry/otlp-exporter-base\";\nimport type { Resource } from \"@opentelemetry/resources\";\nimport {\n defaultResource,\n resourceFromAttributes,\n} from \"@opentelemetry/resources\";\nimport {\n LoggerProvider,\n SimpleLogRecordProcessor,\n} from \"@opentelemetry/sdk-logs\";\nimport { ATTR_SERVICE_NAME } from \"@opentelemetry/semantic-conventions\";\nimport metadata from \"../deno.json\" with { type: \"json\" };\n\n/**\n * Gets an environment variable value across different JavaScript runtimes.\n * @param name The environment variable name.\n * @returns The environment variable value, or undefined if not found.\n */\nfunction getEnvironmentVariable(name: string): string | undefined {\n // Deno runtime\n if (typeof Deno !== \"undefined\" && Deno.env) {\n try {\n return Deno.env.get(name);\n } catch {\n // Deno.env.get() can throw if permissions are not granted\n return undefined;\n }\n }\n\n // Node.js/Bun runtime\n if (\n typeof globalThis !== \"undefined\" && \"process\" in globalThis &&\n // @ts-ignore: process exists in Node.js/Bun\n typeof globalThis.process !== \"undefined\" &&\n // @ts-ignore: process.env exists in Node.js/Bun\n typeof globalThis.process.env === \"object\" &&\n // @ts-ignore: process.env exists in Node.js/Bun\n globalThis.process.env !== null\n ) {\n // @ts-ignore: process.env exists in Node.js/Bun\n return globalThis.process.env[name];\n }\n\n // Browser/other environments - no environment variables available\n return undefined;\n}\n\n/**\n * Checks if an OTLP endpoint is configured via environment variables or options.\n * Checks the following environment variables:\n * - `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` (logs-specific endpoint)\n * - `OTEL_EXPORTER_OTLP_ENDPOINT` (general OTLP endpoint)\n *\n * @param config Optional exporter configuration that may contain a URL.\n * @returns `true` if an endpoint is configured, `false` otherwise.\n */\nfunction hasOtlpEndpoint(config?: OTLPExporterNodeConfigBase): boolean {\n // Check if URL is provided in config\n if (config?.url) {\n return true;\n }\n\n // Check environment variables\n const logsEndpoint = getEnvironmentVariable(\n \"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT\",\n );\n if (logsEndpoint) {\n return true;\n }\n\n const endpoint = getEnvironmentVariable(\"OTEL_EXPORTER_OTLP_ENDPOINT\");\n if (endpoint) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Detects the OTLP protocol from environment variables.\n * Priority:\n * 1. `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL`\n * 2. `OTEL_EXPORTER_OTLP_PROTOCOL`\n * 3. Default: `\"http/json\"` (for backward compatibility)\n *\n * @returns The detected OTLP protocol.\n */\nfunction detectOtlpProtocol(): OtlpProtocol {\n const logsProtocol = getEnvironmentVariable(\n \"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL\",\n );\n if (\n logsProtocol === \"grpc\" ||\n logsProtocol === \"http/protobuf\" ||\n logsProtocol === \"http/json\"\n ) {\n return logsProtocol;\n }\n\n const protocol = getEnvironmentVariable(\"OTEL_EXPORTER_OTLP_PROTOCOL\");\n if (\n protocol === \"grpc\" ||\n protocol === \"http/protobuf\" ||\n protocol === \"http/json\"\n ) {\n return protocol;\n }\n\n return \"http/json\";\n}\n\n/**\n * Creates an OTLP log exporter based on the detected protocol.\n * Uses dynamic imports to maintain browser compatibility when gRPC is not used.\n * @param config Optional exporter configuration.\n * @returns A promise that resolves to the appropriate OTLP log exporter.\n */\nasync function createOtlpExporter(\n config?: OTLPExporterNodeConfigBase,\n // deno-lint-ignore no-explicit-any\n): Promise<any> {\n const protocol = detectOtlpProtocol();\n\n switch (protocol) {\n case \"grpc\": {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-grpc\"\n );\n return new OTLPLogExporter(config);\n }\n case \"http/protobuf\": {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-proto\"\n );\n return new OTLPLogExporter(config);\n }\n case \"http/json\":\n default: {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-http\"\n );\n return new OTLPLogExporter(config);\n }\n }\n}\n\n/**\n * The OpenTelemetry logger provider.\n */\ntype ILoggerProvider = LoggerProviderBase & {\n /**\n * Flush all buffered data and shut down the LoggerProvider and all registered\n * LogRecordProcessor.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n shutdown?: () => Promise<void>;\n};\n\n/**\n * The way to render the object in the log record. If `\"json\"`,\n * the object is rendered as a JSON string. If `\"inspect\"`,\n * the object is rendered using `util.inspect` in Node.js/Bun, or\n * `Deno.inspect` in Deno.\n */\nexport type ObjectRenderer = \"json\" | \"inspect\";\n\ntype Message = (string | null | undefined)[];\n\n/**\n * Custom `body` attribute formatter.\n * @since 0.3.0\n */\nexport type BodyFormatter = (message: Message) => AnyValue;\n\n/**\n * The OTLP protocol to use for exporting logs.\n * @since 0.9.0\n */\nexport type OtlpProtocol = \"grpc\" | \"http/protobuf\" | \"http/json\";\n\n/**\n * How to serialize `Error` objects in log attributes.\n * @since 2.0.0\n */\nexport type ExceptionAttributeMode = \"semconv\" | \"raw\" | false;\n\n/**\n * Base options shared by all OpenTelemetry sink configurations.\n */\ninterface OpenTelemetrySinkOptionsBase {\n /**\n * The way to render the message in the log record. If `\"string\"`,\n * the message is rendered as a single string with the values are\n * interpolated into the message. If `\"array\"`, the message is\n * rendered as an array of strings. `\"string\"` by default.\n *\n * Or even fully customizable with a {@link BodyFormatter} function.\n * @since 0.2.0\n */\n messageType?: \"string\" | \"array\" | BodyFormatter;\n\n /**\n * The way to render the object in the log record. If `\"json\"`,\n * the object is rendered as a JSON string. If `\"inspect\"`,\n * the object is rendered using `util.inspect` in Node.js/Bun, or\n * `Deno.inspect` in Deno. `\"inspect\"` by default.\n */\n objectRenderer?: ObjectRenderer;\n\n /**\n * How to serialize `Error` objects in log attributes.\n *\n * - `\"semconv\"` (default): Follow OpenTelemetry semantic conventions,\n * converting `Error` objects to `exception.type`, `exception.message`,\n * and `exception.stacktrace` attributes.\n * - `\"raw\"`: Serialize `Error` objects as JSON strings with fields like\n * `name`, `message`, `stack`, etc.\n * - `false`: Treat `Error` objects like regular objects without special\n * handling.\n *\n * @since 2.0.0\n */\n exceptionAttributes?: ExceptionAttributeMode;\n\n /**\n * Whether to log diagnostics. Diagnostic logs are logged to\n * the `[\"logtape\", \"meta\", \"otel\"]` category.\n * Turned off by default.\n */\n diagnostics?: boolean;\n}\n\n/**\n * Options for creating an OpenTelemetry sink with a custom logger provider.\n * When using this configuration, you are responsible for setting up the\n * logger provider with appropriate exporters and processors.\n *\n * This is the recommended approach for production use as it gives you\n * full control over the OpenTelemetry configuration.\n * @since 0.9.0\n */\nexport interface OpenTelemetrySinkProviderOptions\n extends OpenTelemetrySinkOptionsBase {\n /**\n * The OpenTelemetry logger provider to use.\n */\n loggerProvider: ILoggerProvider;\n}\n\n/**\n * Options for creating an OpenTelemetry sink with automatic exporter creation.\n * The protocol is determined by environment variables:\n * - `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` (highest priority)\n * - `OTEL_EXPORTER_OTLP_PROTOCOL` (fallback)\n * - Default: `\"http/json\"`\n *\n * For production use, consider providing your own {@link ILoggerProvider}\n * via {@link OpenTelemetrySinkProviderOptions} for more control.\n * @since 0.9.0\n */\nexport interface OpenTelemetrySinkExporterOptions\n extends OpenTelemetrySinkOptionsBase {\n /**\n * The OpenTelemetry logger provider to use.\n * Must be undefined or omitted when using exporter options.\n */\n loggerProvider?: undefined;\n\n /**\n * The OpenTelemetry OTLP exporter configuration to use.\n */\n otlpExporterConfig?: OTLPExporterNodeConfigBase;\n\n /**\n * The service name to use. If not provided, the service name is\n * taken from the `OTEL_SERVICE_NAME` environment variable.\n */\n serviceName?: string;\n\n /**\n * An additional resource to merge with the default resource.\n * @since 1.3.0\n */\n additionalResource?: Resource;\n}\n\n/**\n * Options for creating an OpenTelemetry sink.\n *\n * This is a union type that accepts either:\n * - {@link OpenTelemetrySinkProviderOptions}: Provide your own `loggerProvider`\n * (recommended for production)\n * - {@link OpenTelemetrySinkExporterOptions}: Let the sink create an exporter\n * automatically based on environment variables\n *\n * When no `loggerProvider` is provided, the protocol is determined by:\n * 1. `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` environment variable\n * 2. `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable\n * 3. Default: `\"http/json\"`\n *\n * @example Using a custom logger provider (recommended)\n * ```typescript\n * import { LoggerProvider, SimpleLogRecordProcessor } from \"@opentelemetry/sdk-logs\";\n * import { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-grpc\";\n *\n * const provider = new LoggerProvider();\n * provider.addLogRecordProcessor(new SimpleLogRecordProcessor(new OTLPLogExporter()));\n *\n * const sink = getOpenTelemetrySink({ loggerProvider: provider });\n * ```\n *\n * @example Using automatic exporter creation\n * ```typescript\n * // Protocol determined by OTEL_EXPORTER_OTLP_PROTOCOL env var\n * const sink = getOpenTelemetrySink({\n * serviceName: \"my-service\",\n * });\n * ```\n */\nexport type OpenTelemetrySinkOptions =\n | OpenTelemetrySinkProviderOptions\n | OpenTelemetrySinkExporterOptions;\n\n/**\n * A no-op logger provider that returns NOOP_LOGGER for all requests.\n * Used when no OTLP endpoint is configured to avoid repeated connection errors.\n */\nconst noopLoggerProvider: ILoggerProvider = {\n getLogger: () => NOOP_LOGGER,\n};\n\n/**\n * Initializes the logger provider asynchronously.\n * This is used when the user doesn't provide a custom logger provider.\n *\n * If no OTLP endpoint is configured (via options or environment variables),\n * returns a noop logger provider to avoid repeated connection errors.\n *\n * @param options The exporter options.\n * @returns A promise that resolves to the initialized logger provider.\n */\nasync function initializeLoggerProvider(\n options: OpenTelemetrySinkExporterOptions,\n): Promise<ILoggerProvider> {\n // If no endpoint is configured, use noop logger provider to avoid\n // repeated transport errors\n if (!hasOtlpEndpoint(options.otlpExporterConfig)) {\n return noopLoggerProvider;\n }\n\n const resource = defaultResource().merge(\n resourceFromAttributes({\n [ATTR_SERVICE_NAME]: options.serviceName ??\n getEnvironmentVariable(\"OTEL_SERVICE_NAME\"),\n })\n .merge(options.additionalResource ?? null),\n );\n const otlpExporter = await createOtlpExporter(options.otlpExporterConfig);\n const loggerProvider = new LoggerProvider({\n resource,\n processors: [\n // @ts-ignore: it works anyway...\n new SimpleLogRecordProcessor(otlpExporter),\n ],\n });\n return loggerProvider;\n}\n\n/**\n * Emits a log record to the OpenTelemetry logger.\n * @param logger The OpenTelemetry logger.\n * @param record The LogTape log record.\n * @param options The sink options.\n */\nfunction emitLogRecord(\n logger: OTLogger,\n record: LogRecord,\n options: OpenTelemetrySinkOptions,\n): void {\n const objectRenderer = options.objectRenderer ?? \"inspect\";\n const exceptionMode = options.exceptionAttributes ?? \"semconv\";\n const { category, level, message, timestamp, properties } = record;\n const severityNumber = mapLevelToSeverityNumber(level);\n const attributes = convertToAttributes(\n properties,\n objectRenderer,\n exceptionMode,\n );\n attributes[\"category\"] = [...category];\n logger.emit(\n {\n severityNumber,\n severityText: level,\n body: typeof options.messageType === \"function\"\n ? convertMessageToCustomBodyFormat(\n message,\n objectRenderer,\n exceptionMode,\n options.messageType,\n )\n : options.messageType === \"array\"\n ? convertMessageToArray(message, objectRenderer, exceptionMode)\n : convertMessageToString(message, objectRenderer, exceptionMode),\n attributes,\n timestamp: new Date(timestamp),\n } satisfies OTLogRecord,\n );\n}\n\n/**\n * An OpenTelemetry sink with async disposal and initialization tracking.\n * @since 1.3.1\n */\nexport interface OpenTelemetrySink extends Sink, AsyncDisposable {\n /**\n * A promise that resolves when the sink's lazy initialization completes.\n * For sinks created with an explicit `loggerProvider`, this resolves\n * immediately. For sinks using automatic exporter creation, this resolves\n * once the OpenTelemetry logger provider is fully initialized.\n *\n * This is useful for:\n * - Ensuring all buffered log records have been sent before shutdown\n * - Testing scenarios where you need to verify emitted records\n * - Waiting for initialization before proceeding with critical operations\n *\n * @since 1.3.1\n */\n readonly ready: Promise<void>;\n}\n\n/**\n * Creates a sink that forwards log records to OpenTelemetry.\n *\n * When a custom `loggerProvider` is provided, it is used directly.\n * Otherwise, the sink will lazily initialize a logger provider on the first\n * log record, using the protocol determined by environment variables.\n *\n * @param options Options for creating the sink.\n * @returns The sink.\n */\nexport function getOpenTelemetrySink(\n options: OpenTelemetrySinkOptions = {},\n): OpenTelemetrySink {\n if (options.diagnostics) {\n diag.setLogger(new DiagLoggerAdaptor(), DiagLogLevel.DEBUG);\n }\n\n // If loggerProvider is provided, use the synchronous path\n if (options.loggerProvider != null) {\n const loggerProvider = options.loggerProvider;\n const logger = loggerProvider.getLogger(metadata.name, metadata.version);\n const shutdown = loggerProvider.shutdown?.bind(loggerProvider);\n const sink: OpenTelemetrySink = Object.assign(\n (record: LogRecord) => {\n const { category } = record;\n if (\n category[0] === \"logtape\" && category[1] === \"meta\" &&\n category[2] === \"otel\"\n ) {\n return;\n }\n emitLogRecord(logger, record, options);\n },\n {\n ready: Promise.resolve(),\n async [Symbol.asyncDispose](): Promise<void> {\n if (shutdown != null) await shutdown();\n },\n },\n );\n return sink;\n }\n\n // Lazy initialization for automatic exporter creation\n let loggerProvider: ILoggerProvider | null = null;\n let logger: OTLogger | null = null;\n let initPromise: Promise<void> | null = null;\n let initError: Error | null = null;\n // Buffer for log records that arrive during initialization\n let pendingRecords: LogRecord[] = [];\n\n const sink: OpenTelemetrySink = Object.assign(\n (record: LogRecord) => {\n const { category } = record;\n if (\n category[0] === \"logtape\" && category[1] === \"meta\" &&\n category[2] === \"otel\"\n ) {\n return;\n }\n\n // If already initialized, emit the log\n if (logger != null) {\n emitLogRecord(logger, record, options);\n return;\n }\n\n // If initialization failed, skip silently\n if (initError != null) {\n return;\n }\n\n // Buffer the record for later emission\n pendingRecords.push(record);\n\n // Start initialization if not already started\n if (initPromise == null) {\n initPromise = initializeLoggerProvider(options)\n .then((provider) => {\n loggerProvider = provider;\n logger = provider.getLogger(metadata.name, metadata.version);\n // Emit all buffered records\n for (const pendingRecord of pendingRecords) {\n emitLogRecord(logger, pendingRecord, options);\n }\n pendingRecords = [];\n })\n .catch((error) => {\n initError = error;\n pendingRecords = [];\n // Log initialization error to console as a fallback\n // deno-lint-ignore no-console\n console.error(\"Failed to initialize OpenTelemetry logger:\", error);\n });\n }\n },\n {\n get ready(): Promise<void> {\n return initPromise ?? Promise.resolve();\n },\n async [Symbol.asyncDispose](): Promise<void> {\n // Wait for initialization to complete if in progress\n if (initPromise != null) {\n try {\n await initPromise;\n } catch {\n // Initialization failed, nothing to shut down\n return;\n }\n }\n if (loggerProvider?.shutdown != null) {\n await loggerProvider.shutdown();\n }\n },\n },\n );\n\n return sink;\n}\n\nfunction mapLevelToSeverityNumber(level: string): number {\n switch (level) {\n case \"trace\":\n return SeverityNumber.TRACE;\n case \"debug\":\n return SeverityNumber.DEBUG;\n case \"info\":\n return SeverityNumber.INFO;\n case \"warning\":\n return SeverityNumber.WARN;\n case \"error\":\n return SeverityNumber.ERROR;\n case \"fatal\":\n return SeverityNumber.FATAL;\n default:\n return SeverityNumber.UNSPECIFIED;\n }\n}\n\nfunction convertToAttributes(\n properties: Record<string, unknown>,\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): Record<string, AnyValue> {\n const attributes: Record<string, AnyValue> = {};\n for (const [name, value] of Object.entries(properties)) {\n if (value == null) continue;\n\n // Special handling for Error objects based on exceptionAttributes option\n if (value instanceof Error && exceptionMode === \"semconv\") {\n // Follow OpenTelemetry semantic conventions for exceptions\n attributes[\"exception.type\"] = value.name;\n attributes[\"exception.message\"] = value.message;\n if (typeof value.stack === \"string\") {\n attributes[\"exception.stacktrace\"] = value.stack;\n }\n continue;\n }\n\n if (Array.isArray(value)) {\n let t = null;\n for (const v of value) {\n if (v == null) continue;\n if (t != null && typeof v !== t) {\n attributes[name] = value.map((v) =>\n convertToString(v, objectRenderer, exceptionMode)\n );\n break;\n }\n t = typeof v;\n }\n attributes[name] = value;\n } else if (\n typeof value === \"string\" || typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n // Preserve primitive types as-is\n attributes[name] = value;\n } else {\n const encoded = convertToString(value, objectRenderer, exceptionMode);\n if (encoded == null) continue;\n attributes[name] = encoded;\n }\n }\n return attributes;\n}\n\nfunction serializeValue(value: unknown): unknown {\n if (value instanceof Error) {\n const serialized: Record<string, unknown> = {\n name: value.name,\n message: value.message,\n };\n\n if (typeof value.stack === \"string\") {\n serialized.stack = value.stack;\n }\n\n const cause = (value as { cause?: unknown }).cause;\n if (cause !== undefined) {\n serialized.cause = serializeValue(cause);\n }\n\n if (\n typeof AggregateError !== \"undefined\" &&\n value instanceof AggregateError\n ) {\n serialized.errors = value.errors.map(serializeValue);\n }\n\n for (const key of Object.keys(value)) {\n if (!(key in serialized)) {\n serialized[key] = serializeValue(\n (value as unknown as Record<string, unknown>)[key],\n );\n }\n }\n\n return serialized;\n }\n\n if (Array.isArray(value)) {\n return value.map(serializeValue);\n }\n\n if (value !== null && typeof value === \"object\") {\n const serialized: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n serialized[key] = serializeValue(val);\n }\n return serialized;\n }\n\n return value;\n}\n\nfunction convertToString(\n value: unknown,\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): string | null | undefined {\n if (value === null || value === undefined || typeof value === \"string\") {\n return value;\n }\n if (objectRenderer === \"inspect\") return inspect(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return value.toString();\n } else if (value instanceof Date) return value.toISOString();\n else if (\n value instanceof Error &&\n (exceptionMode === \"raw\" || exceptionMode === \"semconv\")\n ) {\n // In message bodies, serialize Error objects with serializeValue for \"raw\" and \"semconv\" modes\n // (semantic conventions only apply to Error objects in properties, not message bodies)\n // When exceptionMode is false, treat Error as a regular object (JSON.stringify)\n return JSON.stringify(serializeValue(value));\n } else return JSON.stringify(value);\n}\n\nfunction convertMessageToArray(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): AnyValue {\n const body: (string | null | undefined)[] = [];\n for (let i = 0; i < message.length; i += 2) {\n const msg = message[i] as string;\n body.push(msg);\n if (message.length <= i + 1) break;\n const val = message[i + 1];\n body.push(convertToString(val, objectRenderer, exceptionMode));\n }\n return body;\n}\n\nfunction convertMessageToString(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): AnyValue {\n let body = \"\";\n for (let i = 0; i < message.length; i += 2) {\n const msg = message[i] as string;\n body += msg;\n if (message.length <= i + 1) break;\n const val = message[i + 1];\n const extra = convertToString(val, objectRenderer, exceptionMode);\n body += extra ?? JSON.stringify(extra);\n }\n return body;\n}\n\nfunction convertMessageToCustomBodyFormat(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n bodyFormatter: BodyFormatter,\n): AnyValue {\n const body = message.map((msg) =>\n convertToString(msg, objectRenderer, exceptionMode)\n );\n return bodyFormatter(body);\n}\n\n/**\n * A platform-specific inspect function. In Deno, this is {@link Deno.inspect},\n * and in Node.js/Bun it is {@link util.inspect}. If neither is available, it\n * falls back to {@link JSON.stringify}.\n *\n * @param value The value to inspect.\n * @returns The string representation of the value.\n */\nconst inspect: (value: unknown) => string =\n // @ts-ignore: Deno global\n \"Deno\" in globalThis && \"inspect\" in globalThis.Deno &&\n // @ts-ignore: Deno global\n typeof globalThis.Deno.inspect === \"function\"\n // @ts-ignore: Deno global\n ? globalThis.Deno.inspect\n // @ts-ignore: Node.js global\n : \"util\" in globalThis && \"inspect\" in globalThis.util &&\n // @ts-ignore: Node.js global\n globalThis.util.inspect === \"function\"\n // @ts-ignore: Node.js global\n ? globalThis.util.inspect\n : JSON.stringify;\n\nclass DiagLoggerAdaptor implements DiagLogger {\n logger: Logger;\n\n constructor() {\n this.logger = getLogger([\"logtape\", \"meta\", \"otel\"]);\n }\n\n #escape(msg: string): string {\n return msg.replaceAll(\"{\", \"{{\").replaceAll(\"}\", \"}}\");\n }\n\n error(msg: string, ...values: unknown[]): void {\n this.logger.error(`${this.#escape(msg)}: {values}`, { values });\n }\n\n warn(msg: string, ...values: unknown[]): void {\n this.logger.warn(`${this.#escape(msg)}: {values}`, { values });\n }\n\n info(msg: string, ...values: unknown[]): void {\n this.logger.info(`${this.#escape(msg)}: {values}`, { values });\n }\n\n debug(msg: string, ...values: unknown[]): void {\n this.logger.debug(`${this.#escape(msg)}: {values}`, { values });\n }\n\n verbose(msg: string, ...values: unknown[]): void {\n this.logger.debug(`${this.#escape(msg)}: {values}`, { values });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,SAAS,uBAAuBA,MAAkC;AAEhE,YAAW,SAAS,eAAe,KAAK,IACtC,KAAI;AACF,SAAO,KAAK,IAAI,IAAI,KAAK;CAC1B,QAAO;AAEN;CACD;AAIH,YACS,eAAe,eAA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ptions","LoggerProvider","logger: OTLogger","record: LogRecord","options: OpenTelemetrySinkOptions","loggerProvider","logger","metadata","sink: OpenTelemetrySink","sink","loggerProvider: ILoggerProvider | null","logger: OTLogger | null","initPromise: Promise<void> | null","initError: Error | null","pendingRecords: LogRecord[]","level: string","value: unknown","objectRenderer: ObjectRenderer","exceptionMode: ExceptionAttributeMode","primitiveType: string | null","converted: AnyValue[]","converted: Record<string, AnyValue>","properties: Record<string, unknown>","attributes: Record<string, AnyValue>","serialized: Record<string, unknown>","message: readonly unknown[]","body: (string | null | undefined)[]","bodyFormatter: BodyFormatter","inspect: (value: unknown) => string","msg: string","#escape"],"sources":["../src/mod.ts"],"sourcesContent":["import {\n getLogger,\n type Logger,\n type LogRecord,\n type Sink,\n} from \"@logtape/logtape\";\nimport { diag, type DiagLogger, DiagLogLevel } from \"@opentelemetry/api\";\nimport {\n type AnyValue,\n type Logger as OTLogger,\n type LoggerProvider as LoggerProviderBase,\n type LogRecord as OTLogRecord,\n NOOP_LOGGER,\n SeverityNumber,\n} from \"@opentelemetry/api-logs\";\nimport type { OTLPExporterNodeConfigBase } from \"@opentelemetry/otlp-exporter-base\";\nimport type { Resource } from \"@opentelemetry/resources\";\nimport {\n defaultResource,\n resourceFromAttributes,\n} from \"@opentelemetry/resources\";\nimport {\n LoggerProvider,\n SimpleLogRecordProcessor,\n} from \"@opentelemetry/sdk-logs\";\nimport { ATTR_SERVICE_NAME } from \"@opentelemetry/semantic-conventions\";\nimport metadata from \"../deno.json\" with { type: \"json\" };\n\n/**\n * Gets an environment variable value across different JavaScript runtimes.\n * @param name The environment variable name.\n * @returns The environment variable value, or undefined if not found.\n */\nfunction getEnvironmentVariable(name: string): string | undefined {\n // Deno runtime\n if (typeof Deno !== \"undefined\" && Deno.env) {\n try {\n return Deno.env.get(name);\n } catch {\n // Deno.env.get() can throw if permissions are not granted\n return undefined;\n }\n }\n\n // Node.js/Bun runtime\n if (\n typeof globalThis !== \"undefined\" && \"process\" in globalThis &&\n // @ts-ignore: process exists in Node.js/Bun\n typeof globalThis.process !== \"undefined\" &&\n // @ts-ignore: process.env exists in Node.js/Bun\n typeof globalThis.process.env === \"object\" &&\n // @ts-ignore: process.env exists in Node.js/Bun\n globalThis.process.env !== null\n ) {\n // @ts-ignore: process.env exists in Node.js/Bun\n return globalThis.process.env[name];\n }\n\n // Browser/other environments - no environment variables available\n return undefined;\n}\n\n/**\n * Checks if an OTLP endpoint is configured via environment variables or options.\n * Checks the following environment variables:\n * - `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` (logs-specific endpoint)\n * - `OTEL_EXPORTER_OTLP_ENDPOINT` (general OTLP endpoint)\n *\n * @param config Optional exporter configuration that may contain a URL.\n * @returns `true` if an endpoint is configured, `false` otherwise.\n */\nfunction hasOtlpEndpoint(config?: OTLPExporterNodeConfigBase): boolean {\n // Check if URL is provided in config\n if (config?.url) {\n return true;\n }\n\n // Check environment variables\n const logsEndpoint = getEnvironmentVariable(\n \"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT\",\n );\n if (logsEndpoint) {\n return true;\n }\n\n const endpoint = getEnvironmentVariable(\"OTEL_EXPORTER_OTLP_ENDPOINT\");\n if (endpoint) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Detects the OTLP protocol from environment variables.\n * Priority:\n * 1. `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL`\n * 2. `OTEL_EXPORTER_OTLP_PROTOCOL`\n * 3. Default: `\"http/json\"` (for backward compatibility)\n *\n * @returns The detected OTLP protocol.\n */\nfunction detectOtlpProtocol(): OtlpProtocol {\n const logsProtocol = getEnvironmentVariable(\n \"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL\",\n );\n if (\n logsProtocol === \"grpc\" ||\n logsProtocol === \"http/protobuf\" ||\n logsProtocol === \"http/json\"\n ) {\n return logsProtocol;\n }\n\n const protocol = getEnvironmentVariable(\"OTEL_EXPORTER_OTLP_PROTOCOL\");\n if (\n protocol === \"grpc\" ||\n protocol === \"http/protobuf\" ||\n protocol === \"http/json\"\n ) {\n return protocol;\n }\n\n return \"http/json\";\n}\n\n/**\n * Creates an OTLP log exporter based on the detected protocol.\n * Uses dynamic imports to maintain browser compatibility when gRPC is not used.\n * @param config Optional exporter configuration.\n * @returns A promise that resolves to the appropriate OTLP log exporter.\n */\nasync function createOtlpExporter(\n config?: OTLPExporterNodeConfigBase,\n // deno-lint-ignore no-explicit-any\n): Promise<any> {\n const protocol = detectOtlpProtocol();\n\n switch (protocol) {\n case \"grpc\": {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-grpc\"\n );\n return new OTLPLogExporter(config);\n }\n case \"http/protobuf\": {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-proto\"\n );\n return new OTLPLogExporter(config);\n }\n case \"http/json\":\n default: {\n const { OTLPLogExporter } = await import(\n \"@opentelemetry/exporter-logs-otlp-http\"\n );\n return new OTLPLogExporter(config);\n }\n }\n}\n\n/**\n * The OpenTelemetry logger provider.\n */\ntype ILoggerProvider = LoggerProviderBase & {\n /**\n * Flush all buffered data and shut down the LoggerProvider and all registered\n * LogRecordProcessor.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n shutdown?: () => Promise<void>;\n};\n\n/**\n * The way to render the object in the log record. If `\"json\"`,\n * the object is rendered as a JSON string. If `\"inspect\"`,\n * the object is rendered using `util.inspect` in Node.js/Bun, or\n * `Deno.inspect` in Deno.\n */\nexport type ObjectRenderer = \"json\" | \"inspect\";\n\ntype Message = (string | null | undefined)[];\n\n/**\n * Custom `body` attribute formatter.\n * @since 0.3.0\n */\nexport type BodyFormatter = (message: Message) => AnyValue;\n\n/**\n * The OTLP protocol to use for exporting logs.\n * @since 0.9.0\n */\nexport type OtlpProtocol = \"grpc\" | \"http/protobuf\" | \"http/json\";\n\n/**\n * How to serialize `Error` objects in log attributes.\n * @since 2.0.0\n */\nexport type ExceptionAttributeMode = \"semconv\" | \"raw\" | false;\n\n/**\n * Base options shared by all OpenTelemetry sink configurations.\n */\ninterface OpenTelemetrySinkOptionsBase {\n /**\n * The way to render the message in the log record. If `\"string\"`,\n * the message is rendered as a single string with the values are\n * interpolated into the message. If `\"array\"`, the message is\n * rendered as an array of strings. `\"string\"` by default.\n *\n * Or even fully customizable with a {@link BodyFormatter} function.\n * @since 0.2.0\n */\n messageType?: \"string\" | \"array\" | BodyFormatter;\n\n /**\n * The way to render the object in the log record. If `\"json\"`,\n * the object is rendered as a JSON string. If `\"inspect\"`,\n * the object is rendered using `util.inspect` in Node.js/Bun, or\n * `Deno.inspect` in Deno. `\"inspect\"` by default.\n */\n objectRenderer?: ObjectRenderer;\n\n /**\n * How to serialize `Error` objects in log attributes.\n *\n * - `\"semconv\"` (default): Follow OpenTelemetry semantic conventions,\n * converting `Error` objects to `exception.type`, `exception.message`,\n * and `exception.stacktrace` attributes.\n * - `\"raw\"`: Serialize `Error` objects as JSON strings with fields like\n * `name`, `message`, `stack`, etc.\n * - `false`: Treat `Error` objects like regular objects without special\n * handling.\n *\n * @since 2.0.0\n */\n exceptionAttributes?: ExceptionAttributeMode;\n\n /**\n * Whether to log diagnostics. Diagnostic logs are logged to\n * the `[\"logtape\", \"meta\", \"otel\"]` category.\n * Turned off by default.\n */\n diagnostics?: boolean;\n}\n\n/**\n * Options for creating an OpenTelemetry sink with a custom logger provider.\n * When using this configuration, you are responsible for setting up the\n * logger provider with appropriate exporters and processors.\n *\n * This is the recommended approach for production use as it gives you\n * full control over the OpenTelemetry configuration.\n * @since 0.9.0\n */\nexport interface OpenTelemetrySinkProviderOptions\n extends OpenTelemetrySinkOptionsBase {\n /**\n * The OpenTelemetry logger provider to use.\n */\n loggerProvider: ILoggerProvider;\n}\n\n/**\n * Options for creating an OpenTelemetry sink with automatic exporter creation.\n * The protocol is determined by environment variables:\n * - `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` (highest priority)\n * - `OTEL_EXPORTER_OTLP_PROTOCOL` (fallback)\n * - Default: `\"http/json\"`\n *\n * For production use, consider providing your own {@link ILoggerProvider}\n * via {@link OpenTelemetrySinkProviderOptions} for more control.\n * @since 0.9.0\n */\nexport interface OpenTelemetrySinkExporterOptions\n extends OpenTelemetrySinkOptionsBase {\n /**\n * The OpenTelemetry logger provider to use.\n * Must be undefined or omitted when using exporter options.\n */\n loggerProvider?: undefined;\n\n /**\n * The OpenTelemetry OTLP exporter configuration to use.\n */\n otlpExporterConfig?: OTLPExporterNodeConfigBase;\n\n /**\n * The service name to use. If not provided, the service name is\n * taken from the `OTEL_SERVICE_NAME` environment variable.\n */\n serviceName?: string;\n\n /**\n * An additional resource to merge with the default resource.\n * @since 1.3.0\n */\n additionalResource?: Resource;\n}\n\n/**\n * Options for creating an OpenTelemetry sink.\n *\n * This is a union type that accepts either:\n * - {@link OpenTelemetrySinkProviderOptions}: Provide your own `loggerProvider`\n * (recommended for production)\n * - {@link OpenTelemetrySinkExporterOptions}: Let the sink create an exporter\n * automatically based on environment variables\n *\n * When no `loggerProvider` is provided, the protocol is determined by:\n * 1. `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` environment variable\n * 2. `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable\n * 3. Default: `\"http/json\"`\n *\n * @example Using a custom logger provider (recommended)\n * ```typescript\n * import { LoggerProvider, SimpleLogRecordProcessor } from \"@opentelemetry/sdk-logs\";\n * import { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-grpc\";\n *\n * const provider = new LoggerProvider();\n * provider.addLogRecordProcessor(new SimpleLogRecordProcessor(new OTLPLogExporter()));\n *\n * const sink = getOpenTelemetrySink({ loggerProvider: provider });\n * ```\n *\n * @example Using automatic exporter creation\n * ```typescript\n * // Protocol determined by OTEL_EXPORTER_OTLP_PROTOCOL env var\n * const sink = getOpenTelemetrySink({\n * serviceName: \"my-service\",\n * });\n * ```\n */\nexport type OpenTelemetrySinkOptions =\n | OpenTelemetrySinkProviderOptions\n | OpenTelemetrySinkExporterOptions;\n\n/**\n * A no-op logger provider that returns NOOP_LOGGER for all requests.\n * Used when no OTLP endpoint is configured to avoid repeated connection errors.\n */\nconst noopLoggerProvider: ILoggerProvider = {\n getLogger: () => NOOP_LOGGER,\n};\n\n/**\n * Initializes the logger provider asynchronously.\n * This is used when the user doesn't provide a custom logger provider.\n *\n * If no OTLP endpoint is configured (via options or environment variables),\n * returns a noop logger provider to avoid repeated connection errors.\n *\n * @param options The exporter options.\n * @returns A promise that resolves to the initialized logger provider.\n */\nasync function initializeLoggerProvider(\n options: OpenTelemetrySinkExporterOptions,\n): Promise<ILoggerProvider> {\n // If no endpoint is configured, use noop logger provider to avoid\n // repeated transport errors\n if (!hasOtlpEndpoint(options.otlpExporterConfig)) {\n return noopLoggerProvider;\n }\n\n const resource = defaultResource().merge(\n resourceFromAttributes({\n [ATTR_SERVICE_NAME]: options.serviceName ??\n getEnvironmentVariable(\"OTEL_SERVICE_NAME\"),\n })\n .merge(options.additionalResource ?? null),\n );\n const otlpExporter = await createOtlpExporter(options.otlpExporterConfig);\n const loggerProvider = new LoggerProvider({\n resource,\n processors: [\n // @ts-ignore: it works anyway...\n new SimpleLogRecordProcessor(otlpExporter),\n ],\n });\n return loggerProvider;\n}\n\n/**\n * Emits a log record to the OpenTelemetry logger.\n * @param logger The OpenTelemetry logger.\n * @param record The LogTape log record.\n * @param options The sink options.\n */\nfunction emitLogRecord(\n logger: OTLogger,\n record: LogRecord,\n options: OpenTelemetrySinkOptions,\n): void {\n const objectRenderer = options.objectRenderer ?? \"inspect\";\n const exceptionMode = options.exceptionAttributes ?? \"semconv\";\n const { category, level, message, timestamp, properties } = record;\n const severityNumber = mapLevelToSeverityNumber(level);\n const attributes = convertToAttributes(\n properties,\n objectRenderer,\n exceptionMode,\n );\n attributes[\"category\"] = [...category];\n logger.emit(\n {\n severityNumber,\n severityText: level,\n body: typeof options.messageType === \"function\"\n ? convertMessageToCustomBodyFormat(\n message,\n objectRenderer,\n exceptionMode,\n options.messageType,\n )\n : options.messageType === \"array\"\n ? convertMessageToArray(message, objectRenderer, exceptionMode)\n : convertMessageToString(message, objectRenderer, exceptionMode),\n attributes,\n timestamp: new Date(timestamp),\n } satisfies OTLogRecord,\n );\n}\n\n/**\n * An OpenTelemetry sink with async disposal and initialization tracking.\n * @since 1.3.1\n */\nexport interface OpenTelemetrySink extends Sink, AsyncDisposable {\n /**\n * A promise that resolves when the sink's lazy initialization completes.\n * For sinks created with an explicit `loggerProvider`, this resolves\n * immediately. For sinks using automatic exporter creation, this resolves\n * once the OpenTelemetry logger provider is fully initialized.\n *\n * This is useful for:\n * - Ensuring all buffered log records have been sent before shutdown\n * - Testing scenarios where you need to verify emitted records\n * - Waiting for initialization before proceeding with critical operations\n *\n * @since 1.3.1\n */\n readonly ready: Promise<void>;\n}\n\n/**\n * Creates a sink that forwards log records to OpenTelemetry.\n *\n * When a custom `loggerProvider` is provided, it is used directly.\n * Otherwise, the sink will lazily initialize a logger provider on the first\n * log record, using the protocol determined by environment variables.\n *\n * @param options Options for creating the sink.\n * @returns The sink.\n */\nexport function getOpenTelemetrySink(\n options: OpenTelemetrySinkOptions = {},\n): OpenTelemetrySink {\n if (options.diagnostics) {\n diag.setLogger(new DiagLoggerAdaptor(), DiagLogLevel.DEBUG);\n }\n\n // If loggerProvider is provided, use the synchronous path\n if (options.loggerProvider != null) {\n const loggerProvider = options.loggerProvider;\n const logger = loggerProvider.getLogger(metadata.name, metadata.version);\n const shutdown = loggerProvider.shutdown?.bind(loggerProvider);\n const sink: OpenTelemetrySink = Object.assign(\n (record: LogRecord) => {\n const { category } = record;\n if (\n category[0] === \"logtape\" && category[1] === \"meta\" &&\n category[2] === \"otel\"\n ) {\n return;\n }\n emitLogRecord(logger, record, options);\n },\n {\n ready: Promise.resolve(),\n async [Symbol.asyncDispose](): Promise<void> {\n if (shutdown != null) await shutdown();\n },\n },\n );\n return sink;\n }\n\n // Lazy initialization for automatic exporter creation\n let loggerProvider: ILoggerProvider | null = null;\n let logger: OTLogger | null = null;\n let initPromise: Promise<void> | null = null;\n let initError: Error | null = null;\n // Buffer for log records that arrive during initialization\n let pendingRecords: LogRecord[] = [];\n\n const sink: OpenTelemetrySink = Object.assign(\n (record: LogRecord) => {\n const { category } = record;\n if (\n category[0] === \"logtape\" && category[1] === \"meta\" &&\n category[2] === \"otel\"\n ) {\n return;\n }\n\n // If already initialized, emit the log\n if (logger != null) {\n emitLogRecord(logger, record, options);\n return;\n }\n\n // If initialization failed, skip silently\n if (initError != null) {\n return;\n }\n\n // Buffer the record for later emission\n pendingRecords.push(record);\n\n // Start initialization if not already started\n if (initPromise == null) {\n initPromise = initializeLoggerProvider(options)\n .then((provider) => {\n loggerProvider = provider;\n logger = provider.getLogger(metadata.name, metadata.version);\n // Emit all buffered records\n for (const pendingRecord of pendingRecords) {\n emitLogRecord(logger, pendingRecord, options);\n }\n pendingRecords = [];\n })\n .catch((error) => {\n initError = error;\n pendingRecords = [];\n // Log initialization error to console as a fallback\n // deno-lint-ignore no-console\n console.error(\"Failed to initialize OpenTelemetry logger:\", error);\n });\n }\n },\n {\n get ready(): Promise<void> {\n return initPromise ?? Promise.resolve();\n },\n async [Symbol.asyncDispose](): Promise<void> {\n // Wait for initialization to complete if in progress\n if (initPromise != null) {\n try {\n await initPromise;\n } catch {\n // Initialization failed, nothing to shut down\n return;\n }\n }\n if (loggerProvider?.shutdown != null) {\n await loggerProvider.shutdown();\n }\n },\n },\n );\n\n return sink;\n}\n\nfunction mapLevelToSeverityNumber(level: string): number {\n switch (level) {\n case \"trace\":\n return SeverityNumber.TRACE;\n case \"debug\":\n return SeverityNumber.DEBUG;\n case \"info\":\n return SeverityNumber.INFO;\n case \"warning\":\n return SeverityNumber.WARN;\n case \"error\":\n return SeverityNumber.ERROR;\n case \"fatal\":\n return SeverityNumber.FATAL;\n default:\n return SeverityNumber.UNSPECIFIED;\n }\n}\n\n/**\n * Converts a JavaScript value to an OpenTelemetry AnyValue.\n * This function recursively handles nested objects and arrays while preserving\n * their structure according to the OpenTelemetry specification.\n *\n * @param value The value to convert\n * @param objectRenderer How to render objects that can't be converted directly\n * @param exceptionMode How to handle Error objects\n * @returns An AnyValue or null if the value should be skipped\n */\nfunction convertValueToAnyValue(\n value: unknown,\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): AnyValue | null {\n // Handle null/undefined\n if (value == null) return null;\n\n // Preserve primitives as-is\n if (\n typeof value === \"string\" || typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n\n // Handle arrays - recursively convert elements\n if (Array.isArray(value)) {\n // Check if it's a homogeneous array of primitives (OTel spec prefers these)\n let primitiveType: string | null = null;\n let isHomogeneous = true;\n\n for (const item of value) {\n if (item == null) continue;\n const itemType = typeof item;\n if (\n itemType !== \"string\" && itemType !== \"number\" &&\n itemType !== \"boolean\"\n ) {\n isHomogeneous = false;\n break;\n }\n if (primitiveType === null) {\n primitiveType = itemType;\n } else if (primitiveType !== itemType) {\n isHomogeneous = false;\n break;\n }\n }\n\n // If homogeneous array of primitives, return as-is\n if (isHomogeneous && primitiveType !== null) {\n return value as AnyValue;\n }\n\n // Otherwise, recursively convert each element to AnyValue\n const converted: AnyValue[] = [];\n for (const item of value) {\n const convertedItem = convertValueToAnyValue(\n item,\n objectRenderer,\n exceptionMode,\n );\n // Skip null items but preserve the structure\n if (convertedItem !== null) {\n converted.push(convertedItem);\n }\n }\n return converted;\n }\n\n // Handle Date objects - convert to ISO string\n if (value instanceof Date) {\n return value.toISOString();\n }\n\n // Handle Error objects - serialize to structured object\n if (value instanceof Error) {\n const errorObj = serializeValue(value) as Record<string, unknown>;\n const converted: Record<string, AnyValue> = {};\n for (const [key, val] of Object.entries(errorObj)) {\n const convertedVal = convertValueToAnyValue(\n val,\n objectRenderer,\n exceptionMode,\n );\n if (convertedVal !== null) {\n converted[key] = convertedVal;\n }\n }\n return converted;\n }\n\n // Handle plain objects - recursively convert to map<string, AnyValue>\n if (typeof value === \"object\") {\n // Check if it's a plain object (not a special class instance)\n const proto = Object.getPrototypeOf(value);\n const isPlainObject = proto === Object.prototype || proto === null;\n\n if (isPlainObject) {\n const converted: Record<string, AnyValue> = {};\n for (\n const [key, val] of Object.entries(value as Record<string, unknown>)\n ) {\n const convertedVal = convertValueToAnyValue(\n val,\n objectRenderer,\n exceptionMode,\n );\n if (convertedVal !== null) {\n converted[key] = convertedVal;\n }\n }\n return converted;\n }\n\n // For non-plain objects (class instances, etc.), fall back to string representation\n if (objectRenderer === \"inspect\") {\n return inspect(value);\n }\n return JSON.stringify(value);\n }\n\n // Fallback for other types\n return String(value);\n}\n\nfunction convertToAttributes(\n properties: Record<string, unknown>,\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): Record<string, AnyValue> {\n const attributes: Record<string, AnyValue> = {};\n for (const [name, value] of Object.entries(properties)) {\n if (value == null) continue;\n\n // Special handling for Error objects based on exceptionAttributes option\n if (value instanceof Error && exceptionMode === \"semconv\") {\n // Follow OpenTelemetry semantic conventions for exceptions\n attributes[\"exception.type\"] = value.name;\n attributes[\"exception.message\"] = value.message;\n if (typeof value.stack === \"string\") {\n attributes[\"exception.stacktrace\"] = value.stack;\n }\n continue;\n }\n\n // Use the new recursive converter\n const convertedValue = convertValueToAnyValue(\n value,\n objectRenderer,\n exceptionMode,\n );\n if (convertedValue !== null) {\n attributes[name] = convertedValue;\n }\n }\n return attributes;\n}\n\nfunction serializeValue(value: unknown): unknown {\n if (value instanceof Error) {\n const serialized: Record<string, unknown> = {\n name: value.name,\n message: value.message,\n };\n\n if (typeof value.stack === \"string\") {\n serialized.stack = value.stack;\n }\n\n const cause = (value as { cause?: unknown }).cause;\n if (cause !== undefined) {\n serialized.cause = serializeValue(cause);\n }\n\n if (\n typeof AggregateError !== \"undefined\" &&\n value instanceof AggregateError\n ) {\n serialized.errors = value.errors.map(serializeValue);\n }\n\n for (const key of Object.keys(value)) {\n if (!(key in serialized)) {\n serialized[key] = serializeValue(\n (value as unknown as Record<string, unknown>)[key],\n );\n }\n }\n\n return serialized;\n }\n\n if (Array.isArray(value)) {\n return value.map(serializeValue);\n }\n\n if (value !== null && typeof value === \"object\") {\n const serialized: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n serialized[key] = serializeValue(val);\n }\n return serialized;\n }\n\n return value;\n}\n\nfunction convertToString(\n value: unknown,\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): string | null | undefined {\n if (value === null || value === undefined || typeof value === \"string\") {\n return value;\n }\n if (objectRenderer === \"inspect\") return inspect(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return value.toString();\n } else if (value instanceof Date) return value.toISOString();\n else if (\n value instanceof Error &&\n (exceptionMode === \"raw\" || exceptionMode === \"semconv\")\n ) {\n // In message bodies, serialize Error objects with serializeValue for \"raw\" and \"semconv\" modes\n // (semantic conventions only apply to Error objects in properties, not message bodies)\n // When exceptionMode is false, treat Error as a regular object (JSON.stringify)\n return JSON.stringify(serializeValue(value));\n } else return JSON.stringify(value);\n}\n\nfunction convertMessageToArray(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): AnyValue {\n const body: (string | null | undefined)[] = [];\n for (let i = 0; i < message.length; i += 2) {\n const msg = message[i] as string;\n body.push(msg);\n if (message.length <= i + 1) break;\n const val = message[i + 1];\n body.push(convertToString(val, objectRenderer, exceptionMode));\n }\n return body;\n}\n\nfunction convertMessageToString(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n): AnyValue {\n let body = \"\";\n for (let i = 0; i < message.length; i += 2) {\n const msg = message[i] as string;\n body += msg;\n if (message.length <= i + 1) break;\n const val = message[i + 1];\n const extra = convertToString(val, objectRenderer, exceptionMode);\n body += extra ?? JSON.stringify(extra);\n }\n return body;\n}\n\nfunction convertMessageToCustomBodyFormat(\n message: readonly unknown[],\n objectRenderer: ObjectRenderer,\n exceptionMode: ExceptionAttributeMode,\n bodyFormatter: BodyFormatter,\n): AnyValue {\n const body = message.map((msg) =>\n convertToString(msg, objectRenderer, exceptionMode)\n );\n return bodyFormatter(body);\n}\n\n/**\n * A platform-specific inspect function. In Deno, this is {@link Deno.inspect},\n * and in Node.js/Bun it is {@link util.inspect}. If neither is available, it\n * falls back to {@link JSON.stringify}.\n *\n * @param value The value to inspect.\n * @returns The string representation of the value.\n */\nconst inspect: (value: unknown) => string =\n // @ts-ignore: Deno global\n \"Deno\" in globalThis && \"inspect\" in globalThis.Deno &&\n // @ts-ignore: Deno global\n typeof globalThis.Deno.inspect === \"function\"\n // @ts-ignore: Deno global\n ? globalThis.Deno.inspect\n // @ts-ignore: Node.js global\n : \"util\" in globalThis && \"inspect\" in globalThis.util &&\n // @ts-ignore: Node.js global\n globalThis.util.inspect === \"function\"\n // @ts-ignore: Node.js global\n ? globalThis.util.inspect\n : JSON.stringify;\n\nclass DiagLoggerAdaptor implements DiagLogger {\n logger: Logger;\n\n constructor() {\n this.logger = getLogger([\"logtape\", \"meta\", \"otel\"]);\n }\n\n #escape(msg: string): string {\n return msg.replaceAll(\"{\", \"{{\").replaceAll(\"}\", \"}}\");\n }\n\n error(msg: string, ...values: unknown[]): void {\n this.logger.error(`${this.#escape(msg)}: {values}`, { values });\n }\n\n warn(msg: string, ...values: unknown[]): void {\n this.logger.warn(`${this.#escape(msg)}: {values}`, { values });\n }\n\n info(msg: string, ...values: unknown[]): void {\n this.logger.info(`${this.#escape(msg)}: {values}`, { values });\n }\n\n debug(msg: string, ...values: unknown[]): void {\n this.logger.debug(`${this.#escape(msg)}: {values}`, { values });\n }\n\n verbose(msg: string, ...values: unknown[]): void {\n this.logger.debug(`${this.#escape(msg)}: {values}`, { values });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,SAAS,uBAAuBA,MAAkC;AAEhE,YAAW,SAAS,eAAe,KAAK,IACtC,KAAI;AACF,SAAO,KAAK,IAAI,IAAI,KAAK;CAC1B,QAAO;AAEN;CACD;AAIH,YACS,eAAe,eAAe,aAAa,qBAE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W,KAAK,YAAY,aAEjC,WAAW,KAAK,UAEhB,UAAU,cAAc,aAAa,WAAW,QAE9C,WAAW,KAAK,YAAY,aAE9B,WAAW,KAAK,UAChB,KAAK;AAEX,IAAM,oBAAN,MAA8C;CAC5C;CAEA,cAAc;AACZ,OAAK,SAAS,UAAU;GAAC;GAAW;GAAQ;EAAO,EAAC;CACrD;CAED,QAAQC,KAAqB;AAC3B,SAAO,IAAI,WAAW,KAAK,KAAK,CAAC,WAAW,KAAK,KAAK;CACvD;CAED,MAAMA,KAAa,GAAG,QAAyB;AAC7C,OAAK,OAAO,OAAO,EAAE,KAAKC,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAQ,EAAC;CAChE;CAED,KAAKD,KAAa,GAAG,QAAyB;AAC5C,OAAK,OAAO,MAAM,EAAE,KAAKC,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAQ,EAAC;CAC/D;CAED,KAAKD,KAAa,GAAG,QAAyB;AAC5C,OAAK,OAAO,MAAM,EAAE,KAAKC,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAQ,EAAC;CAC/D;CAED,MAAMD,KAAa,GAAG,QAAyB;AAC7C,OAAK,OAAO,OAAO,EAAE,KAAKC,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAQ,EAAC;CAChE;CAED,QAAQD,KAAa,GAAG,QAAyB;AAC/C,OAAK,OAAO,OAAO,EAAE,KAAKC,QAAQ,IAAI,CAAC,aAAa,EAAE,OAAQ,EAAC;CAChE;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logtape/otel",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-dev.481+5155a5ef",
|
|
4
4
|
"description": "LogTape OpenTelemetry sink",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"LogTape",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dist/"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@logtape/logtape": "^2.0.
|
|
48
|
+
"@logtape/logtape": "^2.0.1-dev.481+5155a5ef"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@opentelemetry/api": "^1.9.0",
|