José González Oliva Contact
Case Study

Telegram + observability

Telegram used as a secondary operational channel to test a backend while preserving traces, metrics and error visibility.

Problem

AI integrations become difficult to operate when teams cannot answer basic questions: which channel received the request, which model handled it, which evidence was used, how long it took and what failed.

Plain-English observability

A trace is an execution record. It connects a request to the model, retrieval status, latency, token counts and errors. A trace_id is the identifier used to follow that execution across components.

Tokens are small pieces of text processed by the model. Tracking input and output tokens helps estimate cost, latency and model workload. Latency is the time the system takes to return a response.

JSONL means one JSON record per line. It is a simple local format for storing many execution records without needing a database or external monitoring service.

Architectural decision

Keep Telegram as a channel adapter, not as the core system. Telegram messages pass through bot logic into the backend, and the backend handles retrieval, provider calls, response generation and trace writing.

Simplified flow

account_tree Telegram message -> bot service -> backend API -> optional RAG -> LLM provider -> response -> JSONL trace.

Synthetic trace

{
  "trace_id": "trc_public_demo_ok_001",
  "source": "telegram",
  "provider": "ollama",
  "retrieval_status": "evidence_found",
  "tokens_input": 1210,
  "tokens_output": 286,
  "latency_ms": 1730,
  "status": "ok"
}

What it demonstrates

Ability to connect AI behavior to operational evidence: channel, model, retrieval status, token workload, latency and error state. No real user identifiers, chat identifiers, user text, tokens or logs are published.

Stack

FastAPI, Telegram Bot API, JSON/JSONL traces, local model providers, synthetic examples and deterministic evaluation scripts.

Limitations

  • No advanced queue management.
  • No formal SLOs or external observability dashboard.
  • Local JSONL logging is useful for a lab, but not a replacement for production monitoring.
  • Cost and token metrics depend on what the selected provider returns.