fixup metrics and tracing
Some checks failed
autoapprove / autoapprove (pull_request) Failing after 1m26s
automerge / automerge (pull_request) Failing after 4s
codeql / analyze (go) (pull_request) Failing after 3m16s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m29s
prbuild / lint (pull_request) Failing after 2m36s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-09-01 00:21:08 +03:00
parent 4b3ba3f76a
commit 927218921e
9 changed files with 2214 additions and 2201 deletions

View File

@@ -29,18 +29,18 @@ var (
)
var (
MaxOpenConnections = "max_open_connections"
OpenConnections = "open_connections"
InuseConnections = "inuse_connections"
IdleConnections = "idle_connections"
WaitConnections = "wait_connections"
MaxOpenConnections = "max_open_conn"
OpenConnections = "open_conn"
InuseConnections = "inuse_conn"
IdleConnections = "idle_conn"
WaitConnections = "waited_conn"
BlockedSeconds = "blocked_seconds"
MaxIdleClosed = "max_idle_closed"
MaxIdletimeClosed = "max_idletime_closed"
MaxLifetimeClosed = "max_lifetime_closed"
MaxIdletimeClosed = "closed_max_idle"
MaxLifetimeClosed = "closed_max_lifetime"
meterRequestTotal = "request_total"
meterRequestLatencyMicroseconds = "request_latency_microseconds"
meterRequestLatencyMicroseconds = "latency_microseconds"
meterRequestDurationSeconds = "request_duration_seconds"
labelUnknown = "unknown"
@@ -78,7 +78,7 @@ func NewOptions(opts ...Option) Options {
Tracer: tracer.DefaultTracer,
MeterStatsInterval: DefaultMeterStatsInterval,
MeterMetricPrefix: DefaultMeterMetricPrefix,
LoggerLevel: logger.DebugLevel,
LoggerLevel: logger.ErrorLevel,
LoggerObserver: DefaultLoggerObserver,
}
for _, o := range opts {
@@ -177,7 +177,7 @@ func QueryName(ctx context.Context, name string) context.Context {
}
func getQueryName(ctx context.Context) string {
if v, ok := ctx.Value(queryNameKey{}).(string); ok {
if v, ok := ctx.Value(queryNameKey{}).(string); ok && v != labelUnknown {
return v
}
return ""