-
Notifications
You must be signed in to change notification settings - Fork 538
Expand file tree
/
Copy pathcloudwatch.go
More file actions
40 lines (33 loc) · 1.41 KB
/
cloudwatch.go
File metadata and controls
40 lines (33 loc) · 1.41 KB
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
37
38
39
40
package cloudwatch
import (
"fmt"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/component/prometheus/exporter"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/static/integrations"
"github.com/grafana/alloy/internal/static/integrations/cloudwatch_exporter"
)
func init() {
component.Register(component.Registration{
Name: "prometheus.exporter.cloudwatch",
Stability: featuregate.StabilityGenerallyAvailable,
Args: Arguments{},
Exports: exporter.Exports{},
Build: exporter.New(createExporter, "cloudwatch"),
})
}
func createExporter(opts component.Options, args component.Arguments) (integrations.Integration, string, error) {
a := args.(Arguments)
exporterConfig, err := ConvertToYACE(a, opts.Logger)
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 {
exp, err := cloudwatch_exporter.NewDecoupledCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, a.DecoupledScrape.ScrapeInterval, fipsEnabled, a.LabelsSnakeCase, a.Debug, a.UseAWSSDKVersion2)
return exp, getHash(a), err
}
exp, err := cloudwatch_exporter.NewCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, fipsEnabled, a.LabelsSnakeCase, a.Debug, a.UseAWSSDKVersion2)
return exp, getHash(a), err
}