Files
native/query_metrics.go
zeekay 765c3d0aa1 hanzo-ds/native: de-branded native protocol lib (fork of clickhouse ch-go v0.71.0)
Module path, package names, and identifiers de-branded to native/proto/compress/
pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used
by hanzo-ds/go (proto + compress).
2026-07-10 13:10:07 -07:00

36 lines
638 B
Go

package native
import "context"
type (
ctxQueryKey struct{}
queryMetrics struct {
ColumnsReceived int
RowsReceived int
BlocksReceived int
BlocksSent int
Rows int
Bytes int
}
)
func (c *Client) metricsInc(ctx context.Context, delta queryMetrics) {
if !c.otel {
return
}
v, ok := ctx.Value(ctxQueryKey{}).(*queryMetrics)
if !ok {
return
}
v.Bytes += delta.Bytes
v.Rows += delta.Rows
v.RowsReceived += delta.RowsReceived
v.BlocksReceived += delta.BlocksReceived
v.BlocksSent += delta.BlocksSent
if delta.ColumnsReceived > 0 {
v.ColumnsReceived = delta.ColumnsReceived
}
}