๐๐ ๐ข๐ฏ๐๐ฒ๐ฟ๐๐ฎ๐ฏ๐ถ๐น๐ถ๐๐: ๐ฆ๐๐ผ๐ฝ ๐๐น๐๐ถ๐ป๐ด ๐๐น๐ถ๐ป๐ฑ
Your code works. It passes tests. It ships. Then you get a bill for thousands of dollars. You are shocked. Your logs only show the answer. They do not show the 8,000 reasoning tokens the model used.
You are flying a plane with one gauge. You need four signals to see the full picture.
- Logs: Request and response pairs. Latency. Errors.
- Prompts: The exact text sent. System prompts. History.
- Tool Calls: Which tool the model picked. The arguments used. The results.
- Cost: Input tokens. Output tokens. Cached tokens. Reasoning tokens.
If you miss cost, finance will call you. If you miss tool calls, you will not know why your agent failed. If you miss prompts, debugging becomes a guessing game.
Follow these rules for a better system:
- Check the finish reason. A 200 status does not mean success. The model might hit a limit or a safety filter.
- Track time to first token. This is how users feel speed. Total time is for billing.
- Redact PII. Strip names and emails before logs leave your network.
- Version your prompts. Treat them like code.
Use a standard like OpenTelemetry. Do not build everything from scratch.
The model is the cheapest part to change. The expensive part is finding out why it failed. Observability shortens this loop.
Log the prompts. Trace the tools. Track the tokens. Attribute the cost.
Source: https://dev.to/nazar_boyko/ai-observability-logs-prompts-tool-calls-and-cost-20cj Optional learning community: https://t.me/GyaanSetuAi