Skip to content

feat(observability): Standardize telemetry key constants - #1306

Closed
vprashrex wants to merge 2 commits into
fix/834-status-code-consistencyfrom
feat/1294-telemetry-key-constants
Closed

vprashrex wants to merge 2 commits into
fix/834-status-code-consistencyfrom
feat/1294-telemetry-key-constants

Conversation

@vprashrex

@vprashrex vprashrex commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Closes #1294

Summary

  • Before: Different keys and types were used in Sentry, causing filters not to match every signal.
  • Now: All telemetry attributes come from core/telemetry/constants.py, eliminating string literals for keys.
  • Standard OTel keys are now imported from semconv.
  • Key renaming for consistency and clarity.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

Before merging, update the Sentry dashboard Kaapi · LLM Call: it still filters on kaapi.organization_id, kaapi.project_id and completion_type. No alert rule uses the old keys.

Original PR description

Issue

Closes #1294

Summary

The same concept went to Sentry under different keys and types (tenant.org_id vs kaapi.organization_id, llm.job_id vs guardrails.job_id, int vs string), so one filter never matched every signal.

  • All span attributes, Sentry tags and metric names now come from core/telemetry/constants.py; no key is written as a string literal anymore.
  • Standard OTel keys (GenAI, http.request.body.size, db.system, user.id) are imported from semconv.
  • Renamed: kaapi.organization_id/project_id → tenant.org_id/project_id (always strings), *.job_id → job.id, kaapi.trace_id → correlation_id, llm.provider/llm.request.model → gen_ai.*, completion_type → llm.completion_type, route_category → http.route_category, llm.call.total/errors → llm.call.count/error. log_context(...) uses org_id.
  • Every other key keeps its current name so existing dashboards keep working.

Stacked on #1090.

Checklist

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

Before merging, update the Sentry dashboard Kaapi · LLM Call: it still filters on kaapi.organization_id, kaapi.project_id and completion_type. No alert rule uses the old keys.

Move every span attribute, Sentry tag and metric name into
core/telemetry/constants.py. Standard OTel keys (GenAI, HTTP body size,
db.system, user.id) come from semconv; tenant ids are always strings.
Replaces kaapi.organization_id/project_id with tenant.*, *.job_id with
job.id, kaapi.trace_id with correlation_id, llm.provider/llm.request.model
with gen_ai.*, and llm.call.total/errors with llm.call.count/error.
log_context now uses org_id. Existing key names are otherwise unchanged
so dashboards keep working.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vprashrex vprashrex linked an issue Oct 24, 2026 that may be closed by this pull request
@vprashrex vprashrex closed this Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant