Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

DesktopObservability.ts

614 lines22.2 KB

1import { PRIMARY_LOCAL_ENVIRONMENT_ID } from "@t3tools/contracts";
2import { makeLocalFileTracer, makeTraceSink } from "@t3tools/shared/observability";
3import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings";
4import * as Context from "effect/Context";
5import * as DateTime from "effect/DateTime";
6import * as Effect from "effect/Effect";
7import * as FileSystem from "effect/FileSystem";
8import * as Layer from "effect/Layer";
9import * as Logger from "effect/Logger";
10import * as Option from "effect/Option";
11import * as Path from "effect/Path";
12import * as PlatformError from "effect/PlatformError";
13import * as References from "effect/References";
14import * as Ref from "effect/Ref";
15import * as Schema from "effect/Schema";
16import * as Scope from "effect/Scope";
17import * as Semaphore from "effect/Semaphore";
18import * as SynchronizedRef from "effect/SynchronizedRef";
19import * as Tracer from "effect/Tracer";
20import { OtlpExporter, OtlpSerialization, OtlpTracer } from "effect/unstable/observability";
21​
22import * as DesktopEnvironment from "./DesktopEnvironment.ts";
23​
24const DESKTOP_LOG_FILE_MAX_BYTES = 10 * 1024 * 1024;
25const DESKTOP_LOG_FILE_MAX_FILES = 10;
26const DESKTOP_BACKEND_CHILD_LOG_FIBER_ID = "#backend-child";
27const DESKTOP_TRACE_BATCH_WINDOW_MS = 1_000;
28const DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_BYTES = 1024 * 1024;
29const DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_CHUNKS = 256;
30​
31export interface RotatingLogFileWriter {
32 readonly writeBytes: (chunk: Uint8Array) => Effect.Effect<void>;
33 readonly writeText: (chunk: string) => Effect.Effect<void>;
35​
36export interface DesktopBackendOutputLogShape {
37 readonly beginSession: (input: { readonly details: string }) => Effect.Effect<void>;
38 readonly writeOutputChunk: (
39 streamName: "stdout" | "stderr",
40 chunk: Uint8Array,
41 ) => Effect.Effect<void>;
42 readonly persistFailureSnapshot: (input: { readonly details: string }) => Effect.Effect<void>;
43 readonly persistFailure: (input: { readonly details: string }) => Effect.Effect<void>;
44 readonly discardSession: Effect.Effect<void>;
46​
47// Factory for per-instance backend output logs. `forInstance(id)` returns
48// a writer that targets a distinct rotating log file — the primary
49// instance keeps `server-child.log` so the historical path stays stable
50// for ops; other instances get `server-child-<sanitized-id>.log`.
51//
52// Writers are cached per id within a single factory instance so repeated
53// `forInstance` calls (e.g. during a backend restart that re-resolves
54// services) reuse the same rotating writer rather than racing each other
55// on the same file.
56export class DesktopBackendOutputLogFactory extends Context.Service<
57 DesktopBackendOutputLogFactory,
58 {
59 readonly forInstance: (id: string) => Effect.Effect<DesktopBackendOutputLogShape>;
60 }
61>()("@t3tools/desktop/app/DesktopObservability/DesktopBackendOutputLogFactory") {}
62​
63const textEncoder = new TextEncoder();
64const textDecoder = new TextDecoder();
65​
66export type DesktopLogAnnotations = Record<string, unknown>;
67​
68export interface DesktopComponentLogger {
69 readonly annotate: <A, E, R>(
70 effect: Effect.Effect<A, E, R>,
71 annotations?: DesktopLogAnnotations,
72 ) => Effect.Effect<A, E, R>;
73 readonly logDebug: (message: string, annotations?: DesktopLogAnnotations) => Effect.Effect<void>;
74 readonly logInfo: (message: string, annotations?: DesktopLogAnnotations) => Effect.Effect<void>;
75 readonly logWarning: (
76 message: string,
77 annotations?: DesktopLogAnnotations,
78 ) => Effect.Effect<void>;
79 readonly logError: (message: string, annotations?: DesktopLogAnnotations) => Effect.Effect<void>;
81​
82export function makeComponentLogger(component: string): DesktopComponentLogger {
83 const annotate: DesktopComponentLogger["annotate"] = (effect, annotations) =>
84 effect.pipe(
85 Effect.annotateLogs({
86 component,
87 ...annotations,
88 }),
89 );
90​
91 return {
92 annotate,
93 logDebug: (message, annotations) => annotate(Effect.logDebug(message), annotations),
94 logInfo: (message, annotations) => annotate(Effect.logInfo(message), annotations),
95 logWarning: (message, annotations) => annotate(Effect.logWarning(message), annotations),
96 logError: (message, annotations) => annotate(Effect.logError(message), annotations),
97 };
99​
100class DesktopLogFileWriterConfigurationError extends Schema.TaggedErrorClass<DesktopLogFileWriterConfigurationError>()(
101 "DesktopLogFileWriterConfigurationError",
102 {
103 option: Schema.Literals(["maxBytes", "maxFiles"]),
104 value: Schema.Number,
105 },
106) {
107 override get message() {
108 return `${this.option} must be >= 1 (received ${this.value})`;
109 }
111​
112type DesktopLogFileWriterError =
113 | DesktopLogFileWriterConfigurationError
114 | PlatformError.PlatformError;
115​
116const sanitizeLogValue = (value: string): string => value.replace(/\s+/g, " ").trim();
117​
118const DesktopBackendChildLogRecord = Schema.Struct({
119 message: Schema.String,
120 level: Schema.Literals(["INFO", "ERROR"]),
121 timestamp: Schema.String,
122 annotations: Schema.Record(Schema.String, Schema.Unknown),
123 spans: Schema.Record(Schema.String, Schema.Unknown),
124 fiberId: Schema.String,
125});
126​
127const encodeDesktopBackendChildLogRecord = Schema.encodeEffect(
128 Schema.fromJsonString(DesktopBackendChildLogRecord),
129);
130​
131const DesktopBackendOutputLogNoop: DesktopBackendOutputLogShape = {
132 beginSession: () => Effect.void,
133 writeOutputChunk: () => Effect.void,
134 persistFailureSnapshot: () => Effect.void,
135 persistFailure: () => Effect.void,
136 discardSession: Effect.void,
137};
138​
139interface BufferedBackendOutputChunk {
140 readonly streamName: "stdout" | "stderr";
141 readonly chunk: Uint8Array;
142 readonly offset: number;
144​
145interface BackendOutputSession {
146 readonly runId: string;
147 readonly startDetails: string;
148 readonly chunks: ReadonlyArray<BufferedBackendOutputChunk>;
149 readonly byteLength: number;
151​
152export function appendBoundedOutputChunk(
153 session: BackendOutputSession,
154 streamName: "stdout" | "stderr",
155 chunk: Uint8Array,
156): BackendOutputSession {
157 if (chunk.byteLength === 0) {
158 return session;
159 }
160​
161 const retainedChunk =
162 chunk.byteLength > DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_BYTES
163 ? chunk.slice(chunk.byteLength - DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_BYTES)
164 : chunk.slice();
165 const chunks = [...session.chunks, { streamName, chunk: retainedChunk, offset: 0 }];
166 let byteLength = session.byteLength + retainedChunk.byteLength;
167 let overflow = Math.max(0, byteLength - DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_BYTES);
168 let firstRetainedIndex = 0;
169​
170 while (overflow > 0) {
171 const first = chunks[firstRetainedIndex];
172 if (!first) break;
173 const retainedByteLength = first.chunk.byteLength - first.offset;
174 if (retainedByteLength <= overflow) {
175 overflow -= retainedByteLength;
176 byteLength -= retainedByteLength;
177 firstRetainedIndex += 1;
178 continue;
179 }
180​
181 chunks[firstRetainedIndex] = {
182 ...first,
183 offset: first.offset + overflow,
184 };
185 byteLength -= overflow;
186 overflow = 0;
187 }
188​
189 const excessChunks = Math.max(
190 0,
191 chunks.length - firstRetainedIndex - DESKTOP_BACKEND_OUTPUT_BUFFER_MAX_CHUNKS,
192 );
193 for (let index = firstRetainedIndex; index < firstRetainedIndex + excessChunks; index += 1) {
194 const chunk = chunks[index];
195 byteLength -= chunk ? chunk.chunk.byteLength - chunk.offset : 0;
196 }
197 firstRetainedIndex += excessChunks;
198​
199 return {
200 ...session,
201 chunks: chunks.slice(firstRetainedIndex),
202 byteLength,
203 };
205​
206const currentDesktopRunId = Effect.gen(function* () {
207 const annotations = yield* References.CurrentLogAnnotations;
208 const runId = annotations.runId;
209 return typeof runId === "string" && runId.length > 0 ? runId : "unknown";
210});
211​
212const refreshFileSize = (
213 fileSystem: FileSystem.FileSystem,
214 filePath: string,
215): Effect.Effect<number, never> =>
216 fileSystem.stat(filePath).pipe(
217 Effect.map((stat) => Number(stat.size)),
218 Effect.orElseSucceed(() => 0),
219 );
220​
221const makeRotatingLogFileWriter = Effect.fn("makeRotatingLogFileWriter")(function* (input: {
222 readonly filePath: string;
223 readonly maxBytes?: number;
224 readonly maxFiles?: number;
225}): Effect.fn.Return<
226 RotatingLogFileWriter,
227 DesktopLogFileWriterError,
228 FileSystem.FileSystem | Path.Path
229> {
230 const fileSystem = yield* FileSystem.FileSystem;
231 const path = yield* Path.Path;
232 const maxBytes = input.maxBytes ?? DESKTOP_LOG_FILE_MAX_BYTES;
233 const maxFiles = input.maxFiles ?? DESKTOP_LOG_FILE_MAX_FILES;
234 const directory = path.dirname(input.filePath);
235 const baseName = path.basename(input.filePath);
236​
237 if (maxBytes < 1) {
238 return yield* new DesktopLogFileWriterConfigurationError({
239 option: "maxBytes",
240 value: maxBytes,
241 });
242 }
243 if (maxFiles < 1) {
244 return yield* new DesktopLogFileWriterConfigurationError({
245 option: "maxFiles",
246 value: maxFiles,
247 });
248 }
249​
250 yield* fileSystem.makeDirectory(directory, { recursive: true });
251​
252 const withSuffix = (index: number) => `${input.filePath}.${index}`;
253 const currentSize = yield* Ref.make(yield* refreshFileSize(fileSystem, input.filePath));
254 const mutex = yield* Semaphore.make(1);
255​
256 const pruneOverflowBackups = Effect.gen(function* () {
257 const entries = yield* fileSystem.readDirectory(directory).pipe(Effect.orElseSucceed(() => []));
258 for (const entry of entries) {
259 if (!entry.startsWith(`${baseName}.`)) continue;
260 const suffix = Number(entry.slice(baseName.length + 1));
261 if (!Number.isInteger(suffix) || suffix <= maxFiles) continue;
262 yield* fileSystem.remove(path.join(directory, entry), { force: true }).pipe(Effect.ignore);
263 }
264 });
265​
266 const rotate = Effect.gen(function* () {
267 yield* fileSystem.remove(withSuffix(maxFiles), { force: true }).pipe(Effect.ignore);
268 for (let index = maxFiles - 1; index >= 1; index -= 1) {
269 const source = withSuffix(index);
270 const sourceExists = yield* fileSystem.exists(source).pipe(Effect.orElseSucceed(() => false));
271 if (sourceExists) {
272 yield* fileSystem.rename(source, withSuffix(index + 1));
273 }
274 }
275 const currentExists = yield* fileSystem
276 .exists(input.filePath)
277 .pipe(Effect.orElseSucceed(() => false));
278 if (currentExists) {
279 yield* fileSystem.rename(input.filePath, withSuffix(1));
280 }
281 yield* Ref.set(currentSize, 0);
282 }).pipe(
283 Effect.catch(() =>
284 refreshFileSize(fileSystem, input.filePath).pipe(
285 Effect.flatMap((size) => Ref.set(currentSize, size)),
286 ),
287 ),
288 );
289​
290 const writeBytes = (chunk: Uint8Array): Effect.Effect<void> => {
291 if (chunk.byteLength === 0) return Effect.void;
292​
293 return mutex.withPermits(1)(
294 Effect.gen(function* () {
295 const beforeSize = yield* Ref.get(currentSize);
296 if (beforeSize > 0 && beforeSize + chunk.byteLength > maxBytes) {
297 yield* rotate;
298 }
299​
300 yield* fileSystem.writeFile(input.filePath, chunk, { flag: "a" });
301 const afterSize = (yield* Ref.get(currentSize)) + chunk.byteLength;
302 yield* Ref.set(currentSize, afterSize);
303​
304 if (afterSize > maxBytes) {
305 yield* rotate;
306 }
307 }).pipe(
308 Effect.catch(() =>
309 refreshFileSize(fileSystem, input.filePath).pipe(
310 Effect.flatMap((size) => Ref.set(currentSize, size)),
311 ),
312 ),
313 ),
314 );
315 };
316​
317 yield* pruneOverflowBackups;
318​
319 return {
320 writeBytes,
321 writeText: (chunk) => writeBytes(textEncoder.encode(chunk)),
322 } satisfies RotatingLogFileWriter;
323});
324​
325const readPersistedOtlpTracesUrl: Effect.Effect<
326 Option.Option<string>,
327 never,
328 FileSystem.FileSystem | DesktopEnvironment.DesktopEnvironment
329> = Effect.gen(function* () {
330 const fileSystem = yield* FileSystem.FileSystem;
331 const environment = yield* DesktopEnvironment.DesktopEnvironment;
332 const raw = yield* fileSystem.readFileString(environment.serverSettingsPath).pipe(Effect.option);
333 if (Option.isNone(raw)) {
334 return Option.none();
335 }
336​
337 const parsed = parsePersistedServerObservabilitySettings(raw.value);
338 return Option.fromNullishOr(parsed.otlpTracesUrl);
339});
340​
341const resolveOtlpTracesUrl = Effect.gen(function* () {
342 const environment = yield* DesktopEnvironment.DesktopEnvironment;
343 if (Option.isSome(environment.otlpTracesUrl)) {
344 return environment.otlpTracesUrl;
345 }
346 return yield* readPersistedOtlpTracesUrl;
347});
348​
349const writeDevelopmentConsoleOutput = (
350 streamName: "stdout" | "stderr",
351 chunk: Uint8Array,
352): Effect.Effect<void> =>
353 Effect.sync(() => {
354 const output = streamName === "stderr" ? process.stderr : process.stdout;
355 output.write(chunk);
356 }).pipe(Effect.ignore);
357​
358const writeBackendChildLogRecord = Effect.fn("desktop.observability.writeBackendChildLogRecord")(
359 function* (
360 logFile: RotatingLogFileWriter,
361 input: {
362 readonly message: string;
363 readonly level: "INFO" | "ERROR";
364 readonly annotations: Record<string, unknown>;
365 },
366 ): Effect.fn.Return<void> {
367 return yield* Effect.gen(function* () {
368 const timestamp = DateTime.formatIso(yield* DateTime.now);
369 const encoded = yield* encodeDesktopBackendChildLogRecord({
370 message: input.message,
371 level: input.level,
372 timestamp,
373 annotations: input.annotations,
374 spans: {},
375 fiberId: DESKTOP_BACKEND_CHILD_LOG_FIBER_ID,
376 });
377 yield* logFile.writeText(`${encoded}\n`);
378 }).pipe(Effect.ignore({ log: true }));
379 },
380);
381​
382const PRIMARY_BACKEND_LOG_INSTANCE_ID = PRIMARY_LOCAL_ENVIRONMENT_ID;
383​
384const sanitizeInstanceIdForFileName = (id: string): string => id.replace(/[^a-zA-Z0-9._-]+/g, "_");
385​
386const backendLogFilePathForInstance = (
387 environment: DesktopEnvironment.DesktopEnvironment["Service"],
388 id: string,
389): string => {
390 // Primary keeps the historical "server-child.log" path so ops scripts
391 // and packaged-build log inspection still find it where it always lived.
392 if (id === PRIMARY_BACKEND_LOG_INSTANCE_ID) {
393 return environment.path.join(environment.logDir, "server-child.log");
394 }
395 const sanitized = sanitizeInstanceIdForFileName(id);
396 return environment.path.join(environment.logDir, `server-child-${sanitized}.log`);
397};
398​
399// Just the IO sink. Cacheable by resolved file path so two ids that
400// sanitize to the same filename share a single RotatingLogFileWriter
401// (no race on currentSize tracking). Splitting the sink off from the
402// per-call shape lets the shape annotate writes with the *caller's*
403// id rather than whatever id created the cached writer first.
404const makeBackendOutputSinkForInstance = (
405 environment: DesktopEnvironment.DesktopEnvironment["Service"],
406 id: string,
407): Effect.Effect<
408 Option.Option<RotatingLogFileWriter>,
409 never,
410 FileSystem.FileSystem | Path.Path | Scope.Scope
411> =>
412 makeRotatingLogFileWriter({
413 filePath: backendLogFilePathForInstance(environment, id),
414 }).pipe(Effect.option);
415​
416const makeBackendOutputLogShape = (
417 environment: DesktopEnvironment.DesktopEnvironment["Service"],
418 id: string,
419 sink: Option.Option<RotatingLogFileWriter>,
420): Effect.Effect<DesktopBackendOutputLogShape> =>
421 Option.match(sink, {
422 onNone: () => Effect.succeed(DesktopBackendOutputLogNoop),
423 onSome: (logFile) =>
424 Effect.gen(function* () {
425 const sessionRef = yield* Ref.make(Option.none<BackendOutputSession>());
426 const writeFailure = Effect.fn("desktop.observability.backendOutput.writeFailure")(
427 function* (session: BackendOutputSession, details: string) {
428 yield* writeBackendChildLogRecord(logFile, {
429 message: "backend child process failure output start",
430 level: "ERROR",
431 annotations: {
432 component: "desktop-backend-child",
433 runId: session.runId,
434 instanceId: id,
435 phase: "START",
436 details: session.startDetails,
437 },
438 });
439 for (const output of session.chunks) {
440 yield* writeBackendChildLogRecord(logFile, {
441 message: "backend child process output",
442 level: output.streamName === "stderr" ? "ERROR" : "INFO",
443 annotations: {
444 component: "desktop-backend-child",
445 runId: session.runId,
446 instanceId: id,
447 stream: output.streamName,
448 text: textDecoder.decode(output.chunk.subarray(output.offset)),
449 },
450 });
451 }
452 yield* writeBackendChildLogRecord(logFile, {
453 message: "backend child process failure output end",
454 level: "ERROR",
455 annotations: {
456 component: "desktop-backend-child",
457 runId: session.runId,
458 instanceId: id,
459 phase: "END",
460 details: sanitizeLogValue(details),
461 },
462 });
463 },
464 );
465 return {
466 beginSession: Effect.fn("desktop.observability.backendOutput.beginSession")(function* ({
467 details,
468 }) {
469 const runId = yield* currentDesktopRunId;
470 yield* Ref.set(
471 sessionRef,
472 Option.some({
473 runId,
474 startDetails: sanitizeLogValue(details),
475 chunks: [],
476 byteLength: 0,
477 }),
478 );
479 }),
480 writeOutputChunk: Effect.fnUntraced(function* (streamName, chunk) {
481 if (environment.isDevelopment) {
482 yield* writeDevelopmentConsoleOutput(streamName, chunk);
483 }
484 yield* Ref.update(
485 sessionRef,
486 Option.map((session) => appendBoundedOutputChunk(session, streamName, chunk)),
487 );
488 }),
489 persistFailureSnapshot: Effect.fn(
490 "desktop.observability.backendOutput.persistFailureSnapshot",
491 )(function* ({ details }) {
492 const session = yield* Ref.get(sessionRef);
493 if (Option.isSome(session)) {
494 yield* writeFailure(session.value, details);
495 }
496 }),
497 persistFailure: Effect.fn("desktop.observability.backendOutput.persistFailure")(
498 function* ({ details }) {
499 const session = yield* Ref.modify(sessionRef, (current) => [current, Option.none()]);
500 if (Option.isNone(session)) return;
501 yield* writeFailure(session.value, details);
502 },
503 ),
504 discardSession: Ref.set(sessionRef, Option.none()),
505 } satisfies DesktopBackendOutputLogShape;
506 }),
507 });
508​
509const backendOutputLogFactoryLayer = Layer.effect(
510 DesktopBackendOutputLogFactory,
511 Effect.gen(function* () {
512 const environment = yield* DesktopEnvironment.DesktopEnvironment;
513 const fileSystem = yield* FileSystem.FileSystem;
514 const path = yield* Path.Path;
515 const factoryScope = yield* Scope.Scope;
516 // Per-file-path cache of the IO sink only. The per-call shape
517 // wraps the sink with the caller's instance id so a cache hit on
518 // a path collision (e.g. "wsl:default" and "wsl_default" both
519 // resolve to server-child-wsl_default.log) doesn't attribute the
520 // second caller's writes to the first caller's id. Each sink pins
521 // itself to the factory's scope so all log resources tear down
522 // together at app exit. Mutex serializes concurrent first-time
523 // lookups for the same file path.
524 const cacheRef = yield* SynchronizedRef.make<
525 ReadonlyMap<string, Option.Option<RotatingLogFileWriter>>
526 >(new Map());
527​
528 const makeForId = (id: string): Effect.Effect<DesktopBackendOutputLogShape> =>
529 SynchronizedRef.modifyEffect(cacheRef, (cache) => {
530 const cacheKey = backendLogFilePathForInstance(environment, id);
531 const cached = cache.get(cacheKey);
532 if (cached !== undefined) {
533 return makeBackendOutputLogShape(environment, id, cached).pipe(
534 Effect.map((outputLog) => [outputLog, cache] as const),
535 );
536 }
537 return makeBackendOutputSinkForInstance(environment, id).pipe(
538 Effect.provideService(FileSystem.FileSystem, fileSystem),
539 Effect.provideService(Path.Path, path),
540 Scope.provide(factoryScope),
541 Effect.map((sink) => {
542 const next = new Map(cache);
543 next.set(cacheKey, sink);
544 return { sink, next };
545 }),
546 Effect.flatMap(({ sink, next }) =>
547 makeBackendOutputLogShape(environment, id, sink).pipe(
548 Effect.map(
549 (outputLog) =>
550 [
551 outputLog,
552 next as ReadonlyMap<string, Option.Option<RotatingLogFileWriter>>,
553 ] as const,
554 ),
555 ),
556 ),
557 );
558 });
559​
560 return DesktopBackendOutputLogFactory.of({
561 forInstance: (id) => makeForId(id),
562 });
563 }),
564);
565​
566const desktopLoggerLayer = Layer.mergeAll(
567 Logger.layer([Logger.consolePretty(), Logger.tracerLogger], { mergeWithExisting: false }),
568 Layer.succeed(References.MinimumLogLevel, "Info"),
569);
570​
571const tracerLayer = Layer.unwrap(
572 Effect.gen(function* () {
573 const environment = yield* DesktopEnvironment.DesktopEnvironment;
574 const otlpTracesUrl = yield* resolveOtlpTracesUrl;
575 const tracePath = environment.path.join(environment.logDir, "desktop.trace.ndjson");
576 const sink = yield* makeTraceSink({
577 filePath: tracePath,
578 maxBytes: DESKTOP_LOG_FILE_MAX_BYTES,
579 maxFiles: DESKTOP_LOG_FILE_MAX_FILES,
580 batchWindowMs: DESKTOP_TRACE_BATCH_WINDOW_MS,
581 });
582 const delegate = Option.isNone(otlpTracesUrl)
583 ? undefined
584 : yield* OtlpTracer.make({
585 url: otlpTracesUrl.value,
586 exportInterval: `${environment.otlpExportIntervalMs} millis`,
587 resource: {
588 serviceName: "desktop",
589 attributes: {
590 "service.runtime": "desktop",
591 "service.mode": environment.isDevelopment ? "development" : "packaged",
592 },
593 },
594 });
595 const tracer = yield* makeLocalFileTracer({
596 filePath: tracePath,
597 maxBytes: DESKTOP_LOG_FILE_MAX_BYTES,
598 maxFiles: DESKTOP_LOG_FILE_MAX_FILES,
599 batchWindowMs: DESKTOP_TRACE_BATCH_WINDOW_MS,
600 sink,
601 ...(delegate ? { delegate } : {}),
602 });
603​
604 return Layer.succeed(Tracer.Tracer, tracer);
605 }),
606).pipe(Layer.provide(OtlpExporter.layerFlusher), Layer.provideMerge(OtlpSerialization.layerJson));
607​
608export const layer = Layer.mergeAll(
609 backendOutputLogFactoryLayer,
610 desktopLoggerLayer,
611 tracerLayer,
612 Layer.succeed(Tracer.MinimumTraceLevel, "Info"),
613 Layer.succeed(References.TracerTimingEnabled, true),
614);