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
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ public void AddToken(TokenStatsModel stats, RoleDialogModel message)
stat.SetState("llm_total_cost", total_cost, isNeedVersion: false, source: StateSource.Application);

// Save stats
var agentId = message.CurrentAgentId ?? string.Empty;
var globalStats = _services.GetRequiredService<IBotSharpStatsService>();
var body = new BotSharpStatsInput
{
Metric = StatsMetric.AgentLlmCost,
Dimension = "agent",
DimRefVal = message.CurrentAgentId,
DimRefVal = agentId,
RecordTime = DateTime.UtcNow,
IntervalType = StatsInterval.Day,
Data = [
Expand All @@ -75,7 +76,7 @@ public void AddToken(TokenStatsModel stats, RoleDialogModel message)
new StatsKeyValuePair("completion_cost_total", deltaCompletionCost)
]
};
globalStats.UpdateStats("global-llm-cost", body);
globalStats.UpdateStats($"global-llm-cost-{agentId}", body);
}

public void PrintStatistics()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ private void UpdateAgentCall(RoleDialogModel message)
// record agent call
var globalStats = _services.GetRequiredService<IBotSharpStatsService>();

var agentId = message.CurrentAgentId ?? string.Empty;
var body = new BotSharpStatsInput
{
Metric = StatsMetric.AgentCall,
Dimension = "agent",
DimRefVal = message.CurrentAgentId ?? string.Empty,
DimRefVal = agentId,
RecordTime = DateTime.UtcNow,
IntervalType = StatsInterval.Day,
Data = [
new StatsKeyValuePair("agent_call_count", 1)
]
};
globalStats.UpdateStats("global-agent-call", body);
globalStats.UpdateStats($"global-agent-call-{agentId}", body);
}
}
Loading