Skip to content

Commit 5794c58

Browse files
committed
fix: 🐛 渠道统计
fix #203
1 parent ab2e9a6 commit 5794c58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/relay/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ func (m *RelayMetrics) Save(ctx context.Context, success bool, err error, attemp
9292
globalStats.RequestFailed = 1
9393
}
9494

95+
channelID, channelName := finalChannel(attempts)
9596
op.StatsTotalUpdate(globalStats)
9697
op.StatsHourlyUpdate(globalStats)
9798
op.StatsDailyUpdate(context.Background(), globalStats)
9899
op.StatsAPIKeyUpdate(m.APIKeyID, globalStats)
99-
100-
channelID, channelName := finalChannel(attempts)
100+
op.StatsChannelUpdate(channelID, globalStats)
101101

102102
log.Infof("relay complete: model=%s, channel=%d(%s), success=%t, duration=%dms, input_token=%d, output_token=%d, input_cost=%f, output_cost=%f, total_cost=%f, attempts=%d",
103103
m.RequestModel, channelID, channelName, success, duration.Milliseconds(),

0 commit comments

Comments
 (0)