Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/fortifyroot/_vendor/VENDOR_MANIFEST.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"vendored_at": "2026-06-15T13:22:33.209910",
"vendored_at": "2026-06-17T01:52:40.767869",
"openllmetry_version": "0.52.6",
"git_commit": "12dbb40d183a",
"git_commit": "724081bb6f72",
"git_branch": "HEAD",
"git_tag": "fr-v0.52.6.20",
"git_tag": "fr-v0.52.6.21",
"instrumentation_package_policy": {
"opentelemetry-instrumentation-agno": false,
"opentelemetry-instrumentation-alephalpha": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
)
from fortifyroot._vendor.opentelemetry.instrumentation.openai.version import __version__
from opentelemetry.instrumentation.utils import unwrap
from fortifyroot._vendor.opentelemetry.semconv_ai import SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY
from fortifyroot._vendor.opentelemetry.semconv_ai import (
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY,
SpanAttributes,
)
from opentelemetry.trace import SpanKind, Status, StatusCode
from wrapt import wrap_function_wrapper

Expand Down Expand Up @@ -413,6 +416,17 @@ def _extract_usage_from_body(span: "trace.Span", response: Any) -> None:
span.set_attribute("gen_ai.usage.input_tokens", pt)
if isinstance(ct, int):
span.set_attribute("gen_ai.usage.output_tokens", ct)
total_tokens = usage.get("total_tokens")
if isinstance(total_tokens, int):
span.set_attribute(SpanAttributes.LLM_USAGE_TOTAL_TOKENS, total_tokens)
prompt_tokens_details = usage.get("prompt_tokens_details")
if isinstance(prompt_tokens_details, dict):
cached_tokens = prompt_tokens_details.get("cached_tokens")
if isinstance(cached_tokens, int):
span.set_attribute(
SpanAttributes.LLM_USAGE_CACHE_READ_INPUT_TOKENS,
cached_tokens,
)
except Exception:
logger.debug("failed to extract usage from openai response body", exc_info=True)

Expand Down
Loading