-
Notifications
You must be signed in to change notification settings - Fork 485
/
cloudwatch.go
36 lines (29 loc) · 1.16 KB
/
cloudwatch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package cloudwatch
import (
"fmt"
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/prometheus/exporter"
"github.com/grafana/agent/pkg/integrations"
"github.com/grafana/agent/pkg/integrations/cloudwatch_exporter"
)
func init() {
component.Register(component.Registration{
Name: "prometheus.exporter.cloudwatch",
Args: Arguments{},
Exports: exporter.Exports{},
Build: exporter.New(createExporter, "cloudwatch"),
})
}
func createExporter(opts component.Options, args component.Arguments, defaultInstanceKey string) (integrations.Integration, string, error) {
a := args.(Arguments)
exporterConfig, err := ConvertToYACE(a)
if err != nil {
return nil, "", fmt.Errorf("invalid cloudwatch exporter configuration: %w", err)
}
// yaceSess expects a default value of True
fipsEnabled := !a.FIPSDisabled
if a.DecoupledScrape.Enabled {
return cloudwatch_exporter.NewDecoupledCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, a.DecoupledScrape.ScrapeInterval, fipsEnabled, a.Debug), getHash(a), nil
}
return cloudwatch_exporter.NewCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, fipsEnabled, a.Debug), getHash(a), nil
}