Skip to main content

middleware-llmobs

LLM Observability for the Middleware SaaS platform, built on OpenInference and OpenTelemetry.

middleware-llmobs provides a one-line register() that configures an OpenTelemetry TracerProvider to export OpenInference traces to your Middleware collector over OTLP/HTTP.

Transport: Only HTTP/protobuf is supported. gRPC is intentionally disabled — requesting it raises NotImplementedError. (The gRPC code path is retained in the source for future use.)

Install

pip install middleware-llmobs

Quickstart

Set the standard OTLP environment variables for your Middleware account:

export OTEL_EXPORTER_OTLP_ENDPOINT="https://uid.middleware.io:443"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=<your-key>"
export OTEL_SERVICE_NAME="my-llm-app"

Then register and auto-instrument every installed OpenInference library:

from middleware.llmobs import register

providers = register(auto_instrument=True)  # batch + HTTP by default
# providers.tracer / providers.logger / providers.meter — the wired OTel providers.

Explicit configuration

from middleware.llmobs import register

providers = register(
    endpoint="https://uid.middleware.io:443",
    headers={"Authorization": "<your-key>"},
    service_name="my-llm-app",
)

Manual instrumentor wiring with GenAI semantic conventions

from middleware.llmobs import register
from openinference.instrumentation import TraceConfig
from openinference.instrumentation.openai import OpenAIInstrumentor

providers = register(service_name="my-llm-app")

OpenAIInstrumentor().instrument(
    tracer_provider=providers.tracer,
    config=TraceConfig(enable_genai_semconv=True),
)

When auto_instrument=True, register() passes TraceConfig(enable_genai_semconv=True) to each instrumentor automatically (falling back gracefully for instrumentors that don't accept a config argument).

Environment variables

Variable Purpose Example
OTEL_EXPORTER_OTLP_ENDPOINT Collector endpoint https://uid.middleware.io:443
OTEL_EXPORTER_OTLP_HEADERS Export headers (auth) Authorization=<key>
OTEL_SERVICE_NAME Service identity my-llm-app
MW_PROJECT_NAME Optional project name (defaults to service name) my-project

License

Apache-2.0

Metadata

Release files for middleware-llmobs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for middleware-llmobs 0.1.1
File Size Uploaded
middleware_llmobs-0.1.1.tar.gz 40.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for middleware-llmobs 0.1.1
File Interpreter ABI Platform
middleware_llmobs-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 77.6 kB

Release files / middleware_llmobs-0.1.1.tar.gz

Download URL middleware_llmobs-0.1.1.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
459c26b45f4d867c3770dc0ed5ff7c27feb9c3d8ddf2eb9c1fb6779ffb226e16
BLAKE2b-256 checksum
How to use checksums
e12a0ab142fcb43598eed92f499d951b787854aa7236fd699b689008eb5a91d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / middleware_llmobs-0.1.1-py3-none-any.whl

Download URL middleware_llmobs-0.1.1-py3-none-any.whl
Size 36.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6accf6a8320a8145d5046b849786136b63032b3345a928bf866777fe3d9c67f4
BLAKE2b-256 checksum
How to use checksums
9c2d243a51b9f917d8007010f7fbf3c91c92916f4e485c663e70b175655e6041
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page