Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/metrics/instance/noop.go
4094 views
1
package instance
2
3
import (
4
"context"
5
6
"github.com/prometheus/prometheus/scrape"
7
"github.com/prometheus/prometheus/storage"
8
)
9
10
// NoOpInstance implements the Instance interface in pkg/prom
11
// but does not do anything. Useful for tests.
12
type NoOpInstance struct{}
13
14
// Run implements Instance.
15
func (NoOpInstance) Run(ctx context.Context) error {
16
<-ctx.Done()
17
return nil
18
}
19
20
// Ready implements Instance.
21
func (NoOpInstance) Ready() bool {
22
return true
23
}
24
25
// Update implements Instance.
26
func (NoOpInstance) Update(_ Config) error {
27
return nil
28
}
29
30
// TargetsActive implements Instance.
31
func (NoOpInstance) TargetsActive() map[string][]*scrape.Target {
32
return nil
33
}
34
35
// StorageDirectory implements Instance.
36
func (NoOpInstance) StorageDirectory() string {
37
return ""
38
}
39
40
// Appender implements Instance
41
func (NoOpInstance) Appender(_ context.Context) storage.Appender {
42
return nil
43
}
44
45