mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
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).
36 lines
638 B
Go
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
|
|
}
|
|
}
|