Skip to content

Commit

Permalink
Merge pull request #291 from pjirsa/main
Browse files Browse the repository at this point in the history
OpenTelemetry Semantic Convention compliance
  • Loading branch information
johnoliver authored Mar 3, 2025
2 parents 3c3b2e7 + 016aa22 commit bf4e93d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public void otelChatCaptureTest() {
spans.get(0).getAttributes().get(AttributeKey.stringKey("gen_ai.system")));
Assertions.assertEquals(21,
spans.get(0).getAttributes()
.get(AttributeKey.longKey("gen_ai.response.completion_tokens")));
.get(AttributeKey.longKey("gen_ai.usage.output_tokens")));
Assertions.assertEquals(42,
spans.get(0).getAttributes()
.get(AttributeKey.longKey("gen_ai.response.prompt_tokens")));
.get(AttributeKey.longKey("gen_ai.usage.input_tokens")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public void endSpanWithUsage(ChatCompletions chatCompletions) {
CompletionsUsage usage = chatCompletions.getUsage();
getSpan().setStatus(StatusCode.OK);
getSpan()
.setAttribute("gen_ai.response.completion_tokens", usage.getCompletionTokens());
getSpan().setAttribute("gen_ai.response.prompt_tokens", usage.getPromptTokens());
.setAttribute("gen_ai.usage.output_tokens", usage.getCompletionTokens());
getSpan().setAttribute("gen_ai.usage.input_tokens", usage.getPromptTokens());
close();
}

Expand Down

0 comments on commit bf4e93d

Please sign in to comment.