Skip to content

Commit d22532a

Browse files
committed
fix: don't emit graph total-tokens event when total is zero
1 parent d0ae81b commit d22532a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/sdk/server-ai/src/main/java/com/launchdarkly/sdk/server/ai/AIGraphTracker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ public void trackTotalTokens(TokenUsage tokens) {
168168
logger.warn("Skipping trackTotalTokens: token usage already recorded on this graph tracker.");
169169
return;
170170
}
171-
client.trackMetric(GRAPH_TOTAL_TOKENS, context, baseData().build(), tokens.getTotal());
171+
if (tokens.getTotal() > 0) {
172+
client.trackMetric(GRAPH_TOTAL_TOKENS, context, baseData().build(), tokens.getTotal());
173+
}
172174
}
173175

174176
/**

0 commit comments

Comments
 (0)