That moment when the dashboard showed 10,000+ daily AI queries across multiple models changed everything about how we document and report AI usage. I ran the same report three times because I couldn't believe the numbers. If you're responsible for accurate visibility reporting in a production AI platform, this tutorial walks you through the exact, repeatable process I used to instrument, collect, validate, and report AI traffic and model behavior — with a focus on reproducible evidence, not clickbait.
What you'll learn (objectives)
- How to instrument a platform that serves multiple AI models to capture reliable telemetry for query volume, latency, errors, and cost. Step-by-step methods to extract, deduplicate, and validate daily counts so that a "10,000+" claim is defensible. How to build reproducible reports and transparency artifacts that auditors or stakeholders can re-run. Practical sampling, aggregation, and statistical checks for fair model comparison and fraud detection. Interactive self-assessments to test your setup and a troubleshooting playbook for common anomalies.
Prerequisites and preparation
Before you start, make sure you have the following in place. These items reduce noise and make your reporting reproducible.
Access to platform telemetry and logs (API gateway logs, app logs, model inference logs). Database or data lake with queryable telemetry (SQL, BigQuery, Athena, etc.). Unique request identifiers propagated across components (request_id or trace_id). Mapping of model identifiers to stable model metadata (model_name, version, training_snapshot, endpoint). Cost and billing metrics integrated or accessible (per-model cost if possible). Dashboarding tools (Grafana, Looker, Kibana) and a reproducible reporting script (SQL + notebook or scheduled job). Baseline metrics for comparison (previous day/week/month) and defined SLA thresholds.Suggested dataset schema (minimum fields per record): timestamp, request_id, user_id (or anonymized), model_id, endpoint, tokens_in, tokens_out, latency_ms, status_code, error_message, cost_estimate, input_hash.
[Screenshot suggestion: capture an example log entry with request_id, model_id, timestamp — include a redacted example.]
Step-by-step instructions
Step 1 — Instrumentation: ensure consistent, end-to-end IDs
Why it matters: Without a single request identifier tracked across the gateway, app, and model inference layer, you'll double-count or miss requests.
- Implement a request_id generator at the edge (e.g., UUIDv4 or trace-id). Propagate it in HTTP headers to downstream services. Log request_id in all layers with the same timestamp format (ISO 8601, UTC). Capture model metadata (model_id, model_version, endpoint_name) at the time of inference and persist it with the request_id.
[Screenshot suggestion: a snippet of sample headers showing X-Request-ID: 123e4567-e89b-12d3-a456-426655440000]
Step 2 — Raw extraction: export one day's worth of raw records
Objective: produce an immutable dump for the day you intend to report. Export raw logs to a parquet or CSV snapshot and store with a versioned filename (e.g., telemetry-2025-10-12-v1.parquet).
- Query timeframe: midnight UTC to next midnight UTC to avoid partial-day issues if teams in multiple time zones are involved. Include all request types that should count as "AI queries" (exclude internal health checks and telemetry pings). Persist the snapshot in cold storage (S3, GCS) with access controls and a checksum.
Step 3 — Deduplication and defining the unit of count
Common counting ambiguity: Should an API call that fans out to 3 model inferences count as one query or three? Choose and document the unit.
Define "AI query" for reporting (recommended: user-facing request that initiated inference work). If counting at the inference level, deduplicate by inference_id. If counting requests, deduplicate by request_id. Implement a canonicalization step: drop internal monitoring requests, merge retries using a parent_request_id, and remove duplicates with the same request_id and identical timestamp within a 1s window.Sample SQL-like filter (pseudocode):
SELECT request_id, MIN(timestamp) as first_seen, COUNT(*) as inference_count FROM telemetry WHERE date='2025-10-12' GROUP BY request_id;
Step 4 — Validate counts with independent sources
Why: Single-source reports are fragile. Cross-check at least two independent views.
- Compare gateway access logs (requests accepted) with model-side logs (inference executed). They should match or be explainably different (e.g., rejected requests). Compare billing records (if available) for inference consumption and tokens to your counts. If numbers disagree >1-2%, investigate reconciliation items: retries, failed inferences, traffic routed to preview endpoints.
[Screenshot suggestion: a small table showing gateway_count=10012, model_log_count=10008, billing_estimate=10015 with reconciliation notes.]
Step 5 — Aggregate meaningful metrics
Beyond raw counts, stakeholders want context. Compute core metrics:
- Total AI queries (deduplicated) — primary headline number. Queries by model_id and model_version — to attribute usage. Latency distribution (p50/p90/p99). Error rate (4xx/5xx and model-specific errors), meltdown signals (e.g., retry storms). Average tokens_in/out and estimated cost per query.
Example aggregation specification (table):
MetricCalculationWhy it matters Total queries (deduped) COUNT(DISTINCT request_id) Headline volume Model share COUNT(DISTINCT request_id) GROUP BY model_id Attribution and cost allocation p90 latency PERCENTILE(latency_ms, 0.9) Performance SLA indicator Error rate SUM(error_flag)/COUNT(*) Operational healthStep 6 — Run reproducibility checks (I ran my report three times)
Repeat the same aggregation pipeline on the identical snapshot three times. The numbers should be identical. If they are not:
- Check for non-deterministic operations (random sampling without seeded RNG, time-variant joins). Ensure query engines use deterministic order when computing percentiles or approximate algorithms. Persist the exact SQL/notebook used, runtime image, and dependency versions to a report artifact.
Practical tip: store the pipeline as code (notebook + https://faii.ai/for-enterprises/ environment.yml). Attach a checksum of the snapshot and the script to your report. This is your "reproducible evidence bundle."
Step 7 — Produce the final report and transparency artifacts
Include the following in the published report or internal memo:
- Headline number with definition: e.g., "10,023 AI queries (deduplicated by request_id) on 2025-10-12, UTC." Breakdown by model and endpoint with percentages and costs. Methodology section (exact SQL queries, deduplication rules, excluded traffic, snapshot name/checksum). Reproducibility instructions: where to fetch snapshot, how to run scripts, expected runtime and checksum.
[Screenshot suggestion: final dashboard screenshot showing top-line number, model share pie chart, and latency histograms — redact any PII.]
Common pitfalls to avoid
- Mixing timezones: Ensure all timestamps are normalized to UTC before aggregation. Counting retries as new queries: Always dedupe by request_id or parent_request_id. Including internal health checks: Filter by user-agent or endpoint tags. Using sampled data for headline counts: Sampling is okay for quality analysis but not for final volume reporting unless you provide confidence intervals. Ignoring cost attribution: Without tokens or cost mapping, model share doesn't equal cost share. Not freezing datasets: Running the pipeline on live data will change results — take immutable snapshots.
Advanced tips and variations
Once you have the core pipeline, extend it in these ways:

- Model attribution with multi-step requests: If a request fans out to multiple models, record a composition vector (model_a:1, model_b:2) to allocate costs and to analyze orchestration patterns. Significance testing for changes: Use a simple A/B style t-test or bootstrap on latency or error rates before declaring impact after a rollout. Drilldown by customer cohort: anonymize and surface per-customer or per-product-line counts for billing reconciliation. Automated anomaly detection: compute rolling z-scores on daily counts and alert if delta > 3 sigma. Explainability checks: sample 100 requests and run automated checks for hallucination markers or policy violations — include these as qualitative evidence in your report.
Sampling strategies
If you must sample for cost reasons, use deterministic sampling (hash(user_id) % N) and publish the sampling function. That allows stakeholders to upscale sample results to the population with a clear confidence interval.
Interactive self-assessments and quiz
Use these quick checks to assess whether your reporting is robust. Score yourself: 1 point per correct answer.
Quiz
True or False: It is safe to use gateway logs alone as the single source of truth for inference counts. (Answer below) Which deduplication key is most reliable for counting user-facing AI queries? (a) timestamp b) request_id c) user_id d) session_id When reporting daily counts, which of the following is essential? (Choose all that apply): (a) Timezone normalization (b) Sampling without disclosure (c) Snapshot checksum (d) Model attributionAnswers: 1) False. Gateway logs alone can miss failed inferences or internal retries. 2) b) request_id. 3) (a), (c), and (d). Sampling is acceptable only if disclosed and accompanied by a confidence interval.
Self-assessment checklist
- Do I have a reproducible snapshot and a stored checksum? (Yes / No) Is every record tagged with a single request_id propagated end-to-end? (Yes / No) Have I validated counts against at least two independent sources? (Yes / No) Have I defined and documented what counts as an AI query? (Yes / No)
Score interpretation: 4/4 — high confidence. 2-3/4 — moderate confidence; run reconciliation steps. 0-1/4 — revisit instrumentation and snapshot strategy before reporting externally.
Troubleshooting guide
SymptomLikely causeFix Daily count differs between two runs Non-deterministic pipeline, live data, or non-idempotent joins Run against immutable snapshot; pin versions; remove approximate aggregations Model attribution sums > total queries Fan-out counted per inference instead of per request Decide on counting unit; report both request-level and inference-level metrics if needed Gateway count >> model logs Requests rejected or filtered before model layer (auth failures, rate limits) Filter rejected requests out or include rejection reason in report Large discrepancy with billing estimates Different cost model, delayed billing, or mis-tagged model versions Map tokens to billing model, reconcile with finance, check model_id mappingWrap-up and next steps
Counting 10,000+ daily AI queries is an operational milestone only if it is reproducible and transparent. The workflow above turns a surprising dashboard number into a defensible claim: instrument consistently, snapshot raw data, deduplicate with a clear definition, cross-validate with independent sources, and publish a reproducible evidence bundle with your report.

Next steps you can implement today:
Create a daily snapshot job that writes a checksum and stores the raw data. Standardize request_id propagation and update logs where missing. Publish a single-page transparency artifact that includes the SQL used, the snapshot location, and the expected checksum.If you want, I can generate a sample reproducibility bundle skeleton (SQL + notebook outline + sample snapshot manifest) tailored to the tech stack you use. Tell me whether you use BigQuery, Snowflake, or a data lake, and I’ll draft the artifacts.