Skip to content

Migrating from OpenLLMetry to spanforge

OpenLLMetry (by Traceloop) is an OpenTelemetry-based auto-instrumentation library for LLMs. spanforge is an AI compliance platform — it provides a superset of OpenLLMetry's tracing with a richer event schema, built-in HMAC signing, PII redaction, and a full compliance layer including regulatory mapping, consent tracking, human-in-the-loop governance, model registry, and explainability coverage — all without requiring an OTel SDK at runtime.

Why migrate?

OpenLLMetry helps you trace your AI. spanforge helps you govern it. If your team needs to demonstrate compliance with the EU AI Act, GDPR, SOC 2, HIPAA, or ISO 42001, spanforge provides the compliance infrastructure — evidence packages, audit chains, regulatory clause mappings — that OpenLLMetry cannot.

Key differences

FeatureOpenLLMetryspanforge
FocusOTel-based LLM tracingAI compliance platform
ApproachOTel auto-instrumentation patchesExplicit + auto instrumentation
SchemaOTel GenAI semantic conventionsRFC-0001 spanforge (richer, AI-native)
Zero dependenciesNo (requires opentelemetry-sdk)Yes (OTel is an optional extra)
PII redactionNoYes
HMAC signingNoYes
Cost trackingLimitedFull CostTracker + budget alerts
Offline operationWith file exporterYes (native)
Regulatory framework mappingNoEU AI Act, GDPR, SOC 2, HIPAA, ISO 42001, NIST AI RMF
Consent boundary trackingNoconsent.* events
Human-in-the-loop complianceNohitl.* events
Model registry governanceNomodel_registry.* events
Explainability coverage metricsNoexplanation.* events
Evidence packages + attestationsNoHMAC-signed, auditor-ready

Step 1: Remove OpenLLMetry initialisation

# Before (OpenLLMetry)
from traceloop.sdk import Traceloop

Traceloop.init(
    app_name="my-app",
    api_endpoint="https://api.traceloop.com",
    headers={"Authorization": "Bearer <key>"},
)
# After (spanforge)
import spanforge
spanforge.configure(exporter="otlp", endpoint="http://collector:4318/v1/traces",
                    service_name="my-app")

Step 2: Replace @workflow / @task decorators

# Before (OpenLLMetry)
from traceloop.sdk.decorators import workflow, task

@workflow(name="rag-pipeline")
def run_pipeline(query: str) -> str:
    return retrieve_and_generate(query)

@task(name="generate")
def retrieve_and_generate(query: str) -> str:
    return call_llm(query)

# After (spanforge)
import spanforge

def run_pipeline(query: str) -> str:
    with spanforge.start_trace("rag-pipeline") as trace:
        return retrieve_and_generate(trace, query)

def retrieve_and_generate(trace, query: str) -> str:
    with trace.llm_call("gpt-4o") as span:
        result = call_llm(query)
        span.set_status("ok")
        return result

Step 3: Auto-instrumentation

OpenLLMetry patches openai, anthropic, etc. automatically. spanforge provides the same via:

# After (spanforge auto-instrumentation)
import spanforge
from spanforge.auto import patch_all

spanforge.configure(exporter="otlp", endpoint="http://collector:4318/v1/traces")
patch_all()   # patches openai, anthropic, langchain, etc.

# Now all LLM calls are automatically traced
import openai
response = openai.chat.completions.create(model="gpt-4o", messages=[...])

Or patch individual providers:

from spanforge.auto import patch_openai, patch_anthropic
patch_openai()
patch_anthropic()

Step 4: Association properties

OpenLLMetry's Traceloop.set_association_properties() maps to spanforge span attributes:

# Before
Traceloop.set_association_properties({"user_id": "u123", "chat_id": "c456"})

# After (spanforge)
with spanforge.span("my-op") as span:
    span.set_attribute("user_id", "u123")
    span.set_attribute("chat_id", "c456")

Step 5: OTLP export (keep your existing backend)

If you already have an OTel-compatible backend (Jaeger, Grafana Tempo, Honeycomb, etc.):

import spanforge
spanforge.configure(
    exporter="otlp",
    endpoint="http://your-collector:4318/v1/traces",
    service_name="my-app",
)

Your existing dashboards continue to work — spanforge events are OTLP-compatible.


Environment variable mapping

OpenLLMetry / Traceloopspanforge equivalent
TRACELOOP_API_KEY(not needed — no cloud API)
TRACELOOP_BASE_URLSPANFORGE_ENDPOINT
TRACELOOP_APP_NAMESPANFORGE_SERVICE_NAME
TRACELOOP_DISABLE_BATCHSPANFORGE_EXPORTER=console

See also