Skip to main content

Middleware LLM Observability — OpenInference/Opentelemetry tracing for the Middleware SaaS

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

middleware_llmobs-0.1.1.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

middleware_llmobs-0.1.1-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file middleware_llmobs-0.1.1.tar.gz.

File metadata

  • Download URL: middleware_llmobs-0.1.1.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for middleware_llmobs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 459c26b45f4d867c3770dc0ed5ff7c27feb9c3d8ddf2eb9c1fb6779ffb226e16
MD5 7b91499c9192a3cf96c1a682412a1e3a
BLAKE2b-256 e12a0ab142fcb43598eed92f499d951b787854aa7236fd699b689008eb5a91d1

See more details on using hashes here.

File details

Details for the file middleware_llmobs-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for middleware_llmobs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6accf6a8320a8145d5046b849786136b63032b3345a928bf866777fe3d9c67f4
MD5 e3cd46aea453f000e7a74c50707bfddd
BLAKE2b-256 9c2d243a51b9f917d8007010f7fbf3c91c92916f4e485c663e70b175655e6041

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page