LLM monetary costs are recorded with no currency — ingest OTel GenAI gen_ai.usage.cost.currency
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- backend, observability-sre
Hướng nghiên cứu
Start in apps/opik-backend/.../domain/mapping/otel/GenAIMappingRules.java, reading the existing gen_ai.usage.cost rule and its COST/METADATA handling. Then inspect OpenTelemetryMapperTest.java, especially genAiUsageCostExtractedIntoTotalEstimatedCost, and add coverage for gen_ai.usage.cost with gen_ai.usage.cost.currency. Done means the currency is retained alongside the amount without changing totalEstimatedCost or gen_ai.cost.* behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Costs without a unit of account
Opik already collects LLM monetary costs, in two shapes:
-
A pre-computed total from
gen_ai.usage.cost, routed to the span's
totalEstimatedCost:// apps/opik-backend/.../domain/mapping/otel/GenAIMappingRules.java .rule("gen_ai.usage.cost").source(SOURCE) .outcome(OpenTelemetryMappingRule.Outcome.COST).spanType(SpanType.llm).build(),guarded by
genAiUsageCostExtractedIntoTotalEstimatedCostin
OpenTelemetryMapperTest.java(the fix for the earlier bug where a double cost
was "routed there and silently dropped"). -
gen_ai.cost.*attributes (total_cost/input_cost/output_cost) captured
into span metadata (OpenTelemetryMapperTest.java).
In both paths the value is a bare number. Nothing records what currency it is in. For
anyone who self-hosts Opik, ingests traces billed in a non-USD currency, or compares
cost across deployments, the number is uninterpretable and cross-deployment cost
reconciliation is impossible.
The standard direction
The OpenTelemetry GenAI semantic-conventions working group is standardizing this
exactly (there is no OTel convention for GenAI cost today; each vendor rolls its own).
The open proposal
add per-operation cost conventions (gen_ai.usage.cost.*) #443
defines:
gen_ai.usage.cost.amount(double) — the monetary cost at recording timegen_ai.usage.cost.currency(string) — the ISO 4217 code, conditionally required when amount is setgen_ai.usage.cost.source(enumprovider | local) — provenance
So the attribute a trace should carry beside gen_ai.usage.cost is
gen_ai.usage.cost.currency, and the OTel GenAI mapper is the natural place to map it.
Suggested scope
Consider ingesting gen_ai.usage.cost.currency alongside the existing
gen_ai.usage.cost handling in GenAIMappingRules.java (map it to COST/METADATA so
the unit rides with the amount), and keeping the value additive — no change to the
totalEstimatedCost number or to gen_ai.cost.* behavior. A test alongside
genAiUsageCostExtractedIntoTotalEstimatedCost asserting that a span with
gen_ai.usage.cost + gen_ai.usage.cost.currency retains both the amount and its unit
would lock it in.
Why it helps
- Cost becomes interpretable: the number names its unit of account (USD today, any ISO
4217 code later) without changing the amount logic. - Brings the backend's handling in line with the emerging OTel GenAI standard, where
currency is required whenever an amount is set. - Matters to any per-trace cost-accounting or billing workflow that consumes Opik
spans.
Happy to open a PR on the backend mapper with tests if this scope looks right.
- Ngôn ngữ chính
- Python
- Star
- 22.4k
- Fork
- 1.8k
- Merge trung bình
- 2 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 458
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của comet-ml/opik
-
Bug Integrations Python-SDK
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
comet-ml/opik#9101 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Streamed tool calls missing from track_litellm tracesCó thể đã có người làm @pcbeingused333 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
comet-ml/opik#9089 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Streamed Gemini traces lose function calls (and text next to them)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởBug Integrations Python-SDK
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
comet-ml/opik#9069 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: run_db_migrations.sh exits 0 when db migrate fails, so the backend-migrations init container passesCó thể đã có người làm @pcbeingused333 đã nhận 1 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
comet-ml/opik#9225 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: JSON encoder does not detect cycles in native containersCó thể đã có người làm @Kayvan-Zahiri đã nhận 4 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
comet-ml/opik#9206 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của comet-ml/opik
Issue tương tự
-
component:benchmark
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
agentic-os-org/ANOLISA#9177 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
distrochooser/distrochooser#520 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Status: Needs confirmation Status: Needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupCó thể đã có người làm @AlessandroSpallina đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
headroomlabs-ai/headroom#4513 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
codespell-project/codespell#4060 ·
Maintainer thường phản hồi trong vòng 1 ngày