An application that already emits OpenTelemetry needs no new instrumentation to start. Keep your tracers, meters, loggers and instrumentation libraries; replace only the SDK setup (providers, processors, exporters) with the logika-otel enhancer. With an empty ledger Logika is a logging platform: every span, log record and metric data point is stored and queryable, and only failures are judged until you declare events: a span that ends in an error, or a log record with an exception or an ERROR or FATAL severity, raises an issue.
1. Sign in and set the repository up
curl -fsSL https://logika.host/install.sh | sh # or brew, uvx logika-cli, npx logika-cli
logika login # sign in, pick or create a project
logika init # logika.json with an empty ledger, the agent's hooks and skills
logika sync # send the ledger, so what the app sends is judged by it
logika api keys create '{"ledger": "shop", "env": "prod"}'
Use the ledger name logika init wrote into logika.json. The key's secret is the application's credential; pass it as you pass any OTLP header:
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20ls_…"
logika check passes on code that emits undeclared names: while the ledger declares no event, no span name or attribute is held to it.
2. Swap the SDK setup for the enhancer
The enhancer installs the SDK's tracer, meter and (in Python) logging pipelines itself, sends them through the standard OTLP exporters to your project's ingest, and adds what Logika relies on: open markers, a heartbeat, loss accounting and a clean end. Delete your own TracerProvider, MeterProvider, NodeSDK, OTLP exporters and OTEL_EXPORTER_OTLP_ENDPOINT; init refuses to start beside another SDK setup, since OpenTelemetry keeps the first provider and would send your telemetry there.
Python (pip install logika-otel, 3.10+):
import logging
import logika_otel
from flask import Flask
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
logging.basicConfig(level=logging.INFO) # the root logger's level decides which records are sent
logika_otel.init(service_version="1.4.2") # instead of your TracerProvider, MeterProvider and exporters
app = Flask(__name__)
FlaskInstrumentor().instrument_app(app)
RequestsInstrumentor().instrument()
With zero-code instrumentation, keep opentelemetry-instrument and the instrumentation packages but uninstall opentelemetry-distro, whose configurator installs a provider of its own before your code runs; call logika_otel.init at startup.
TypeScript (npm install logika-otel, Node 20.6+), loaded before the application with node --import ./instrumentation.mjs app.js:
import { register } from "node:module";
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { init } from "logika-otel";
register("@opentelemetry/instrumentation/hook.mjs", import.meta.url); // ESM modules are patched too
init({ serviceVersion: "1.4.2" }); // instead of new NodeSDK(...).start()
registerInstrumentations({ instrumentations: [getNodeAutoInstrumentations()] });
Log records go through @opentelemetry/api-logs (logs.getLogger(...)) or a logging library's OpenTelemetry bridge. In browsers and React Native, init takes the key and the ledger document instead (see Instrumentation).
What is stored
- Traces: every span, with its true parent, its attributes and resource. Spans the ledger does not declare are stored unmanaged: shown in journeys and queryable, judged only when they fail. Library spans (HTTP servers and clients, databases) arrive as they are.
- Logs: every record with its severity, body, attributes and the trace and span it was emitted in, so a journey shows it under its span.
- Metrics: every data point raw, as the SDK exported it: counters, gauges, histograms (the instrumentation libraries' and the runtime's included), never re-aggregated.
All three count toward your quota. With nothing declared, what is judged is failures (a span ending in an error, a log record with an exception or an ERROR or FATAL severity, one issue per span or logger and exception type) and the enhancer's heartbeat, for liveness; profiles are refused.
Query
logika query sql runs one read-only DuckDB SELECT over the events, logs and metrics tables. Nothing filters for you: bound every query by _environment and _start (logs and metrics by _time).
logika query sql "SELECT _name, count(*) AS n FROM events
WHERE _environment = 'prod' AND _start > now() - INTERVAL 1 HOUR AND NOT starts_with(_name, '_')
GROUP BY 1 ORDER BY n DESC"
logika query sql "SELECT _time, _severity_text, _body FROM logs WHERE _trace_id = '…' AND _environment = 'prod'"
logika query sql "SELECT _time, _value FROM metrics WHERE _name = 'orders.placed' AND _environment = 'prod' ORDER BY _time"
logika query journey <span id> # one trace as a tree, its log records under their spans
Undeclared attributes are in the _extra JSON column; logika docs query lists every table and column. Once the ledger declares an event, it gets a column per param and a table of its own named by its path ("checkout.captured").
Next
Ask your coding agent to instrument this repository with Logika: its logika-instrument skill maps the components and declares the events that matter, which turns unmanaged spans into judged ones. Once real traffic has run, nock reflect logika writes the ledger's rules with you from what the code emitted.