Skip to content

Commit

Permalink
fix metrics tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cottand committed Jan 8, 2024
1 parent 32f7bbc commit d596c52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions grimd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func integrationTest(changeConfig func(c *Config), test func(client *dns.Client,
// QuestionCache contains all queries to the dns server
questionCache := makeQuestionCache(config.QuestionCacheCap)

reloadChan := make(chan bool)
_, _ = StartAPIServer(&config, reloadChan, blockCache, questionCache)
defer close(reloadChan)
server.Run(&config, blockCache, questionCache)

time.Sleep(200 * time.Millisecond)
Expand Down
7 changes: 5 additions & 2 deletions internal/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ var (
configHighCardinality = false
)

func Start(resetPeriodMinutes int64, highCardinality bool) (closeChan context.CancelFunc) {
configHighCardinality = highCardinality
func init() {
prometheus.MustRegister(
responseCounter,
RequestUpstreamResolveCounter,
RequestUpstreamDohRequest,
CustomDNSConfigReload,
DohResponseCount,
)
}

func Start(resetPeriodMinutes int64, highCardinality bool) (closeChan context.CancelFunc) {
configHighCardinality = highCardinality
ctx, cancel := context.WithCancel(context.Background())
mark := time.Now()

Expand Down

0 comments on commit d596c52

Please sign in to comment.