Skip to main content

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

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.1.tar.gz (7.0 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.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ontos_observability_otel-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 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.1.tar.gz
Algorithm Hash digest
SHA256 47da9b532a629d884a242fc34c83696f2247ed0983d7ba6d763c05dab142ee0f
MD5 0b3d6d9b693d280812d9829eb59ae161
BLAKE2b-256 21d65d5aff7cfe09b7311f535696045add31e8c7df448fdf7b98b557492a7b43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ontos_observability_otel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2bf0ab3443849ba544a37a42404731e59d6e251d28fae717dbe9182fb027979
MD5 9d9112a6ef79eb3b72c6a170c06f46d8
BLAKE2b-256 22012d43db9c42c206ff62f5751ad01456387e41f774ad5afd3599d65eb2d434

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