Skip to content

Commit e6a67e6

Browse files
authored
fix: metrics default interval (#203)
1 parent d6b9ffb commit e6a67e6

4 files changed

Lines changed: 3 additions & 8 deletions

File tree

otgorm/dependency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func provideDBFactory(options *providersOption) func(p factoryIn) (databaseOut,
218218

219219
var collector *collector
220220
if factoryIn.Gauges != nil {
221-
var interval time.Duration
221+
var interval time.Duration = 15 * time.Second
222222
factoryIn.Conf.Unmarshal("gormMetrics.interval", &interval)
223223
collector = newCollector(dbFactory, factoryIn.Gauges, interval)
224224
}

otgorm/module.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"github.com/spf13/cobra"
1212
)
1313

14-
const defaultInterval = 15 * time.Second
15-
1614
// MigrationProvider is an interface for database migrations. modules
1715
// implementing this interface are migration providers. migrations will be
1816
// collected in migrate command.
@@ -49,14 +47,11 @@ type ModuleIn struct {
4947

5048
// New creates a Module.
5149
func New(in ModuleIn) Module {
52-
var duration time.Duration = defaultInterval
53-
in.Conf.Unmarshal("gormMetrics.interval", &duration)
5450
return Module{
5551
maker: in.Maker,
5652
env: in.Env,
5753
logger: in.Logger,
5854
container: in.Container,
59-
interval: duration,
6055
}
6156
}
6257

otkafka/dependency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func provideKafkaFactory(option *providersOption) func(p factoryIn) (factoryOut,
151151
}
152152

153153
if p.ReaderStats != nil || p.WriterStats != nil {
154-
var interval time.Duration
154+
var interval time.Duration = 15 * time.Second
155155
p.Conf.Unmarshal("kafkaMetrics.interval", &interval)
156156
if p.ReaderStats != nil {
157157
readerCollector = newReaderCollector(rf, p.ReaderStats, interval)

otredis/dependency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func provideRedisFactory(option *providersOption) func(p factoryIn) (factoryOut,
164164
}
165165
var collector *collector
166166
if p.Gauges != nil {
167-
var interval time.Duration
167+
var interval time.Duration = 15 * time.Second
168168
p.Conf.Unmarshal("redisMetrics.interval", &interval)
169169
collector = newCollector(redisFactory, p.Gauges, interval)
170170
}

0 commit comments

Comments
 (0)