Skip to main content

One-line OpenTelemetry onboarding for the Ontos observability app: traces, cost, and the answer contract (question, answer, context, tokens).

Reason this release was yanked:

bug

Project description

ontos-observability-otel

One-line OpenTelemetry onboarding for the Ontos observability app. Two calls send everything the app needs to trace, cost, judge and compare your agent's answers: the question, the answer, the evidence context, the token usage and the model, tagged with your customer/environment/domain.

Install

pip install ontos-observability-otel

Use

from ontos_observability_otel import observe, record_answer

observe(customer="sigma", environment="dev", domain="my-agent",
        endpoint="https://<observability-host>:4318", token="<your ingest token>")

# after your agent answers a question:
record_answer(
    question=user_question,
    answer=agent_answer,
    context=evidence,            # what the answer was grounded on (rows, documents, SQL results)
    model="claude-haiku-4-5",
    input_tokens=usage.input_tokens,
    output_tokens=usage.output_tokens,
)

To also measure latency, wrap the work instead:

from ontos_observability_otel import answer

with answer(user_question) as rec:
    result = my_agent.ask(user_question)
    rec.record(answer=result.text, context=result.evidence, model=result.model,
               input_tokens=result.input_tokens, output_tokens=result.output_tokens)

Everything can also come from the environment, so no code changes per deployment: ONTOS_OTLP_ENDPOINT, ONTOS_TOKEN, ONTOS_CUSTOMER, ONTOS_ENVIRONMENT, ONTOS_DOMAIN, ONTOS_VARIANT (defaults to baseline), OTEL_SERVICE_NAME.

What each field buys you

  • question / answer: the trace, the review queue, and the relevance judge.
  • context: the groundedness judge grades the answer AGAINST this evidence; without it, hallucination cannot be measured.
  • model + input_tokens / output_tokens: real cost per request and per day.
  • customer / environment / domain: how the dashboard segments and filters everything. domain is yours to organize by (one value per app or agent works well).
  • ontos.variant is stamped automatically (baseline). The value ontos is RESERVED for the Ontos runtime, so the Ontos-vs-baseline comparison is always trustworthy; the SDK refuses it.

Already on OpenTelemetry?

You do not need this package: keep your setup and stamp the same span attributes (ontos.question, ontos.answer, ontos.context, ontos.customer, ontos.environment, ontos.domain, gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens) on the span that carries each answer, and point your OTLP/HTTP exporter at <endpoint>/v1/traces with the bearer token.

Design

Standard OpenTelemetry, no proprietary tracer, no Ontos IP (scorers, grounding and comparison live server-side). Best-effort by contract: no endpoint or missing dependency means a no-op; the host application is never broken by telemetry.

Optional auto-instrumentation extras: ontos-observability-otel[fastapi], [flask], [django], [requests], [httpx].

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

ontos_observability_otel-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

ontos_observability_otel-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file ontos_observability_otel-0.1.0.tar.gz.

File metadata

  • Download URL: ontos_observability_otel-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ontos_observability_otel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18df2c0e6599cd2b2fbaf149b4bc4b2d9c9bb66747766e245236864e7e3505c3
MD5 3f06d194b777047f6cdccc46495a6983
BLAKE2b-256 2b8d4090b5607e9a8b998a6d78915ac14af0d7b4d7fbc06528b3e8d7487a572a

See more details on using hashes here.

File details

Details for the file ontos_observability_otel-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ontos_observability_otel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8003c048ea3b206505cab52fab1dcd5ef322b310e224f52097027120e913cde2
MD5 5ec17799e73df63d7703210276653ede
BLAKE2b-256 86ab84c138349748743ca0bb59f1512a43d49077932570277545ddfd8c33d50d

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