@safaricom-mxl/effect-sdk
v0.0.13
Published
MXL OpenTelemetry SDK for Effect applications
Maintainers
Readme
@safaricom-mxl/effect-sdk
OpenTelemetry traces, logs, and metrics for Effect applications, exported to the MXL OpenTelemetry collector via OTLP.
Install
pnpm add @safaricom-mxl/effect-sdk effectServer
Use @safaricom-mxl/effect-sdk/server (or the package root in Node / SSR, which resolves to the server build):
import { Mxl } from "@safaricom-mxl/effect-sdk/server";
import { Effect } from "effect";
const ObservabilityLive = Mxl.layer({ serviceName: "mxl-basket" });
const program = Effect.log("Hello!").pipe(Effect.withSpan("hello"));
Effect.runPromise(program.pipe(Effect.provide(ObservabilityLive)));Browser
Use @safaricom-mxl/effect-sdk/browser, or the package root in bundlers that honor the browser export condition (for example Vite client builds):
import { Mxl } from "@safaricom-mxl/effect-sdk/browser";
const ObservabilityLive = Mxl.layer({ serviceName: "mxl-console" });Do not import @safaricom-mxl/effect-sdk/server from browser code.
Environment variables
| Variable | Description |
| ----------------------------- | ------------------------------------------ |
| OTEL_EXPORTER_OTLP_ENDPOINT | OTLP HTTP endpoint (preferred) |
| OTLP_ENDPOINT | Fallback OTLP endpoint |
| OTEL_EXPORTER_OTLP_HEADERS | Comma-separated key=value export headers |
| OTEL_SERVICE_NAME | Service name |
| OTEL_RESOURCE_ATTRIBUTES | Extra resource attributes |
| OTEL_SDK_DISABLED | When true, installs a no-op layer |
Default endpoint: http://127.0.0.1:4318 (local mxl-otel-collector).
License
MIT
