Skip to content

Commit

Permalink
[coordinator] [query] Enable per-node health status metrics by default (
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington authored Oct 15, 2020
1 parent 59624e7 commit 0a74633
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 7 additions & 1 deletion src/dbnode/client/connection_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ type sleepFn func(t time.Duration)
func newConnectionPool(host topology.Host, opts Options) connectionPool {
seed := int64(murmur3.StringSum32(host.Address()))

scope := opts.InstrumentOptions().
MetricsScope().
Tagged(map[string]string{
"hostID": host.ID(),
})

p := &connPool{
opts: opts,
host: host,
Expand All @@ -96,7 +102,7 @@ func newConnectionPool(host topology.Host, opts Options) connectionPool {
sleepConnect: time.Sleep,
sleepHealth: time.Sleep,
sleepHealthRetry: time.Sleep,
healthStatus: opts.InstrumentOptions().MetricsScope().Gauge("health-status"),
healthStatus: scope.Gauge("health-status"),
}

return p
Expand Down
16 changes: 6 additions & 10 deletions src/dbnode/client/host_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ func newHostQueue(
hostQueueOpts hostQueueOpts,
) (hostQueue, error) {
var (
opts = hostQueueOpts.opts
iOpts = opts.InstrumentOptions()
scopeWithoutHostID = iOpts.MetricsScope().SubScope("hostqueue")
scope = scopeWithoutHostID.Tagged(map[string]string{
"hostID": host.ID(),
})
opts = hostQueueOpts.opts
iOpts = opts.InstrumentOptions()
scope = iOpts.MetricsScope().SubScope("hostqueue")
)
iOpts = iOpts.SetMetricsScope(scope)
opts = opts.SetInstrumentOptions(iOpts.SetMetricsScope(scope))

writeOpBatchSizeBuckets, err := tally.ExponentialValueBuckets(1, 2, 15)
if err != nil {
Expand All @@ -110,8 +108,6 @@ func newHostQueue(
}
workerPool.Init()

opts = opts.SetInstrumentOptions(opts.InstrumentOptions().SetMetricsScope(scope))

size := opts.HostQueueOpsFlushSize()

opsArraysLen := opts.HostQueueOpsArrayPoolSize()
Expand Down Expand Up @@ -143,8 +139,8 @@ func newHostQueue(
size: size,
ops: opArrayPool.Get(),
opsArrayPool: opArrayPool,
writeOpBatchSize: scopeWithoutHostID.Histogram("write-op-batch-size", writeOpBatchSizeBuckets),
fetchOpBatchSize: scopeWithoutHostID.Histogram("fetch-op-batch-size", fetchOpBatchSizeBuckets),
writeOpBatchSize: scope.Histogram("write-op-batch-size", writeOpBatchSizeBuckets),
fetchOpBatchSize: scope.Histogram("fetch-op-batch-size", fetchOpBatchSizeBuckets),
drainIn: make(chan []op, opsArraysLen),
serverSupportsV2APIs: opts.UseV2BatchAPIs(),
}, nil
Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const (
defaultHostQueueOpsArrayPoolSize = 8

// defaultHostQueueEmitsHealthStatus is false
defaultHostQueueEmitsHealthStatus = false
defaultHostQueueEmitsHealthStatus = true

// defaultBackgroundConnectInterval is the default background connect interval
defaultBackgroundConnectInterval = 4 * time.Second
Expand Down

0 comments on commit 0a74633

Please sign in to comment.