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.2.tar.gz (7.3 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.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ontos_observability_otel-0.1.2.tar.gz
  • Upload date:
  • Size: 7.3 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.2.tar.gz
Algorithm Hash digest
SHA256 5d91c9362105060c0307bec31bb41b28b917357223ea45695131741a3e04ae36
MD5 c532e2875d73e9060b2866a23d18e6a9
BLAKE2b-256 766795a19d217611d88db90c958c2493ee1aef1a95da9e94a240e80aa044f229

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ontos_observability_otel-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d8db052e060bba9c8cf583bc1827f14d3a1147fbfd629e789737b4903ab92f
MD5 3008976b16a8801e6f443b388838c6b2
BLAKE2b-256 34c8141c4d4d6d99f8f05be3579823f346c144fca173ef523d1a71e00cea22cf

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