@safaricom-mxl/effect-sdk 0.0.16 → 0.0.18
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/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +3 -41
- package/dist/browser/index.js.map +1 -1
- package/dist/cloudflare/index.js +63 -15
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/{index-BF4-zL-9.d.mts → index-Ce1sBt5C.d.mts} +38 -6
- package/dist/index-Ce1sBt5C.d.mts.map +1 -0
- package/dist/index.server.d.mts +1 -1
- package/dist/index.server.mjs +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/{server-DU685moi.mjs → server-TZFDEJ99.mjs} +76 -34
- package/dist/server-TZFDEJ99.mjs.map +1 -0
- package/package.json +15 -14
- package/LICENSE +0 -201
- package/dist/index-BF4-zL-9.d.mts.map +0 -1
- package/dist/server-DU685moi.mjs.map +0 -1
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { Cause, Config, Context, Duration, Effect, Layer, ManagedRuntime, Match, Option, References, Schedule, Schema, Semaphore } from "effect";
|
|
3
|
-
import * as Tracer from "effect/Tracer";
|
|
4
3
|
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpMiddleware } from "effect/unstable/http";
|
|
5
4
|
import { Otlp } from "effect/unstable/observability";
|
|
5
|
+
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
|
|
6
6
|
import * as Otel from "@opentelemetry/api";
|
|
7
7
|
import { SpanKind, SpanStatusCode, TraceFlags, context, propagation, trace } from "@opentelemetry/api";
|
|
8
|
+
import * as Tracer from "effect/Tracer";
|
|
8
9
|
import { v7 } from "uuid";
|
|
9
10
|
import { platform, provider, runtime } from "std-env";
|
|
11
|
+
import { SchemaJITCompiler } from "effect/unstable/schema";
|
|
10
12
|
import * as Option$1 from "effect/Option";
|
|
11
13
|
import * as OtelTracer from "@effect/opentelemetry/OtelTracer";
|
|
12
14
|
//#region src/server/otel-context-bridge.ts
|
|
13
|
-
const OTEL_SPAN_TYPE_ID = "~@effect/opentelemetry/OtelTracer/OtelSpan";
|
|
14
15
|
const evaluate = "~effect/Effect/evaluate";
|
|
16
|
+
let contextManagerInstalled = false;
|
|
17
|
+
/**
|
|
18
|
+
* Install AsyncLocalStorage so `Otel.context.with` actually propagates.
|
|
19
|
+
* Does not replace a context manager the host app already registered.
|
|
20
|
+
*/
|
|
21
|
+
function ensureOtelContextManager() {
|
|
22
|
+
if (contextManagerInstalled) return;
|
|
23
|
+
const manager = new AsyncLocalStorageContextManager();
|
|
24
|
+
manager.enable();
|
|
25
|
+
if (!Otel.context.setGlobalContextManager(manager)) {
|
|
26
|
+
manager.disable();
|
|
27
|
+
contextManagerInstalled = true;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
contextManagerInstalled = true;
|
|
31
|
+
}
|
|
15
32
|
function formatTraceparent(span) {
|
|
16
33
|
const flags = span.sampled ? "01" : "00";
|
|
17
34
|
return `00-${span.traceId}-${span.spanId}-${flags}`;
|
|
18
35
|
}
|
|
19
36
|
function buildTraceCarrierFromSpan(span, headers) {
|
|
20
37
|
const carrier = { traceparent: formatTraceparent(span) };
|
|
21
|
-
if (headers?.tracestate) carrier
|
|
22
|
-
if (headers?.baggage) carrier
|
|
38
|
+
if (headers?.["tracestate"]) carrier["tracestate"] = headers["tracestate"];
|
|
39
|
+
if (headers?.["baggage"]) carrier["baggage"] = headers["baggage"];
|
|
23
40
|
return carrier;
|
|
24
41
|
}
|
|
25
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Put Effect span ids on the global OpenTelemetry context.
|
|
44
|
+
*
|
|
45
|
+
* Id-only `setSpanContext`. Live `Otel.Span` objects come from
|
|
46
|
+
* `OtelTracer.currentOtelSpan` in Effect space, not from a private TypeId.
|
|
47
|
+
*/
|
|
26
48
|
function effectSpanToOtelContext(activeContext, span) {
|
|
27
|
-
if (typeof span === "object" && span !== null && OTEL_SPAN_TYPE_ID in span && "span" in span) return Otel.trace.setSpan(activeContext, span.span);
|
|
28
49
|
return Otel.trace.setSpanContext(activeContext, {
|
|
29
50
|
isRemote: span._tag === "ExternalSpan",
|
|
30
51
|
spanId: span.spanId,
|
|
@@ -32,8 +53,16 @@ function effectSpanToOtelContext(activeContext, span) {
|
|
|
32
53
|
traceId: span.traceId
|
|
33
54
|
});
|
|
34
55
|
}
|
|
35
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Wrap a tracer so Effect spans activate global `@opentelemetry/api` context.
|
|
58
|
+
*
|
|
59
|
+
* Prefer this over `Otlp.layerJson({ tracerContext })` until Effect changes
|
|
60
|
+
* that hook. On effect@4.0.0-rc.117 the callback is still `(primitive, span)`
|
|
61
|
+
* and must return the evaluation, but `EffectPrimitive` only evaluates with a
|
|
62
|
+
* `fiber`. Keep this wrap until Effect passes fiber or evaluates after the hook.
|
|
63
|
+
*/
|
|
36
64
|
function wrapTracerWithOtelContextBridge(base) {
|
|
65
|
+
ensureOtelContextManager();
|
|
37
66
|
const existingContext = base.context;
|
|
38
67
|
return Tracer.make({
|
|
39
68
|
span(options) {
|
|
@@ -54,7 +83,7 @@ function wrapTracerWithOtelContextBridge(base) {
|
|
|
54
83
|
/**
|
|
55
84
|
* Layer that wraps the configured Effect tracer with a global OTel context bridge.
|
|
56
85
|
*
|
|
57
|
-
* Must be
|
|
86
|
+
* Must be provided over `Otlp.layerJson` so queue propagation, log correlation,
|
|
58
87
|
* and outbound W3C headers see the active server span.
|
|
59
88
|
*/
|
|
60
89
|
const otelGlobalContextBridgeLayer = Layer.effect(Tracer.Tracer, Effect.gen(function* () {
|
|
@@ -247,7 +276,10 @@ const getAutoPlatformAttributes = () => {
|
|
|
247
276
|
const proc = globalThis.process;
|
|
248
277
|
const procEnv = proc?.env ?? {};
|
|
249
278
|
const env = {};
|
|
250
|
-
for (const key of PLATFORM_ENV_KEYS)
|
|
279
|
+
for (const key of PLATFORM_ENV_KEYS) {
|
|
280
|
+
const value = procEnv[key];
|
|
281
|
+
if (value !== void 0) env[key] = value;
|
|
282
|
+
}
|
|
251
283
|
return derivePlatformAttributes({
|
|
252
284
|
runtime: runtime ?? "",
|
|
253
285
|
provider: provider ?? "",
|
|
@@ -261,7 +293,7 @@ const getAutoPlatformAttributes = () => {
|
|
|
261
293
|
const stringOrUndefined$1 = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
262
294
|
const DEFAULT_VCS_REPOSITORY_URL = "https://gitlab.safaricom.co.ke/mxl/apm/mxl-effect-sdk";
|
|
263
295
|
function resolveCommitRevision() {
|
|
264
|
-
return stringOrUndefined$1(process.env
|
|
296
|
+
return stringOrUndefined$1(process.env["COMMIT_SHA"]) ?? stringOrUndefined$1(process.env["VERCEL_GIT_COMMIT_SHA"]) ?? stringOrUndefined$1(process.env["GITHUB_SHA"]) ?? stringOrUndefined$1(process.env["RAILWAY_GIT_COMMIT_SHA"]) ?? stringOrUndefined$1(process.env["CF_PAGES_COMMIT_SHA"]) ?? stringOrUndefined$1(process.env["RENDER_GIT_COMMIT"]);
|
|
265
297
|
}
|
|
266
298
|
let serviceInstanceId;
|
|
267
299
|
const getServiceInstanceId = () => serviceInstanceId ??= v7();
|
|
@@ -301,7 +333,7 @@ const resolveResource = (config) => Effect.gen(function* () {
|
|
|
301
333
|
attributes["deployment.commit_sha"] = commitRevision;
|
|
302
334
|
attributes["vcs.ref.head.revision"] = commitRevision;
|
|
303
335
|
}
|
|
304
|
-
attributes["vcs.repository.url.full"] = stringOrUndefined$1(process.env
|
|
336
|
+
attributes["vcs.repository.url.full"] = stringOrUndefined$1(process.env["MXL_VCS_REPOSITORY_URL"]) ?? DEFAULT_VCS_REPOSITORY_URL;
|
|
305
337
|
Object.assign(attributes, envResourceAttributes);
|
|
306
338
|
if (config.attributes) Object.assign(attributes, config.attributes);
|
|
307
339
|
return {
|
|
@@ -323,6 +355,14 @@ var layer_exports = /* @__PURE__ */ __exportAll({ layer: () => layer$1 });
|
|
|
323
355
|
* configured for MXL's OTLP collector.
|
|
324
356
|
*
|
|
325
357
|
* Returns a no-op layer when `OTEL_SDK_DISABLED=true`.
|
|
358
|
+
*
|
|
359
|
+
* Wraps the OTLP tracer with `otelGlobalContextBridgeLayer` via `provideMerge`.
|
|
360
|
+
* Measured on effect@4.0.0-rc.117: `Otlp.layerJson({ tracerContext })` still
|
|
361
|
+
* types the hook as `(primitive, span) => X` and Effect returns that result as
|
|
362
|
+
* the evaluation, so the callback cannot call `~effect/Effect/evaluate` without
|
|
363
|
+
* a `fiber`. `Layer.updateService` also cannot wrap a Tracer the OTLP layer
|
|
364
|
+
* already provides. Keep the merge wrap until Effect passes fiber or evaluates
|
|
365
|
+
* after a side-effect-only context hook.
|
|
326
366
|
*/
|
|
327
367
|
const layer$1 = (config = {}) => Layer.unwrap(Effect.gen(function* () {
|
|
328
368
|
const resolved = yield* resolveResource({
|
|
@@ -330,7 +370,7 @@ const layer$1 = (config = {}) => Layer.unwrap(Effect.gen(function* () {
|
|
|
330
370
|
sdkType: "server"
|
|
331
371
|
});
|
|
332
372
|
if (!resolved.endpoint) return Layer.empty;
|
|
333
|
-
|
|
373
|
+
const otlp = Otlp.layerJson({
|
|
334
374
|
baseUrl: normalizeOtlpBaseUrl(resolved.endpoint),
|
|
335
375
|
headers: resolved.headers,
|
|
336
376
|
resource: resolved.resource,
|
|
@@ -340,7 +380,8 @@ const layer$1 = (config = {}) => Layer.unwrap(Effect.gen(function* () {
|
|
|
340
380
|
tracerExportInterval: config.tracerExportInterval,
|
|
341
381
|
shutdownTimeout: config.shutdownTimeout
|
|
342
382
|
}).pipe(Layer.provide(FetchHttpClient.layer));
|
|
343
|
-
|
|
383
|
+
return otelGlobalContextBridgeLayer.pipe(Layer.provideMerge(otlp));
|
|
384
|
+
}));
|
|
344
385
|
const RESERVED_EVENT_NAMES = ["session_start", "session_end"];
|
|
345
386
|
const isReservedEventName = (name) => RESERVED_EVENT_NAMES.some((reserved) => reserved === name);
|
|
346
387
|
const coerceTrackProps = (props) => {
|
|
@@ -397,13 +438,14 @@ var ProductEventsPostError = class extends Schema.TaggedError()("@safaricom-mxl/
|
|
|
397
438
|
message: Schema.String,
|
|
398
439
|
status: Schema.optionalKey(Schema.Number)
|
|
399
440
|
}) {};
|
|
441
|
+
SchemaJITCompiler.enable(ProductEventsPostError.ast);
|
|
400
442
|
const stringOrUndefined = (value) => value && value.length > 0 ? value : void 0;
|
|
401
443
|
const resolveEventsConfig = (config) => {
|
|
402
|
-
const endpoint = (config.endpoint ?? process.env
|
|
444
|
+
const endpoint = (config.endpoint ?? process.env["MXL_BASKET_URL"] ?? DEFAULT_BASKET_URL).replace(/\/$/, "");
|
|
403
445
|
return {
|
|
404
|
-
apiKey: stringOrUndefined(config.apiKey ?? process.env
|
|
405
|
-
clientId: stringOrUndefined(config.clientId ?? process.env
|
|
406
|
-
serviceName: config.serviceName ?? process.env
|
|
446
|
+
apiKey: stringOrUndefined(config.apiKey ?? process.env["MXL_API_KEY"]),
|
|
447
|
+
clientId: stringOrUndefined(config.clientId ?? process.env["MXL_CLIENT_ID"]),
|
|
448
|
+
serviceName: config.serviceName ?? process.env["OTEL_SERVICE_NAME"] ?? "unknown",
|
|
407
449
|
url: `${endpoint}${config.eventsPath ?? "/events"}`
|
|
408
450
|
};
|
|
409
451
|
};
|
|
@@ -572,11 +614,11 @@ function traceCorrelationLogAnnotations(options) {
|
|
|
572
614
|
const annotations = { ...extra };
|
|
573
615
|
if (correlation.traceId) {
|
|
574
616
|
annotations["trace.trace_id"] = correlation.traceId;
|
|
575
|
-
annotations
|
|
617
|
+
annotations["trace_id"] = correlation.traceId;
|
|
576
618
|
}
|
|
577
619
|
if (correlation.spanId) {
|
|
578
620
|
annotations["trace.span_id"] = correlation.spanId;
|
|
579
|
-
annotations
|
|
621
|
+
annotations["span_id"] = correlation.spanId;
|
|
580
622
|
}
|
|
581
623
|
return annotations;
|
|
582
624
|
}
|
|
@@ -588,9 +630,9 @@ function annotateLogsWithActiveSpanCorrelation(program, fields) {
|
|
|
588
630
|
const currentSpan = yield* Effect.currentSpan.pipe(Effect.option);
|
|
589
631
|
if (Option$1.isSome(currentSpan)) {
|
|
590
632
|
annotations["trace.trace_id"] = currentSpan.value.traceId;
|
|
591
|
-
annotations
|
|
633
|
+
annotations["trace_id"] = currentSpan.value.traceId;
|
|
592
634
|
annotations["trace.span_id"] = currentSpan.value.spanId;
|
|
593
|
-
annotations
|
|
635
|
+
annotations["span_id"] = currentSpan.value.spanId;
|
|
594
636
|
} else Object.assign(annotations, traceCorrelationLogAnnotations({
|
|
595
637
|
...traceparent !== void 0 ? { traceparent } : {},
|
|
596
638
|
...extra
|
|
@@ -611,7 +653,7 @@ const LOG_LEVEL_BY_ENV = {
|
|
|
611
653
|
fatal: "Fatal"
|
|
612
654
|
};
|
|
613
655
|
function resolveLogLevelFromEnv(env = process.env) {
|
|
614
|
-
const raw = env
|
|
656
|
+
const raw = env["OTEL_LOG_LEVEL"] ?? env["LOG_LEVEL"] ?? "info";
|
|
615
657
|
return LOG_LEVEL_BY_ENV[raw.trim().toLowerCase()] ?? "Info";
|
|
616
658
|
}
|
|
617
659
|
function isFiniteHttpStatus(status) {
|
|
@@ -708,7 +750,7 @@ function spanContextFromTraceparent(traceparent) {
|
|
|
708
750
|
};
|
|
709
751
|
}
|
|
710
752
|
function resolveTraceparentFromHeaders(headers) {
|
|
711
|
-
return headerValue$1(headers
|
|
753
|
+
return headerValue$1(headers["traceparent"]);
|
|
712
754
|
}
|
|
713
755
|
function withParentFromTraceparent(headers, program) {
|
|
714
756
|
const parentSpanContext = spanContextFromTraceparent(resolveTraceparentFromHeaders(headers));
|
|
@@ -761,7 +803,7 @@ function buildHttpResponseLogFields(options) {
|
|
|
761
803
|
...options.route === void 0 ? {} : { "url.path": options.route },
|
|
762
804
|
...options.traceparent === void 0 ? {} : { traceparent: options.traceparent }
|
|
763
805
|
};
|
|
764
|
-
if (options.error !== void 0) fields
|
|
806
|
+
if (options.error !== void 0) fields["error"] = serializeLogError(options.error);
|
|
765
807
|
return fields;
|
|
766
808
|
}
|
|
767
809
|
/** Log an HTTP response at info/warn/error severity based on status code. */
|
|
@@ -805,7 +847,7 @@ function spanContextFromCarrier(carrier) {
|
|
|
805
847
|
const extracted = propagation.extract(context.active(), normalized);
|
|
806
848
|
const spanContext = trace.getSpan(extracted)?.spanContext();
|
|
807
849
|
if (spanContext?.traceId && spanContext.traceId !== "00000000000000000000000000000000" && spanContext.spanId && spanContext.spanId !== "0000000000000000") return spanContext;
|
|
808
|
-
return spanContextFromTraceparent(normalized
|
|
850
|
+
return spanContextFromTraceparent(normalized["traceparent"]);
|
|
809
851
|
}
|
|
810
852
|
function withParentFromTraceCarrier(carrier, program) {
|
|
811
853
|
const parentSpanContext = spanContextFromCarrier(carrier);
|
|
@@ -872,14 +914,14 @@ function headerValue(headers, name) {
|
|
|
872
914
|
if (lower !== void 0) return lower;
|
|
873
915
|
}
|
|
874
916
|
function assignTraceFields(event, traceId, spanId, overwrite) {
|
|
875
|
-
if (overwrite || event
|
|
876
|
-
if (overwrite || event
|
|
877
|
-
if (overwrite || event
|
|
878
|
-
if (overwrite || event
|
|
879
|
-
const trace = typeof event
|
|
880
|
-
if (overwrite || trace
|
|
881
|
-
if (overwrite || trace
|
|
882
|
-
if (Object.keys(trace).length > 0) event
|
|
917
|
+
if (overwrite || event["trace_id"] === void 0) event["trace_id"] = traceId;
|
|
918
|
+
if (overwrite || event["span_id"] === void 0) event["span_id"] = spanId;
|
|
919
|
+
if (overwrite || event["traceId"] === void 0) event["traceId"] = traceId;
|
|
920
|
+
if (overwrite || event["spanId"] === void 0) event["spanId"] = spanId;
|
|
921
|
+
const trace = typeof event["trace"] === "object" && event["trace"] !== null ? event["trace"] : {};
|
|
922
|
+
if (overwrite || trace["trace_id"] === void 0) trace["trace_id"] = traceId;
|
|
923
|
+
if (overwrite || trace["span_id"] === void 0) trace["span_id"] = spanId;
|
|
924
|
+
if (Object.keys(trace).length > 0) event["trace"] = trace;
|
|
883
925
|
}
|
|
884
926
|
/**
|
|
885
927
|
* Enrich evlog wide events with trace/span IDs from OTel global context or W3C headers.
|
|
@@ -1007,4 +1049,4 @@ async function withPromiseDependencySpan(name, attributes, operation, kind = "cl
|
|
|
1007
1049
|
//#endregion
|
|
1008
1050
|
export { minimumLogLevelLayer as A, flushable_exports as B, withParentFromTraceparent as C, logError as D, logDebug as E, getEffectTraceCorrelation as F, parseOtelResourceAttributes as G, layer_exports as H, parseTraceparent as I, buildTraceCarrierFromSpan as J, parseOtlpHeaders as K, traceCorrelationLogAnnotations as L, resolveLogLevelFromEnv as M, serializeLogError as N, logInfo as O, annotateLogsWithActiveSpanCorrelation as P, shouldDisableHttpTrace as R, withParentFromTraceCarrier as S, logAtLevel as T, derivePlatformAttributes as U, events_exports as V, getAutoPlatformAttributes as W, otelGlobalContextBridgeLayer as X, formatTraceparent as Y, wrapTracerWithOtelContextBridge as Z, logHttpResponse as _, kafkaProducerSpanAttributes as a, spanContextFromTraceparent as b, withDependencySpan as c, jobWithSpanEffect as d, runJobWithSpan as f, logHttpRequestFailure as g, finalizeHttpSpan as h, geoSpanAttributes as i, resolveEffectLogLevelFromHttpStatus as j, logWarning as k, withPromiseDependencySpan as l, buildQueueTraceCarrierEffect as m, bufferSpanAttributes as n, queueConsumerSpanAttributes as o, buildQueueTraceCarrier as p, normalizeOtlpBaseUrl as q, dbClientSpanAttributes as r, queueProducerSpanAttributes as s, addSpanLinksFromTraceCarriers as t, createEffectTraceEnricher as u, resolveTraceparentFromHeaders as v, buildHttpStatusLogFields as w, withHttpServerSpan as x, spanContextFromCarrier as y, tracerDisabledWhenLayer as z };
|
|
1009
1051
|
|
|
1010
|
-
//# sourceMappingURL=server-
|
|
1052
|
+
//# sourceMappingURL=server-TZFDEJ99.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-TZFDEJ99.mjs","names":["stringOrUndefined","uuidv7","EnvConfig.sdkDisabled","EnvConfig.endpoint","endpoint","EnvConfig.otlpHeaders","EnvConfig.serviceVersion","serviceVersion","EnvConfig.environment","environment","EnvConfig.otelServiceName","EnvConfig.otelResourceAttributes","layer","make","otelLayer","eventsLayer","traceApi","otelContext","Option","headerValue","traceApi","otelContext","Option","traceApi","otelContext"],"sources":["../src/server/otel-context-bridge.ts","../src/server/otlp.ts","../src/server/config.ts","../src/server/platform.ts","../src/server/resource.ts","../src/server/layer.ts","../src/shared/product-event.ts","../src/version.ts","../src/server/events.ts","../src/server/flushable.ts","../src/server/http-middleware.ts","../src/server/trace-correlation.ts","../src/server/logging.ts","../src/server/http-tracing.ts","../src/server/jobs.ts","../src/server/evlog-bridge.ts","../src/shared/dependency-spans.ts"],"sourcesContent":["import { AsyncLocalStorageContextManager } from \"@opentelemetry/context-async-hooks\";\nimport * as Otel from \"@opentelemetry/api\";\nimport { Effect, Layer } from \"effect\";\nimport * as Tracer from \"effect/Tracer\";\n\nconst evaluate = \"~effect/Effect/evaluate\" as const;\n\nlet contextManagerInstalled = false;\n\n/**\n * Install AsyncLocalStorage so `Otel.context.with` actually propagates.\n * Does not replace a context manager the host app already registered.\n */\nexport function ensureOtelContextManager(): void {\n if (contextManagerInstalled) return;\n const manager = new AsyncLocalStorageContextManager();\n manager.enable();\n if (!Otel.context.setGlobalContextManager(manager)) {\n manager.disable();\n contextManagerInstalled = true;\n return;\n }\n contextManagerInstalled = true;\n}\n\nexport function formatTraceparent(span: Tracer.AnySpan): string {\n const flags = span.sampled ? \"01\" : \"00\";\n return `00-${span.traceId}-${span.spanId}-${flags}`;\n}\n\nexport function buildTraceCarrierFromSpan(\n span: Tracer.AnySpan,\n headers?: Record<string, string>\n): Record<string, string> {\n const carrier: Record<string, string> = {\n traceparent: formatTraceparent(span),\n };\n\n if (headers?.[\"tracestate\"]) {\n carrier[\"tracestate\"] = headers[\"tracestate\"];\n }\n if (headers?.[\"baggage\"]) {\n carrier[\"baggage\"] = headers[\"baggage\"];\n }\n\n return carrier;\n}\n\n/**\n * Put Effect span ids on the global OpenTelemetry context.\n *\n * Id-only `setSpanContext`. Live `Otel.Span` objects come from\n * `OtelTracer.currentOtelSpan` in Effect space, not from a private TypeId.\n */\nexport function effectSpanToOtelContext(\n activeContext: Otel.Context,\n span: Tracer.AnySpan\n): Otel.Context {\n return Otel.trace.setSpanContext(activeContext, {\n isRemote: span._tag === \"ExternalSpan\",\n spanId: span.spanId,\n traceFlags: span.sampled ? Otel.TraceFlags.SAMPLED : Otel.TraceFlags.NONE,\n traceId: span.traceId,\n });\n}\n\n/**\n * Wrap a tracer so Effect spans activate global `@opentelemetry/api` context.\n *\n * Prefer this over `Otlp.layerJson({ tracerContext })` until Effect changes\n * that hook. On effect@4.0.0-rc.117 the callback is still `(primitive, span)`\n * and must return the evaluation, but `EffectPrimitive` only evaluates with a\n * `fiber`. Keep this wrap until Effect passes fiber or evaluates after the hook.\n */\nexport function wrapTracerWithOtelContextBridge(\n base: Tracer.Tracer\n): Tracer.Tracer {\n ensureOtelContextManager();\n const existingContext = base.context;\n\n return Tracer.make({\n span(options) {\n return base.span(options);\n },\n context(primitive, fiber) {\n if (fiber.cache.span === undefined) {\n if (existingContext) {\n return existingContext(primitive, fiber);\n }\n return primitive[evaluate](fiber);\n }\n\n return Otel.context.with(\n effectSpanToOtelContext(Otel.context.active(), fiber.cache.span),\n () => {\n if (existingContext) {\n return existingContext(primitive, fiber);\n }\n return primitive[evaluate](fiber);\n }\n );\n },\n });\n}\n\n/**\n * Layer that wraps the configured Effect tracer with a global OTel context bridge.\n *\n * Must be provided over `Otlp.layerJson` so queue propagation, log correlation,\n * and outbound W3C headers see the active server span.\n */\nexport const otelGlobalContextBridgeLayer = Layer.effect(\n Tracer.Tracer,\n Effect.gen(function* () {\n const base = yield* Tracer.Tracer;\n return wrapTracerWithOtelContextBridge(base);\n })\n);\n","export function normalizeOtlpBaseUrl(url: string): string {\n const trimmed = url.replace(/\\/$/, \"\");\n if (trimmed.endsWith(\"/v1/traces\") || trimmed.endsWith(\"/v1/logs\")) {\n return trimmed.replace(/\\/v1\\/(traces|logs|metrics)$/, \"\");\n }\n return trimmed;\n}\n","import { Config, Effect, Option } from \"effect\";\n\nconst DEFAULT_OTLP_ENDPOINT = \"http://127.0.0.1:4318\";\n\n/** Resolve the OTLP exporter endpoint from standard env vars. */\nexport const endpoint = Effect.gen(function* () {\n const otlp = yield* Config.option(\n Config.String(\"OTEL_EXPORTER_OTLP_ENDPOINT\")\n );\n if (Option.isSome(otlp)) return otlp;\n return yield* Config.option(Config.String(\"OTLP_ENDPOINT\"));\n});\n\nexport const defaultOtlpEndpoint = DEFAULT_OTLP_ENDPOINT;\n\nexport const sdkDisabled = Config.Boolean(\"OTEL_SDK_DISABLED\").pipe(\n Config.withDefault(false)\n);\n\n/**\n * Resolve service version / commit SHA from platform-specific env vars.\n *\n * Priority: npm_package_version > COMMIT_SHA > RAILWAY_GIT_COMMIT_SHA >\n * VERCEL_GIT_COMMIT_SHA > CF_PAGES_COMMIT_SHA > RENDER_GIT_COMMIT\n */\nexport const serviceVersion = Config.option(\n Config.String(\"npm_package_version\").pipe(\n Config.orElse(() => Config.String(\"COMMIT_SHA\")),\n Config.orElse(() => Config.String(\"RAILWAY_GIT_COMMIT_SHA\")),\n Config.orElse(() => Config.String(\"VERCEL_GIT_COMMIT_SHA\")),\n Config.orElse(() => Config.String(\"CF_PAGES_COMMIT_SHA\")),\n Config.orElse(() => Config.String(\"RENDER_GIT_COMMIT\"))\n )\n);\n\n/**\n * Resolve deployment environment from env vars.\n *\n * Priority: NODE_ENV > DEPLOYMENT_ENV > \"development\"\n */\nexport const environment = Config.String(\"NODE_ENV\").pipe(\n Config.orElse(() => Config.String(\"DEPLOYMENT_ENV\")),\n Config.withDefault(\"development\")\n);\n\n/** OTel-standard service name override. */\nexport const otelServiceName = Config.option(\n Config.String(\"OTEL_SERVICE_NAME\")\n);\n\n/**\n * Parse the OTel-standard `OTEL_RESOURCE_ATTRIBUTES` env var.\n *\n * Format per the OTel spec: comma-separated `key=value` pairs, values may be\n * URL-encoded.\n */\nexport const parseOtelResourceAttributes = (\n input: string\n): Record<string, string> => {\n const result: Record<string, string> = {};\n for (const pair of input.split(\",\")) {\n const eq = pair.indexOf(\"=\");\n if (eq === -1) continue;\n const key = pair.slice(0, eq).trim();\n if (!key) continue;\n const raw = pair.slice(eq + 1).trim();\n let value = raw;\n try {\n value = decodeURIComponent(raw);\n } catch {\n // Fall back to raw string when decoding fails.\n }\n result[key] = value;\n }\n return result;\n};\n\n/** Resolve and parse `OTEL_RESOURCE_ATTRIBUTES`. */\nexport const otelResourceAttributes = Effect.gen(function* () {\n const raw = yield* Config.option(Config.String(\"OTEL_RESOURCE_ATTRIBUTES\"));\n return Option.match(raw, {\n onNone: () => ({}) as Record<string, string>,\n onSome: (value) => parseOtelResourceAttributes(value),\n });\n});\n\n/**\n * Parse `OTEL_EXPORTER_OTLP_HEADERS` (`key=value,key2=value2`) into a header map.\n */\nexport const parseOtlpHeaders = (input: string): Record<string, string> => {\n const result: Record<string, string> = {};\n for (const pair of input.split(\",\")) {\n const eq = pair.indexOf(\"=\");\n if (eq === -1) continue;\n const key = pair.slice(0, eq).trim();\n if (!key) continue;\n const raw = pair.slice(eq + 1).trim();\n try {\n result[key] = decodeURIComponent(raw);\n } catch {\n result[key] = raw;\n }\n }\n return result;\n};\n\n/** Resolve OTLP export headers from env. */\nexport const otlpHeaders = Effect.gen(function* () {\n const raw = yield* Config.option(Config.String(\"OTEL_EXPORTER_OTLP_HEADERS\"));\n return Option.match(raw, {\n onNone: () => ({}) as Record<string, string>,\n onSome: (value) => parseOtlpHeaders(value),\n });\n});\n","import { Match } from \"effect\";\nimport { platform, provider, runtime } from \"std-env\";\n\nexport interface PlatformEnv {\n readonly AWS_LAMBDA_FUNCTION_NAME?: string | undefined;\n readonly AWS_LAMBDA_FUNCTION_VERSION?: string | undefined;\n readonly AWS_LAMBDA_LOG_STREAM_NAME?: string | undefined;\n readonly AWS_REGION?: string | undefined;\n readonly AWS_DEFAULT_REGION?: string | undefined;\n readonly VERCEL?: string | undefined;\n readonly VERCEL_REGION?: string | undefined;\n readonly VERCEL_DEPLOYMENT_ID?: string | undefined;\n readonly K_SERVICE?: string | undefined;\n readonly K_REVISION?: string | undefined;\n readonly CLOUD_RUN_REGION?: string | undefined;\n readonly DENO_REGION?: string | undefined;\n readonly DENO_DEPLOYMENT_ID?: string | undefined;\n readonly RENDER_INSTANCE_ID?: string | undefined;\n readonly RAILWAY_REPLICA_ID?: string | undefined;\n}\n\nexport interface PlatformInputs {\n readonly runtime: string;\n readonly provider: string;\n readonly platform: string;\n readonly arch: string;\n readonly env: PlatformEnv;\n}\n\ntype Attrs = Record<string, string>;\nconst empty: Attrs = {};\n\nconst runtimeAttrs = (rt: string): Attrs =>\n Match.value(rt).pipe(\n Match.when(\"node\", () => ({ \"process.runtime.name\": \"nodejs\" })),\n Match.whenOr(\"bun\", \"deno\", \"workerd\", \"edge-light\", \"fastly\", (name) => ({\n \"process.runtime.name\": name,\n })),\n Match.orElse((): Attrs => empty)\n );\n\nconst osAttrs = (plat: string): Attrs =>\n Match.value(plat).pipe(\n Match.when(\"win32\", () => ({ \"os.type\": \"windows\" })),\n Match.whenOr(\"darwin\", \"linux\", \"freebsd\", \"openbsd\", \"netbsd\", (p) => ({\n \"os.type\": p,\n })),\n Match.orElse((): Attrs => empty)\n );\n\nconst archAttrs = (a: string): Attrs =>\n a === \"\"\n ? empty\n : {\n \"host.arch\": Match.value(a).pipe(\n Match.when(\"x64\", () => \"amd64\"),\n Match.when(\"ia32\", () => \"x86\"),\n Match.orElse((other) => other)\n ),\n };\n\nconst lambdaAttrs = (env: PlatformEnv): Attrs => ({\n \"cloud.provider\": \"aws\",\n \"cloud.platform\": \"aws_lambda\",\n \"faas.name\": env.AWS_LAMBDA_FUNCTION_NAME!,\n ...(env.AWS_LAMBDA_FUNCTION_VERSION && {\n \"faas.version\": env.AWS_LAMBDA_FUNCTION_VERSION,\n }),\n ...(env.AWS_LAMBDA_LOG_STREAM_NAME && {\n \"faas.instance\": env.AWS_LAMBDA_LOG_STREAM_NAME,\n }),\n ...(env.AWS_REGION\n ? { \"cloud.region\": env.AWS_REGION }\n : env.AWS_DEFAULT_REGION\n ? { \"cloud.region\": env.AWS_DEFAULT_REGION }\n : {}),\n});\n\nconst providerAttrs = (prov: string, env: PlatformEnv): Attrs =>\n Match.value(prov).pipe(\n Match.when(\"cloudflare_workers\", (): Attrs => ({\n \"cloud.provider\": \"cloudflare\",\n \"cloud.platform\": \"cloudflare.workers\",\n })),\n Match.when(\"cloudflare_pages\", (): Attrs => ({\n \"cloud.provider\": \"cloudflare\",\n \"cloud.platform\": \"cloudflare.pages\",\n })),\n Match.when(\"vercel\", (): Attrs => ({\n \"cloud.provider\": \"vercel\",\n \"cloud.platform\": \"vercel\",\n ...(env.VERCEL_REGION && { \"cloud.region\": env.VERCEL_REGION }),\n ...(env.VERCEL_DEPLOYMENT_ID && {\n \"faas.instance\": env.VERCEL_DEPLOYMENT_ID,\n }),\n })),\n Match.when(\"netlify\", (): Attrs => ({\n \"cloud.provider\": \"netlify\",\n \"cloud.platform\": \"netlify\",\n })),\n Match.whenOr(\"google_cloudrun\", \"google_cloudrun_job\", (): Attrs => ({\n \"cloud.provider\": \"gcp\",\n \"cloud.platform\": \"gcp_cloud_run\",\n ...(env.K_SERVICE && { \"faas.name\": env.K_SERVICE }),\n ...(env.K_REVISION && { \"faas.version\": env.K_REVISION }),\n ...(env.CLOUD_RUN_REGION && { \"cloud.region\": env.CLOUD_RUN_REGION }),\n })),\n Match.when(\"firebase_app_hosting\", (): Attrs => ({\n \"cloud.provider\": \"gcp\",\n \"cloud.platform\": \"gcp_firebase_app_hosting\",\n })),\n Match.when(\"aws_amplify\", (): Attrs => ({\n \"cloud.provider\": \"aws\",\n \"cloud.platform\": \"aws_amplify\",\n })),\n Match.when(\"deno-deploy\", (): Attrs => ({\n \"cloud.provider\": \"deno\",\n \"cloud.platform\": \"deno_deploy\",\n ...(env.DENO_REGION && { \"cloud.region\": env.DENO_REGION }),\n ...(env.DENO_DEPLOYMENT_ID && {\n \"faas.instance\": env.DENO_DEPLOYMENT_ID,\n }),\n })),\n Match.when(\"render\", (): Attrs => ({\n \"cloud.provider\": \"render\",\n \"cloud.platform\": \"render\",\n ...(env.RENDER_INSTANCE_ID && {\n \"faas.instance\": env.RENDER_INSTANCE_ID,\n }),\n })),\n Match.when(\"railway\", (): Attrs => ({\n \"cloud.provider\": \"railway\",\n \"cloud.platform\": \"railway\",\n ...(env.RAILWAY_REPLICA_ID && {\n \"faas.instance\": env.RAILWAY_REPLICA_ID,\n }),\n })),\n Match.when(\"edgeone_pages\", (): Attrs => ({\n \"cloud.provider\": \"tencent_cloud\",\n \"cloud.platform\": \"tencent_edgeone_pages\",\n })),\n Match.orElse((): Attrs => empty)\n );\n\nconst workerdFallback = (rt: string, alreadyResolved: boolean): Attrs =>\n rt === \"workerd\" && !alreadyResolved\n ? {\n \"cloud.provider\": \"cloudflare\",\n \"cloud.platform\": \"cloudflare.workers\",\n }\n : empty;\n\nconst vercelEdgeFallback = (\n rt: string,\n alreadyResolved: boolean,\n env: PlatformEnv\n): Attrs =>\n rt === \"edge-light\" && !alreadyResolved && env.VERCEL\n ? { \"cloud.provider\": \"vercel\", \"cloud.platform\": \"vercel\" }\n : empty;\n\nexport const derivePlatformAttributes = (\n inputs: PlatformInputs\n): PlatformAttributes => {\n const { runtime: rt, provider: prov, platform: plat, arch, env } = inputs;\n\n const cloudAttrs = env.AWS_LAMBDA_FUNCTION_NAME\n ? lambdaAttrs(env)\n : providerAttrs(prov, env);\n const cloudResolved = \"cloud.provider\" in cloudAttrs;\n\n return {\n ...(rt && { \"mxl.runtime\": rt }),\n ...(prov && { \"mxl.provider\": prov }),\n ...runtimeAttrs(rt),\n ...osAttrs(plat),\n ...archAttrs(arch),\n ...cloudAttrs,\n ...workerdFallback(rt, cloudResolved),\n ...vercelEdgeFallback(rt, cloudResolved, env),\n };\n};\n\nexport type PlatformAttributes = Attrs;\n\nconst PLATFORM_ENV_KEYS = [\n \"AWS_LAMBDA_FUNCTION_NAME\",\n \"AWS_LAMBDA_FUNCTION_VERSION\",\n \"AWS_LAMBDA_LOG_STREAM_NAME\",\n \"AWS_REGION\",\n \"AWS_DEFAULT_REGION\",\n \"VERCEL\",\n \"VERCEL_REGION\",\n \"VERCEL_DEPLOYMENT_ID\",\n \"K_SERVICE\",\n \"K_REVISION\",\n \"CLOUD_RUN_REGION\",\n \"DENO_REGION\",\n \"DENO_DEPLOYMENT_ID\",\n \"RENDER_INSTANCE_ID\",\n \"RAILWAY_REPLICA_ID\",\n] as const;\n\nexport const getAutoPlatformAttributes = (): PlatformAttributes => {\n const proc = (\n globalThis as { process?: { env?: Record<string, string>; arch?: string } }\n ).process;\n const procEnv = proc?.env ?? {};\n const env: PlatformEnv = {};\n for (const key of PLATFORM_ENV_KEYS) {\n const value = procEnv[key];\n if (value !== undefined) {\n (env as Record<string, string | undefined>)[key] = value;\n }\n }\n\n return derivePlatformAttributes({\n runtime: runtime ?? \"\",\n provider: provider ?? \"\",\n platform: platform ?? \"\",\n arch: proc?.arch ?? \"\",\n env,\n });\n};\n","import { v7 as uuidv7 } from \"uuid\";\nimport { Effect, Option } from \"effect\";\n\nimport * as EnvConfig from \"./config.js\";\nimport { getAutoPlatformAttributes } from \"./platform.js\";\n\nconst stringOrUndefined = (value: unknown): string | undefined =>\n typeof value === \"string\" && value.length > 0 ? value : undefined;\n\nconst DEFAULT_VCS_REPOSITORY_URL =\n \"https://gitlab.safaricom.co.ke/mxl/apm/mxl-effect-sdk\";\n\nfunction resolveCommitRevision(): string | undefined {\n return (\n stringOrUndefined(process.env[\"COMMIT_SHA\"]) ??\n stringOrUndefined(process.env[\"VERCEL_GIT_COMMIT_SHA\"]) ??\n stringOrUndefined(process.env[\"GITHUB_SHA\"]) ??\n stringOrUndefined(process.env[\"RAILWAY_GIT_COMMIT_SHA\"]) ??\n stringOrUndefined(process.env[\"CF_PAGES_COMMIT_SHA\"]) ??\n stringOrUndefined(process.env[\"RENDER_GIT_COMMIT\"])\n );\n}\n\nlet serviceInstanceId: string | undefined;\nconst getServiceInstanceId = (): string => (serviceInstanceId ??= uuidv7());\n\nexport interface ResourceConfigInput {\n readonly serviceName?: string | undefined;\n readonly serviceVersion?: string | undefined;\n readonly environment?: string | undefined;\n readonly endpoint?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly attributes?: Record<string, string> | undefined;\n readonly sdkType?: \"server\" | undefined;\n}\n\nexport interface ResolvedResource {\n readonly endpoint: string | undefined;\n readonly headers: Record<string, string> | undefined;\n readonly resource: {\n readonly serviceName: string;\n readonly serviceVersion: string | undefined;\n readonly attributes: Record<string, string>;\n };\n readonly environment: string | undefined;\n}\n\nexport const resolveResource = (\n config: ResourceConfigInput\n): Effect.Effect<ResolvedResource> =>\n Effect.gen(function* () {\n const disabled = yield* EnvConfig.sdkDisabled;\n if (disabled) {\n return {\n endpoint: undefined,\n environment: undefined,\n headers: undefined,\n resource: {\n attributes: {},\n serviceName: config.serviceName ?? \"unknown\",\n serviceVersion: undefined,\n },\n } satisfies ResolvedResource;\n }\n\n const envEndpoint = yield* EnvConfig.endpoint;\n const endpoint =\n config.endpoint ??\n Option.getOrUndefined(envEndpoint) ??\n EnvConfig.defaultOtlpEndpoint;\n\n const envHeaders = yield* EnvConfig.otlpHeaders;\n const headers =\n config.headers && Object.keys(config.headers).length > 0\n ? config.headers\n : Object.keys(envHeaders).length > 0\n ? envHeaders\n : undefined;\n\n const envServiceVersion = yield* EnvConfig.serviceVersion;\n const serviceVersion =\n config.serviceVersion ?? Option.getOrUndefined(envServiceVersion);\n\n const envEnvironment = yield* EnvConfig.environment;\n const environment = config.environment ?? envEnvironment;\n\n const envOtelServiceName = yield* EnvConfig.otelServiceName;\n const serviceName =\n config.serviceName ??\n Option.getOrUndefined(envOtelServiceName) ??\n \"unknown\";\n\n const envResourceAttributes = yield* EnvConfig.otelResourceAttributes;\n\n const attributes: Record<string, string> = {};\n Object.assign(attributes, getAutoPlatformAttributes());\n attributes[\"mxl.sdk.type\"] = config.sdkType ?? \"server\";\n attributes[\"service.instance.id\"] = getServiceInstanceId();\n if (environment) {\n attributes[\"deployment.environment\"] = environment;\n attributes[\"deployment.environment.name\"] = environment;\n }\n if (serviceVersion) {\n attributes[\"service.version\"] = serviceVersion;\n }\n const commitRevision = resolveCommitRevision();\n if (commitRevision) {\n attributes[\"deployment.commit_sha\"] = commitRevision;\n attributes[\"vcs.ref.head.revision\"] = commitRevision;\n }\n attributes[\"vcs.repository.url.full\"] =\n stringOrUndefined(process.env[\"MXL_VCS_REPOSITORY_URL\"]) ??\n DEFAULT_VCS_REPOSITORY_URL;\n Object.assign(attributes, envResourceAttributes);\n if (config.attributes) Object.assign(attributes, config.attributes);\n\n return {\n endpoint,\n environment,\n headers,\n resource: { serviceName, serviceVersion, attributes },\n } satisfies ResolvedResource;\n }).pipe(Effect.orDie);\n","import type { Duration } from \"effect\";\nimport { Effect, Layer } from \"effect\";\nimport { FetchHttpClient } from \"effect/unstable/http\";\nimport { Otlp } from \"effect/unstable/observability\";\n\nimport { otelGlobalContextBridgeLayer } from \"./otel-context-bridge.js\";\nimport { normalizeOtlpBaseUrl } from \"./otlp.js\";\nimport { resolveResource } from \"./resource.js\";\n\nexport interface MxlConfig {\n readonly serviceName?: string | undefined;\n readonly serviceVersion?: string | undefined;\n readonly environment?: string | undefined;\n readonly endpoint?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly attributes?: Record<string, string> | undefined;\n readonly maxBatchSize?: number | undefined;\n readonly loggerExportInterval?: Duration.Input | undefined;\n readonly metricsExportInterval?: Duration.Input | undefined;\n readonly tracerExportInterval?: Duration.Input | undefined;\n readonly shutdownTimeout?: Duration.Input | undefined;\n}\n\n/**\n * Create an Effect Layer that provides OpenTelemetry traces, logs, and metrics\n * configured for MXL's OTLP collector.\n *\n * Returns a no-op layer when `OTEL_SDK_DISABLED=true`.\n *\n * Wraps the OTLP tracer with `otelGlobalContextBridgeLayer` via `provideMerge`.\n * Measured on effect@4.0.0-rc.117: `Otlp.layerJson({ tracerContext })` still\n * types the hook as `(primitive, span) => X` and Effect returns that result as\n * the evaluation, so the callback cannot call `~effect/Effect/evaluate` without\n * a `fiber`. `Layer.updateService` also cannot wrap a Tracer the OTLP layer\n * already provides. Keep the merge wrap until Effect passes fiber or evaluates\n * after a side-effect-only context hook.\n */\nexport const layer = (config: MxlConfig = {}) =>\n Layer.unwrap(\n Effect.gen(function* () {\n const resolved = yield* resolveResource({ ...config, sdkType: \"server\" });\n if (!resolved.endpoint) return Layer.empty;\n\n const otlp = Otlp.layerJson({\n baseUrl: normalizeOtlpBaseUrl(resolved.endpoint),\n headers: resolved.headers,\n resource: resolved.resource,\n maxBatchSize: config.maxBatchSize,\n loggerExportInterval: config.loggerExportInterval,\n metricsExportInterval: config.metricsExportInterval,\n tracerExportInterval: config.tracerExportInterval,\n shutdownTimeout: config.shutdownTimeout,\n }).pipe(Layer.provide(FetchHttpClient.layer));\n\n return otelGlobalContextBridgeLayer.pipe(Layer.provideMerge(otlp));\n })\n );\n","export type ProductEventSource = \"server\" | \"browser\";\n\nexport const MAX_EVENT_NAME_LENGTH = 80;\nexport const RESERVED_EVENT_NAMES = [\"session_start\", \"session_end\"] as const;\n\nexport interface ProductEventLine {\n readonly attributes: Record<string, string>;\n readonly group_id: string;\n readonly name: string;\n readonly page_path: string;\n readonly service_name: string;\n readonly session_id: string;\n readonly source: ProductEventSource;\n readonly timestamp: string;\n readonly traceparent?: string | undefined;\n readonly url: string;\n readonly user_id: string;\n readonly visitor_id: string;\n}\n\nexport interface TrackProps {\n readonly [key: string]: unknown;\n}\n\nexport interface TrackOptions {\n readonly attributes?: TrackProps | undefined;\n readonly groupId?: string | undefined;\n readonly pagePath?: string | undefined;\n readonly sessionId?: string | undefined;\n readonly timestamp?: Date | number | undefined;\n readonly traceparent?: string | undefined;\n readonly url?: string | undefined;\n readonly userId?: string | undefined;\n readonly visitorId?: string | undefined;\n}\n\nconst isReservedEventName = (name: string): boolean =>\n RESERVED_EVENT_NAMES.some((reserved) => reserved === name);\n\nexport const coerceTrackProps = (\n props: TrackProps | undefined\n): Record<string, string> => {\n if (props === undefined) {\n return {};\n }\n const attributes: Record<string, string> = {};\n for (const [key, value] of Object.entries(props)) {\n if (value === undefined) {\n continue;\n }\n attributes[key] = typeof value === \"string\" ? value : String(value);\n }\n return attributes;\n};\n\nexport const toEventTimestamp = (value: Date | number | undefined): string =>\n (value instanceof Date ? value : new Date(value ?? Date.now())).toISOString();\n\nexport const encodeProductEventLine = (input: {\n readonly name: string;\n readonly options?: TrackOptions | undefined;\n readonly serviceName: string;\n readonly source: ProductEventSource;\n}): ProductEventLine | undefined => {\n const trimmed = typeof input.name === \"string\" ? input.name.trim() : \"\";\n if (trimmed.length === 0 || isReservedEventName(trimmed)) {\n return undefined;\n }\n const options = input.options ?? {};\n return {\n attributes: coerceTrackProps(options.attributes),\n group_id: options.groupId ?? \"\",\n name: trimmed.slice(0, MAX_EVENT_NAME_LENGTH),\n page_path: options.pagePath ?? \"\",\n service_name: input.serviceName,\n session_id: options.sessionId ?? \"\",\n source: input.source,\n timestamp: toEventTimestamp(options.timestamp),\n traceparent: options.traceparent,\n url: options.url ?? \"\",\n user_id: options.userId ?? \"\",\n visitor_id: options.visitorId ?? \"\",\n };\n};\n\nexport const encodeNdjson = (lines: ReadonlyArray<ProductEventLine>): string =>\n `${lines.map((line) => JSON.stringify(line)).join(\"\\n\")}\\n`;\n","export const SDK_NAME = \"mxl-effect-sdk\";\nexport const SDK_VERSION = \"0.0.15\";\n","import {\n Cause,\n Context,\n Duration,\n Effect,\n Layer,\n ManagedRuntime,\n Option,\n Schedule,\n Schema,\n Semaphore,\n} from \"effect\";\nimport { FetchHttpClient, HttpClient, HttpClientRequest } from \"effect/unstable/http\";\nimport { SchemaJITCompiler } from \"effect/unstable/schema\";\n\nimport {\n encodeNdjson,\n encodeProductEventLine,\n type ProductEventLine,\n type TrackOptions,\n} from \"../shared/product-event.js\";\nimport { SDK_NAME, SDK_VERSION } from \"../version.js\";\n\nexport type { TrackOptions } from \"../shared/product-event.js\";\n\nconst DEFAULT_FLUSH_INTERVAL = Duration.seconds(5);\nconst DEFAULT_MAX_BATCH_SIZE = 100;\nconst MAX_BUFFERED_EVENTS = 1_000;\nconst WARN_INTERVAL_MS = 30_000;\nconst DEFAULT_BASKET_URL = \"http://127.0.0.1:8000\";\n\nexport interface MxlEventsConfig {\n readonly apiKey?: string | undefined;\n readonly clientId?: string | undefined;\n readonly endpoint?: string | undefined;\n readonly eventsPath?: string | undefined;\n readonly flushInterval?: Duration.Input | undefined;\n readonly maxBatchSize?: number | undefined;\n readonly serviceName?: string | undefined;\n}\n\nexport interface MxlEventsApi {\n readonly flush: Effect.Effect<void>;\n readonly track: (name: string, options?: TrackOptions) => Effect.Effect<void>;\n}\n\nexport class MxlEvents extends Context.Service<MxlEvents, MxlEventsApi>()(\n \"@safaricom-mxl/effect-sdk/MxlEvents\"\n) {}\n\nexport class ProductEventsPostError extends Schema.TaggedError<ProductEventsPostError>()(\n \"@safaricom-mxl/effect-sdk/ProductEventsPostError\",\n {\n cause: Schema.optionalKey(Schema.Defect()),\n message: Schema.String,\n status: Schema.optionalKey(Schema.Number),\n }\n) {}\n\nSchemaJITCompiler.enable(ProductEventsPostError.ast);\nconst stringOrUndefined = (value: string | undefined): string | undefined =>\n value && value.length > 0 ? value : undefined;\n\nconst resolveEventsConfig = (config: MxlEventsConfig) => {\n const endpoint = (\n config.endpoint ??\n process.env[\"MXL_BASKET_URL\"] ??\n DEFAULT_BASKET_URL\n ).replace(/\\/$/, \"\");\n return {\n apiKey: stringOrUndefined(config.apiKey ?? process.env[\"MXL_API_KEY\"]),\n clientId: stringOrUndefined(config.clientId ?? process.env[\"MXL_CLIENT_ID\"]),\n serviceName:\n config.serviceName ?? process.env[\"OTEL_SERVICE_NAME\"] ?? \"unknown\",\n url: `${endpoint}${config.eventsPath ?? \"/events\"}`,\n };\n};\n\nexport const make = Effect.fn(\"MxlEvents.make\")(function* (\n config: MxlEventsConfig = {}\n) {\n const resolved = resolveEventsConfig(config);\n const maxBatchSize = Math.max(1, config.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE);\n const client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk);\n const flushing = yield* Semaphore.make(1);\n\n let buffer: Array<ProductEventLine> = [];\n let warnedAboutName = false;\n let warnedAboutClient = false;\n let lastPostWarnAt = 0;\n\n const warnPost = (error: ProductEventsPostError): void => {\n const now = Date.now();\n if (now - lastPostWarnAt < WARN_INTERVAL_MS) return;\n lastPostWarnAt = now;\n console.warn(`[MxlEvents] ${error.message} (dropping batch)`, error.cause ?? \"\");\n };\n const warnMissingClient = (): void => {\n if (warnedAboutClient) return;\n warnedAboutClient = true;\n console.warn(\n \"[MxlEvents] no client id — set MXL_CLIENT_ID or pass `clientId`; dropping events\"\n );\n };\n const warnEmptyName = (): void => {\n if (warnedAboutName) return;\n warnedAboutName = true;\n console.warn(\"[MxlEvents] track() needs a non-empty event name; the call was ignored.\");\n };\n\n const post = (lines: ReadonlyArray<ProductEventLine>) => {\n const headers: Record<string, string> = {\n \"mxl-client-id\": resolved.clientId ?? \"\",\n \"mxl-sdk-name\": SDK_NAME,\n \"mxl-sdk-version\": SDK_VERSION,\n \"user-agent\": `${SDK_NAME}-server/${SDK_VERSION}`,\n };\n if (resolved.apiKey) {\n headers[\"mxl-api-key\"] = resolved.apiKey;\n }\n return HttpClientRequest.post(resolved.url).pipe(\n HttpClientRequest.setHeaders(headers),\n HttpClientRequest.bodyText(encodeNdjson(lines), \"application/x-ndjson\"),\n client.execute,\n Effect.asVoid,\n Effect.mapError((error) =>\n error.response !== undefined\n ? new ProductEventsPostError({\n message: `POST ${resolved.url} → ${error.response.status}`,\n status: error.response.status,\n })\n : new ProductEventsPostError({\n cause: error,\n message: `POST ${resolved.url} failed: ${error.message}`,\n })\n )\n );\n };\n\n const flush: Effect.Effect<void> = flushing.withPermits(1)(\n Effect.suspend(() => {\n if (buffer.length === 0) return Effect.void;\n const batch = buffer;\n buffer = [];\n if (resolved.clientId === undefined) {\n warnMissingClient();\n return Effect.void;\n }\n return post(batch).pipe(\n Effect.catchCause((cause) =>\n Effect.sync(() => {\n warnPost(\n Option.getOrElse(Cause.findErrorOption(cause), () =>\n new ProductEventsPostError({\n cause: Cause.squash(cause),\n message: `POST ${resolved.url} failed`,\n })\n )\n );\n })\n )\n );\n })\n );\n\n const track = (name: string, options: TrackOptions = {}): Effect.Effect<void> =>\n Effect.sync(() => {\n const line = encodeProductEventLine({\n name,\n options,\n serviceName: resolved.serviceName,\n source: \"server\",\n });\n if (line === undefined) {\n warnEmptyName();\n return false;\n }\n buffer.push(line);\n if (buffer.length > MAX_BUFFERED_EVENTS) {\n buffer.splice(0, buffer.length - MAX_BUFFERED_EVENTS);\n }\n return buffer.length >= maxBatchSize;\n }).pipe(\n Effect.flatMap((full) => (full ? Effect.forkDetach(flush) : Effect.void)),\n Effect.asVoid\n );\n\n const interval = config.flushInterval ?? DEFAULT_FLUSH_INTERVAL;\n if (Duration.toMillis(interval) > 0) {\n yield* Effect.forkScoped(flush.pipe(Effect.schedule(Schedule.spaced(interval))));\n }\n yield* Effect.addFinalizer(() => flush);\n\n return { flush, track } satisfies MxlEventsApi;\n});\n\nexport const layer = (config: MxlEventsConfig = {}): Layer.Layer<MxlEvents> =>\n Layer.effect(MxlEvents, make(config)).pipe(Layer.provide(FetchHttpClient.layer));\n\nexport interface MxlEventsHandle {\n readonly dispose: () => Promise<void>;\n readonly flush: () => Promise<void>;\n readonly track: (name: string, options?: TrackOptions) => void;\n}\n\nexport const makeHandle = (config: MxlEventsConfig = {}): MxlEventsHandle => {\n const runtime = ManagedRuntime.make(layer(config));\n const swallow = (promise: Promise<unknown>): Promise<void> =>\n promise.then(\n () => undefined,\n () => undefined\n );\n return {\n dispose: () => swallow(runtime.dispose()),\n flush: () =>\n swallow(\n runtime.runPromise(\n Effect.gen(function* () {\n const events = yield* MxlEvents;\n yield* events.flush;\n })\n )\n ),\n track: (name, options) => {\n void swallow(\n runtime.runPromise(\n Effect.gen(function* () {\n const events = yield* MxlEvents;\n yield* events.track(name, options);\n })\n )\n );\n },\n };\n};\n","import { Layer } from \"effect\";\n\nimport {\n type MxlEventsConfig,\n type MxlEventsHandle,\n layer as eventsLayer,\n makeHandle,\n} from \"./events.js\";\nimport type { MxlConfig } from \"./layer.js\";\nimport { layer as otelLayer } from \"./layer.js\";\n\nexport interface MxlFlushableConfig extends MxlConfig {\n readonly apiKey?: string | undefined;\n readonly autoFlushInterval?: number | false | undefined;\n readonly clientId?: string | undefined;\n readonly ingestUrl?: string | undefined;\n}\n\nexport interface FlushableTelemetry extends MxlEventsHandle {\n readonly layer: Layer.Layer<never, never, never>;\n}\n\nexport const make = (config: MxlFlushableConfig = {}): FlushableTelemetry => {\n const eventsConfig: MxlEventsConfig = {\n apiKey: config.apiKey,\n clientId: config.clientId,\n endpoint: config.ingestUrl,\n flushInterval:\n config.autoFlushInterval === false ? 0 : config.autoFlushInterval,\n serviceName: config.serviceName,\n };\n const handle = makeHandle(eventsConfig);\n return {\n dispose: handle.dispose,\n flush: handle.flush,\n layer: Layer.mergeAll(\n otelLayer(config),\n eventsLayer(eventsConfig)\n ) as Layer.Layer<never, never, never>,\n track: handle.track,\n };\n};\n","import { Layer } from \"effect\";\nimport { HttpMiddleware } from \"effect/unstable/http\";\n\nexport function shouldDisableHttpTrace(request: {\n url: string;\n method: string;\n}): boolean {\n return (\n request.method === \"OPTIONS\" ||\n request.url === \"/health\" ||\n request.url === \"/healthcheck\" ||\n request.url.startsWith(\"/healthz\") ||\n request.url === \"/metrics\" ||\n /\\.(png|ico|jpg|jpeg|gif|css|js|svg|webp|woff2?)(\\?.*)?$/i.test(request.url)\n );\n}\n\nexport function tracerDisabledWhenLayer(\n filter: (request: {\n url: string;\n method: string;\n }) => boolean = shouldDisableHttpTrace\n) {\n return Layer.succeed(HttpMiddleware.TracerDisabledWhen, filter);\n}\n","import { context as otelContext, trace as traceApi } from \"@opentelemetry/api\";\nimport { Effect } from \"effect\";\nimport * as Option from \"effect/Option\";\n\nexport interface TraceCorrelation {\n spanId?: string;\n traceId?: string;\n}\n\nexport interface TraceLogAnnotations extends Record<string, string> {}\n\nconst ZERO_TRACE_ID = \"00000000000000000000000000000000\";\nconst ZERO_SPAN_ID = \"0000000000000000\";\n\n/** Parse W3C `traceparent` (`00-{traceId}-{spanId}-{flags}`). */\nexport function parseTraceparent(\n traceparent: string | undefined\n): TraceCorrelation {\n if (!traceparent) return {};\n const parts = traceparent.trim().split(\"-\");\n if (parts.length < 4) return {};\n const traceId = parts[1];\n const spanId = parts[2];\n if (!traceId || !spanId) return {};\n if (traceId.length !== 32 || spanId.length !== 16) return {};\n if (traceId === ZERO_TRACE_ID || spanId === ZERO_SPAN_ID) return {};\n return { spanId, traceId };\n}\n\n/**\n * Resolve trace/span IDs for log correlation.\n *\n * Prefers the active OpenTelemetry span (when a host bridge or queue propagation\n * is active), then falls back to a W3C `traceparent` carrier.\n */\nexport function getEffectTraceCorrelation(options?: {\n traceparent?: string | undefined;\n}): TraceCorrelation {\n const activeSpan = traceApi.getSpan(otelContext.active());\n if (activeSpan) {\n const spanContext = activeSpan.spanContext();\n if (\n spanContext.traceId &&\n spanContext.traceId !== ZERO_TRACE_ID &&\n spanContext.spanId &&\n spanContext.spanId !== ZERO_SPAN_ID\n ) {\n return {\n spanId: spanContext.spanId,\n traceId: spanContext.traceId,\n };\n }\n }\n\n return parseTraceparent(options?.traceparent);\n}\n\n/** Build log annotation fields from active span correlation. */\nexport function traceCorrelationLogAnnotations(\n options?: {\n traceparent?: string | undefined;\n } & Record<string, string>\n): TraceLogAnnotations {\n const { traceparent, ...extra } = options ?? {};\n const correlation = getEffectTraceCorrelation({ traceparent });\n const annotations: TraceLogAnnotations = { ...extra };\n\n if (correlation.traceId) {\n annotations[\"trace.trace_id\"] = correlation.traceId;\n annotations[\"trace_id\"] = correlation.traceId;\n }\n if (correlation.spanId) {\n annotations[\"trace.span_id\"] = correlation.spanId;\n annotations[\"span_id\"] = correlation.spanId;\n }\n\n return annotations;\n}\n\n/** Annotate Effect logs with the active span's trace/span IDs. */\nexport function annotateLogsWithActiveSpanCorrelation<A, E, R>(\n program: Effect.Effect<A, E, R>,\n fields?: Record<string, string>\n): Effect.Effect<A, E, R> {\n return Effect.gen(function* () {\n const { traceparent, ...extra } = fields ?? {};\n const annotations: TraceLogAnnotations = { ...extra };\n\n const currentSpan = yield* Effect.currentSpan.pipe(Effect.option);\n if (Option.isSome(currentSpan)) {\n annotations[\"trace.trace_id\"] = currentSpan.value.traceId;\n annotations[\"trace_id\"] = currentSpan.value.traceId;\n annotations[\"trace.span_id\"] = currentSpan.value.spanId;\n annotations[\"span_id\"] = currentSpan.value.spanId;\n } else {\n Object.assign(\n annotations,\n traceCorrelationLogAnnotations({\n ...(traceparent !== undefined ? { traceparent } : {}),\n ...extra,\n })\n );\n }\n\n if (Object.keys(annotations).length === 0) {\n return yield* program;\n }\n\n return yield* program.pipe(Effect.annotateLogs(annotations));\n });\n}\n","import { Effect, Layer, References } from \"effect\";\n\nexport type EffectLogLevel = \"Debug\" | \"Info\" | \"Warn\" | \"Error\" | \"Fatal\";\n\nexport interface SerializedLogError {\n readonly message: string;\n readonly name: string;\n readonly stack?: string;\n readonly cause?: SerializedLogError;\n}\n\nconst LOG_LEVEL_BY_ENV: Record<string, EffectLogLevel> = {\n trace: \"Debug\",\n debug: \"Debug\",\n info: \"Info\",\n warn: \"Warn\",\n warning: \"Warn\",\n error: \"Error\",\n fatal: \"Fatal\",\n};\n\nexport function resolveLogLevelFromEnv(\n env: NodeJS.ProcessEnv = process.env\n): EffectLogLevel {\n const raw = env[\"OTEL_LOG_LEVEL\"] ?? env[\"LOG_LEVEL\"] ?? \"info\";\n return LOG_LEVEL_BY_ENV[raw.trim().toLowerCase()] ?? \"Info\";\n}\n\nfunction isFiniteHttpStatus(status: number | undefined): status is number {\n return typeof status === \"number\" && Number.isFinite(status) && status >= 0;\n}\n\n/** Map HTTP status to Effect log level for response/failure logs. */\nexport function resolveEffectLogLevelFromHttpStatus(\n status: number | undefined\n): EffectLogLevel {\n if (!isFiniteHttpStatus(status) || status < 400) {\n return \"Info\";\n }\n\n if (status >= 500) {\n return \"Error\";\n }\n\n return \"Warn\";\n}\n\nexport type HttpLogOutcome = \"error\" | \"success\";\n\nexport interface HttpStatusLogFields {\n readonly \"http.response.status_code\": string;\n readonly \"http.status\": string;\n readonly \"log.level\": \"error\" | \"info\" | \"warn\";\n readonly outcome: HttpLogOutcome;\n}\n\n/** Standard log fields for HTTP response correlation in OTEL drains. */\nexport function buildHttpStatusLogFields(\n status: number | undefined\n): Partial<HttpStatusLogFields> {\n const level = resolveEffectLogLevelFromHttpStatus(status);\n const outcome: HttpLogOutcome =\n isFiniteHttpStatus(status) && status >= 400 ? \"error\" : \"success\";\n const logLevel =\n level === \"Error\" ? \"error\" : level === \"Warn\" ? \"warn\" : \"info\";\n\n if (!isFiniteHttpStatus(status)) {\n return {\n \"log.level\": logLevel,\n outcome,\n };\n }\n\n const statusText = String(status);\n return {\n \"http.response.status_code\": statusText,\n \"http.status\": statusText,\n \"log.level\": logLevel,\n outcome,\n };\n}\n\n/** Filter Effect logs below the configured minimum level. */\nexport function minimumLogLevelLayer(\n level: EffectLogLevel = resolveLogLevelFromEnv()\n): Layer.Layer<never> {\n return Layer.succeed(References.MinimumLogLevel, level);\n}\n\nfunction resolveErrorMessage(error: Error): string {\n if (error.message.trim().length > 0) {\n return error.message;\n }\n\n if (error.cause !== undefined) {\n if (error.cause instanceof Error && error.cause.message.trim().length > 0) {\n return error.cause.message;\n }\n\n if (typeof error.cause === \"string\" && error.cause.trim().length > 0) {\n return error.cause;\n }\n }\n\n if (\n \"reason\" in error &&\n typeof error.reason === \"string\" &&\n error.reason.trim().length > 0\n ) {\n return error.reason;\n }\n\n return error.name;\n}\n\nexport function serializeLogError(error: unknown): SerializedLogError {\n if (error instanceof Error) {\n return {\n message: resolveErrorMessage(error),\n name: error.name,\n ...(error.stack ? { stack: error.stack } : {}),\n ...(error.message.trim().length === 0 && error.cause !== undefined\n ? { cause: serializeLogError(error.cause) }\n : {}),\n };\n }\n\n return {\n message: String(error),\n name: \"UnknownError\",\n };\n}\n\nfunction annotateFields(\n fields: Record<string, unknown> | undefined\n): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> {\n if (!fields || Object.keys(fields).length === 0) {\n return (effect) => effect;\n }\n\n const serialized = Object.fromEntries(\n Object.entries(fields).map(([key, value]) => [\n key,\n value instanceof Error ? serializeLogError(value) : value,\n ])\n );\n\n return (effect) => effect.pipe(Effect.annotateLogs(serialized));\n}\n\nexport function logDebug(\n message: string,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n return annotateFields(fields)(Effect.logDebug(message));\n}\n\nexport function logInfo(\n message: string,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n return annotateFields(fields)(Effect.logInfo(message));\n}\n\nexport function logWarning(\n message: string,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n return annotateFields(fields)(Effect.logWarning(message));\n}\n\nexport function logError(\n message: string,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n return annotateFields(fields)(Effect.logError(message));\n}\n\nexport function logAtLevel(\n level: EffectLogLevel,\n message: string,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n switch (level) {\n case \"Debug\":\n return logDebug(message, fields);\n case \"Info\":\n return logInfo(message, fields);\n case \"Warn\":\n return logWarning(message, fields);\n case \"Error\":\n case \"Fatal\":\n return logError(message, fields);\n }\n}\n","import * as OtelTracer from \"@effect/opentelemetry/OtelTracer\";\nimport {\n context as otelContext,\n propagation,\n SpanStatusCode,\n trace as traceApi,\n TraceFlags,\n type SpanContext,\n} from \"@opentelemetry/api\";\nimport { Effect } from \"effect\";\nimport * as Option from \"effect/Option\";\n\nimport {\n buildHttpStatusLogFields,\n logAtLevel,\n logError,\n resolveEffectLogLevelFromHttpStatus,\n serializeLogError,\n} from \"./logging.js\";\nimport { buildTraceCarrierFromSpan } from \"./otel-context-bridge.js\";\nimport { annotateLogsWithActiveSpanCorrelation } from \"./trace-correlation.js\";\nimport { parseTraceparent } from \"./trace-correlation.js\";\n\nfunction headerValue(\n value: string | ReadonlyArray<string> | undefined\n): string | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"string\" ? value : value[0];\n}\n\nexport function spanContextFromTraceparent(\n traceparent: string | undefined\n): SpanContext | undefined {\n const { traceId, spanId } = parseTraceparent(traceparent);\n if (!traceId || !spanId) return undefined;\n\n return {\n isRemote: true,\n spanId,\n traceFlags: TraceFlags.SAMPLED,\n traceId,\n };\n}\n\nexport function resolveTraceparentFromHeaders(\n headers: Record<string, string | ReadonlyArray<string> | undefined>\n): string | undefined {\n return headerValue(headers[\"traceparent\"]);\n}\n\nexport function withParentFromTraceparent<A, E, R>(\n headers: Record<string, string | ReadonlyArray<string> | undefined>,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R> {\n const parentSpanContext = spanContextFromTraceparent(\n resolveTraceparentFromHeaders(headers)\n );\n\n if (parentSpanContext === undefined) {\n return program;\n }\n\n return OtelTracer.withSpanContext(program, parentSpanContext);\n}\n\nexport interface HttpSpanAttributes {\n readonly method: string;\n readonly route: string;\n readonly requestId?: string | undefined;\n readonly url?: string | undefined;\n}\n\nexport interface QueueTraceContextCarrier {\n readonly baggage?: string;\n readonly traceparent?: string;\n readonly tracestate?: string;\n}\n\nfunction toSpanAttributes(\n attributes: HttpSpanAttributes\n): Record<string, string> {\n const result: Record<string, string> = {\n \"http.request.method\": attributes.method,\n \"http.route\": attributes.route,\n \"url.path\": attributes.route,\n };\n\n if (attributes.requestId !== undefined) {\n result[\"http.request_id\"] = attributes.requestId;\n result[\"request.id\"] = attributes.requestId;\n }\n\n if (attributes.url !== undefined) {\n result[\"url.full\"] = attributes.url;\n }\n\n return result;\n}\n\nexport function withHttpServerSpan<A, E, R>(\n name: string,\n attributes: HttpSpanAttributes,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R> {\n return program.pipe(\n Effect.withSpan(name, {\n attributes: toSpanAttributes(attributes),\n kind: \"server\",\n }),\n Effect.withLogSpan(name)\n );\n}\n\nexport function finalizeHttpSpan(\n status: number,\n route?: string\n): Effect.Effect<void> {\n const annotations: Record<string, string | number> = {\n \"http.response.status_code\": status,\n };\n\n if (route !== undefined) {\n annotations[\"http.route\"] = route;\n annotations[\"url.path\"] = route;\n }\n\n return Effect.sync(() => {\n if (status >= 500) {\n const activeSpan = traceApi.getActiveSpan();\n activeSpan?.setStatus({\n code: SpanStatusCode.ERROR,\n message: String(status),\n });\n }\n }).pipe(Effect.andThen(() => Effect.annotateCurrentSpan(annotations)));\n}\n\nexport interface LogHttpResponseOptions {\n readonly status: number;\n readonly durationMs?: number | undefined;\n readonly method?: string | undefined;\n readonly url?: string | undefined;\n readonly route?: string | undefined;\n readonly error?: unknown;\n readonly traceparent?: string | undefined;\n}\n\nfunction stringifyLogFieldValue(value: unknown): string {\n if (value === undefined) {\n return \"\";\n }\n return String(value);\n}\n\nfunction buildHttpResponseLogFields(\n options: LogHttpResponseOptions\n): Record<string, unknown> {\n const fields: Record<string, unknown> = {\n ...buildHttpStatusLogFields(options.status),\n ...(options.durationMs === undefined\n ? {}\n : { durationMs: options.durationMs }),\n ...(options.method === undefined\n ? {}\n : { \"http.request.method\": options.method }),\n ...(options.url === undefined ? {} : { \"url.full\": options.url }),\n ...(options.route === undefined ? {} : { \"http.route\": options.route }),\n ...(options.route === undefined ? {} : { \"url.path\": options.route }),\n ...(options.traceparent === undefined\n ? {}\n : { traceparent: options.traceparent }),\n };\n\n if (options.error !== undefined) {\n fields[\"error\"] = serializeLogError(options.error);\n }\n\n return fields;\n}\n\n/** Log an HTTP response at info/warn/error severity based on status code. */\nexport function logHttpResponse(\n message: string,\n options: LogHttpResponseOptions\n): Effect.Effect<void> {\n const level = resolveEffectLogLevelFromHttpStatus(options.status);\n const fields = buildHttpResponseLogFields(options);\n const correlationFields = Object.fromEntries(\n Object.entries(fields)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, stringifyLogFieldValue(value)])\n );\n\n return annotateLogsWithActiveSpanCorrelation(\n logAtLevel(level, message, fields),\n correlationFields\n );\n}\n\nexport function logHttpRequestFailure(\n message: string,\n error: unknown,\n fields?: Record<string, unknown>\n): Effect.Effect<void> {\n const logFields: Record<string, string> = {};\n if (fields) {\n for (const [key, value] of Object.entries(fields)) {\n if (value !== undefined) {\n logFields[key] = String(value);\n }\n }\n }\n\n return annotateLogsWithActiveSpanCorrelation(\n logError(message, {\n error: serializeLogError(error),\n ...fields,\n }),\n logFields\n );\n}\n\nfunction normalizeHeaderRecord(\n headers: Record<string, string | ReadonlyArray<string> | undefined>\n): Record<string, string> {\n const normalized: Record<string, string> = {};\n for (const [key, value] of Object.entries(headers)) {\n if (value === undefined) continue;\n normalized[key.toLowerCase()] =\n typeof value === \"string\" ? value : (value[0] ?? \"\");\n }\n return normalized;\n}\n\nfunction normalizeCarrierRecord(\n carrier: QueueTraceContextCarrier | Record<string, string> | undefined\n): Record<string, string> | undefined {\n if (!carrier) return undefined;\n const normalized: Record<string, string> = {};\n for (const [key, value] of Object.entries(carrier)) {\n if (value === undefined || value === \"\") continue;\n normalized[key.toLowerCase()] = value;\n }\n return Object.keys(normalized).length > 0 ? normalized : undefined;\n}\n\n/** Resolve parent span context from a W3C trace carrier. */\nexport function spanContextFromCarrier(\n carrier: QueueTraceContextCarrier | Record<string, string> | undefined\n): SpanContext | undefined {\n const normalized = normalizeCarrierRecord(carrier);\n if (!normalized) return undefined;\n\n const extracted = propagation.extract(otelContext.active(), normalized);\n const spanContext = traceApi.getSpan(extracted)?.spanContext();\n if (\n spanContext?.traceId &&\n spanContext.traceId !== \"00000000000000000000000000000000\" &&\n spanContext.spanId &&\n spanContext.spanId !== \"0000000000000000\"\n ) {\n return spanContext;\n }\n\n return spanContextFromTraceparent(normalized[\"traceparent\"]);\n}\n\nexport function withParentFromTraceCarrier<A, E, R>(\n carrier: QueueTraceContextCarrier | Record<string, string> | undefined,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R> {\n const parentSpanContext = spanContextFromCarrier(carrier);\n if (parentSpanContext === undefined) {\n return program;\n }\n return OtelTracer.withSpanContext(program, parentSpanContext);\n}\n\n/** Build W3C trace carrier for queue/job propagation from request headers + active OTel context. */\nexport function buildQueueTraceCarrier(\n headers?: Record<string, string | ReadonlyArray<string> | undefined>\n): Record<string, string> | undefined {\n const normalized = headers ? normalizeHeaderRecord(headers) : {};\n const parentContext = propagation.extract(otelContext.active(), normalized);\n const carrier: Record<string, string> = {};\n propagation.inject(parentContext, carrier);\n return Object.keys(carrier).length > 0 ? carrier : undefined;\n}\n\n/** Build W3C trace carrier using the active Effect span when available. */\nexport function buildQueueTraceCarrierEffect(\n headers?: Record<string, string | ReadonlyArray<string> | undefined>\n): Effect.Effect<Record<string, string> | undefined> {\n return Effect.gen(function* () {\n const normalized = headers ? normalizeHeaderRecord(headers) : {};\n const currentSpan = yield* Effect.currentSpan.pipe(Effect.option);\n\n if (Option.isSome(currentSpan)) {\n return buildTraceCarrierFromSpan(currentSpan.value, normalized);\n }\n\n return buildQueueTraceCarrier(headers);\n });\n}\n","import * as OtelTracer from \"@effect/opentelemetry/OtelTracer\";\nimport type { SpanContext } from \"@opentelemetry/api\";\nimport { Effect, type ManagedRuntime } from \"effect\";\n\nimport {\n type QueueTraceContextCarrier,\n spanContextFromCarrier,\n} from \"./http-tracing.js\";\nimport { logError, logInfo, serializeLogError } from \"./logging.js\";\nimport { annotateLogsWithActiveSpanCorrelation } from \"./trace-correlation.js\";\n\nexport interface RunJobWithSpanOptions {\n readonly name: string;\n readonly attributes?: Record<string, string> | undefined;\n readonly parentSpanContext?: SpanContext | undefined;\n readonly parentTraceCarrier?:\n | QueueTraceContextCarrier\n | Record<string, string>\n | undefined;\n readonly logAttributes?: Record<string, string> | undefined;\n}\n\nfunction resolveParentSpanContext(\n options: RunJobWithSpanOptions\n): SpanContext | undefined {\n if (options.parentSpanContext !== undefined) {\n return options.parentSpanContext;\n }\n return spanContextFromCarrier(options.parentTraceCarrier);\n}\n\nexport function jobWithSpanEffect<A, E, R>(\n options: RunJobWithSpanOptions,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R> {\n const parentSpanContext = resolveParentSpanContext(options);\n const startedAt = Date.now();\n\n let wrapped = program.pipe(\n Effect.tap(() =>\n logInfo(\"Job completed\", {\n durationMs: Date.now() - startedAt,\n \"job.name\": options.name,\n outcome: \"success\",\n ...options.logAttributes,\n })\n ),\n Effect.tapError((error) =>\n logError(\"Job failed\", {\n durationMs: Date.now() - startedAt,\n error: serializeLogError(error),\n \"job.name\": options.name,\n outcome: \"error\",\n ...options.logAttributes,\n })\n ),\n (effect) =>\n annotateLogsWithActiveSpanCorrelation(effect, {\n \"job.name\": options.name,\n ...options.logAttributes,\n }),\n Effect.withLogSpan(options.name),\n Effect.withSpan(options.name, {\n attributes: options.attributes,\n kind: \"consumer\",\n })\n );\n\n if (parentSpanContext !== undefined) {\n wrapped = OtelTracer.withSpanContext(wrapped, parentSpanContext);\n }\n\n return wrapped;\n}\n\nexport function runJobWithSpan<A, E, R>(\n runtime: ManagedRuntime.ManagedRuntime<R, unknown>,\n options: RunJobWithSpanOptions,\n program: Effect.Effect<A, E>\n): Promise<A> {\n return runtime.runPromise(jobWithSpanEffect(options, program));\n}\n","import {\n getEffectTraceCorrelation,\n parseTraceparent,\n} from \"./trace-correlation.js\";\n\n/** Minimal evlog enricher context (compatible with `evlog` EnrichContext). */\nexport interface EffectTraceEnrichContext {\n readonly event: Record<string, unknown>;\n readonly headers?: Record<string, string> | undefined;\n}\n\nexport interface EffectTraceEnricherOptions {\n readonly overwrite?: boolean | undefined;\n}\n\nfunction headerValue(\n headers: Record<string, string> | undefined,\n name: string\n): string | undefined {\n if (!headers) return undefined;\n const direct = headers[name];\n if (direct !== undefined) return direct;\n const lower = headers[name.toLowerCase()];\n if (lower !== undefined) return lower;\n return undefined;\n}\n\nfunction assignTraceFields(\n event: Record<string, unknown>,\n traceId: string,\n spanId: string,\n overwrite: boolean\n): void {\n if (overwrite || event[\"trace_id\"] === undefined) {\n event[\"trace_id\"] = traceId;\n }\n if (overwrite || event[\"span_id\"] === undefined) {\n event[\"span_id\"] = spanId;\n }\n if (overwrite || event[\"traceId\"] === undefined) {\n event[\"traceId\"] = traceId;\n }\n if (overwrite || event[\"spanId\"] === undefined) {\n event[\"spanId\"] = spanId;\n }\n\n const trace =\n typeof event[\"trace\"] === \"object\" && event[\"trace\"] !== null\n ? (event[\"trace\"] as Record<string, unknown>)\n : {};\n\n if (overwrite || trace[\"trace_id\"] === undefined) {\n trace[\"trace_id\"] = traceId;\n }\n if (overwrite || trace[\"span_id\"] === undefined) {\n trace[\"span_id\"] = spanId;\n }\n\n if (Object.keys(trace).length > 0) {\n event[\"trace\"] = trace;\n }\n}\n\n/**\n * Enrich evlog wide events with trace/span IDs from OTel global context or W3C headers.\n *\n * Use `createEffectTraceEnricher` in the MXL evlog enricher chain.\n */\nexport function createEffectTraceEnricher(\n options: EffectTraceEnricherOptions = {}\n): (ctx: EffectTraceEnrichContext) => void {\n const overwrite = options.overwrite ?? false;\n\n return (ctx) => {\n const traceparent = headerValue(ctx.headers, \"traceparent\");\n const correlation = getEffectTraceCorrelation({ traceparent });\n\n if (correlation.traceId && correlation.spanId) {\n assignTraceFields(\n ctx.event,\n correlation.traceId,\n correlation.spanId,\n overwrite\n );\n return;\n }\n\n const parsed = parseTraceparent(traceparent);\n if (parsed.traceId && parsed.spanId) {\n assignTraceFields(ctx.event, parsed.traceId, parsed.spanId, overwrite);\n }\n };\n}\n","import {\n context as otelContext,\n propagation,\n SpanKind,\n SpanStatusCode,\n trace as traceApi,\n} from \"@opentelemetry/api\";\nimport { Effect } from \"effect\";\n\nexport type DbSystem = \"clickhouse\" | \"postgresql\" | \"redis\";\n\nexport type DependencySpanKind = \"client\" | \"producer\" | \"consumer\";\n\nconst MAX_FLUSH_SPAN_LINKS = 32;\n\nexport interface QueueTraceContextCarrier {\n readonly traceparent?: string | undefined;\n readonly tracestate?: string | undefined;\n readonly baggage?: string | undefined;\n}\n\nexport function dbClientSpanAttributes(\n dbSystem: DbSystem,\n operation?: string\n): Record<string, string> {\n return {\n \"db.system\": dbSystem,\n \"db.system.name\": dbSystem,\n \"peer.service\": dbSystem,\n ...(operation ? { \"db.operation.name\": operation } : {}),\n };\n}\n\nexport function queueProducerSpanAttributes(\n destinationName: string,\n peerService = \"mxl-worker\"\n): Record<string, string> {\n return {\n \"messaging.destination.name\": destinationName,\n \"messaging.system\": \"bullmq\",\n \"peer.service\": peerService,\n };\n}\n\nexport function queueConsumerSpanAttributes(\n destinationName: string\n): Record<string, string> {\n return {\n \"messaging.destination.name\": destinationName,\n \"messaging.system\": \"bullmq\",\n };\n}\n\nexport function kafkaProducerSpanAttributes(\n topic: string,\n peerService = \"kafka\"\n): Record<string, string> {\n return {\n \"messaging.destination.name\": topic,\n \"messaging.system\": \"kafka\",\n \"peer.service\": peerService,\n };\n}\n\nexport function bufferSpanAttributes(\n bufferName: string,\n operation: string\n): Record<string, string> {\n return {\n \"buffer.name\": bufferName,\n \"db.operation.name\": operation,\n \"db.system\": \"redis\",\n \"db.system.name\": \"redis\",\n \"peer.service\": \"redis\",\n };\n}\n\nexport function geoSpanAttributes(): Record<string, string> {\n return {\n \"db.operation.name\": \"resolve\",\n \"db.system\": \"maxmind\",\n \"db.system.name\": \"maxmind\",\n \"peer.service\": \"maxmind\",\n };\n}\n\nexport function addSpanLinksFromTraceCarriers(\n carriers: readonly QueueTraceContextCarrier[]\n): number {\n const span = traceApi.getActiveSpan();\n if (!span) {\n return 0;\n }\n\n const seen = new Set<string>();\n let linked = 0;\n\n for (const carrier of carriers) {\n if (!carrier.traceparent || seen.has(carrier.traceparent)) {\n continue;\n }\n seen.add(carrier.traceparent);\n\n const extracted = propagation.extract(otelContext.active(), carrier);\n const linkedContext = traceApi.getSpanContext(extracted);\n if (!linkedContext) {\n continue;\n }\n\n span.addLink({ context: linkedContext });\n linked += 1;\n\n if (linked >= MAX_FLUSH_SPAN_LINKS) {\n break;\n }\n }\n\n return linked;\n}\n\nexport interface WithDependencySpanOptions {\n readonly attributes?: Record<string, string> | undefined;\n readonly kind?: DependencySpanKind | undefined;\n}\n\nexport function withDependencySpan<A, E, R>(\n name: string,\n attributes: Record<string, string>,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R>;\nexport function withDependencySpan<A, E, R>(\n name: string,\n options: WithDependencySpanOptions,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R>;\nexport function withDependencySpan<A, E, R>(\n name: string,\n attributesOrOptions: Record<string, string> | WithDependencySpanOptions,\n program: Effect.Effect<A, E, R>\n): Effect.Effect<A, E, R> {\n const options = isWithDependencySpanOptions(attributesOrOptions)\n ? attributesOrOptions\n : { attributes: attributesOrOptions };\n\n const attributes = options.attributes ?? {};\n const kind: DependencySpanKind = options.kind ?? \"client\";\n\n return program.pipe(Effect.withSpan(name, { attributes, kind }));\n}\n\nfunction isWithDependencySpanOptions(\n value: Record<string, string> | WithDependencySpanOptions\n): value is WithDependencySpanOptions {\n return (\n typeof value === \"object\" &&\n (\"kind\" in value ||\n (\"attributes\" in value && typeof value.attributes === \"object\"))\n );\n}\n\n/** Promise-based dependency span for non-Effect code paths. */\nexport async function withPromiseDependencySpan<T>(\n name: string,\n attributes: Record<string, string>,\n operation: () => Promise<T>,\n kind: DependencySpanKind = \"client\"\n): Promise<T> {\n const tracer = traceApi.getTracer(\"mxl-effect-sdk\");\n const spanKind =\n kind === \"producer\"\n ? SpanKind.PRODUCER\n : kind === \"consumer\"\n ? SpanKind.CONSUMER\n : SpanKind.CLIENT;\n return tracer.startActiveSpan(\n name,\n { attributes, kind: spanKind },\n async (span) => {\n try {\n const result = await operation();\n span.end();\n return result;\n } catch (error) {\n if (error instanceof Error) {\n span.recordException(error);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: error.message,\n });\n } else {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: String(error),\n });\n }\n span.end();\n throw error;\n }\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,MAAM,WAAW;AAEjB,IAAI,0BAA0B;;;;;AAM9B,SAAgB,2BAAiC;CAC/C,IAAI,yBAAyB;CAC7B,MAAM,UAAU,IAAI,gCAAgC;CACpD,QAAQ,OAAO;CACf,IAAI,CAAC,KAAK,QAAQ,wBAAwB,OAAO,GAAG;EAClD,QAAQ,QAAQ;EAChB,0BAA0B;EAC1B;CACF;CACA,0BAA0B;AAC5B;AAEA,SAAgB,kBAAkB,MAA8B;CAC9D,MAAM,QAAQ,KAAK,UAAU,OAAO;CACpC,OAAO,MAAM,KAAK,QAAQ,GAAG,KAAK,OAAO,GAAG;AAC9C;AAEA,SAAgB,0BACd,MACA,SACwB;CACxB,MAAM,UAAkC,EACtC,aAAa,kBAAkB,IAAI,EACrC;CAEA,IAAI,UAAU,eACZ,QAAQ,gBAAgB,QAAQ;CAElC,IAAI,UAAU,YACZ,QAAQ,aAAa,QAAQ;CAG/B,OAAO;AACT;;;;;;;AAQA,SAAgB,wBACd,eACA,MACc;CACd,OAAO,KAAK,MAAM,eAAe,eAAe;EAC9C,UAAU,KAAK,SAAS;EACxB,QAAQ,KAAK;EACb,YAAY,KAAK,UAAU,KAAK,WAAW,UAAU,KAAK,WAAW;EACrE,SAAS,KAAK;CAChB,CAAC;AACH;;;;;;;;;AAUA,SAAgB,gCACd,MACe;CACf,yBAAyB;CACzB,MAAM,kBAAkB,KAAK;CAE7B,OAAO,OAAO,KAAK;EACjB,KAAK,SAAS;GACZ,OAAO,KAAK,KAAK,OAAO;EAC1B;EACA,QAAQ,WAAW,OAAO;GACxB,IAAI,MAAM,MAAM,SAAS,KAAA,GAAW;IAClC,IAAI,iBACF,OAAO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AS,4BACP,OACoC;CACpC,OACE,OAAO,UAAU,aAChB,UAAU,SACR,gBAAgB,SAAS,OAAO,MAAM,eAAe;AAE5D;;AAGA,eAAsB,0BACpB,MACA,YACA,WACA,OAA2B,UACf;CACZ,MAAM,SAASA,MAAS,UAAU,gBAAgB;CAClD,MAAM,WACJ,SAAS,aACL,SAAS,WACT,SAAS,aACP,SAAS,WACT,SAAS;CACjB,OAAO,OAAO,gBACZ,MACA;EAAE;EAAY,MAAM;CAAS,GAC7B,OAAO,SAAS;EACd,IAAI;GACF,MAAM,SAAS,MAAM,UAAU;GAC/B,KAAK,IAAI;GACT,OAAO;EACT,SAAS,OAAO;GACd,IAAI,iBAAiB,OAAO;IAC1B,KAAK,gBAAgB,KAAK;IAC1B,KAAK,UAAU;KACb,MAAM,eAAe;KACrB,SAAS,MAAM;IACjB,CAAC;GACH,OACE,KAAK,UAAU;IACb,MAAM,eAAe;IACrB,SAAS,OAAO,KAAK;GACvB,CAAC;GAEH,KAAK,IAAI;GACT,MAAM;EACR;CACF,CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safaricom-mxl/effect-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "MXL OpenTelemetry and product-analytics SDK for Effect applications",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -66,24 +66,31 @@
|
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "tsdown",
|
|
71
|
+
"check": "tsc --noEmit",
|
|
72
|
+
"clean": "rimraf dist",
|
|
73
|
+
"test": "vitest run"
|
|
74
|
+
},
|
|
69
75
|
"dependencies": {
|
|
70
76
|
"@opentelemetry/api": "^1.9.1",
|
|
77
|
+
"@opentelemetry/context-async-hooks": "^2.11.0",
|
|
71
78
|
"@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
|
|
72
79
|
"@opentelemetry/sdk-trace-base": "^2.11.0",
|
|
73
80
|
"std-env": "^4.2.0",
|
|
74
81
|
"uuid": "^14.0.2"
|
|
75
82
|
},
|
|
76
83
|
"devDependencies": {
|
|
77
|
-
"@effect/opentelemetry": "^4.0.0-rc.
|
|
78
|
-
"@types/node": "^26.6.
|
|
79
|
-
"effect": "^4.0.0-rc.
|
|
84
|
+
"@effect/opentelemetry": "^4.0.0-rc.117",
|
|
85
|
+
"@types/node": "^26.6.2",
|
|
86
|
+
"effect": "^4.0.0-rc.117",
|
|
80
87
|
"tsdown": "^0.23.0",
|
|
81
88
|
"typescript": "^7.0.2",
|
|
82
89
|
"vitest": "^5.0.1"
|
|
83
90
|
},
|
|
84
91
|
"peerDependencies": {
|
|
85
|
-
"@effect/opentelemetry": "^4.0.0-rc.
|
|
86
|
-
"effect": "^4.0.0-rc.
|
|
92
|
+
"@effect/opentelemetry": "^4.0.0-rc.117",
|
|
93
|
+
"effect": "^4.0.0-rc.117"
|
|
87
94
|
},
|
|
88
95
|
"author": "MXL <ServiceAvailability@Safaricom.co.ke>",
|
|
89
96
|
"repository": {
|
|
@@ -100,11 +107,5 @@
|
|
|
100
107
|
"opentelemetry",
|
|
101
108
|
"observability",
|
|
102
109
|
"telemetry"
|
|
103
|
-
]
|
|
104
|
-
|
|
105
|
-
"build": "tsdown",
|
|
106
|
-
"check": "tsc --noEmit",
|
|
107
|
-
"clean": "rimraf dist",
|
|
108
|
-
"test": "vitest run"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
110
|
+
]
|
|
111
|
+
}
|