Skip to content

Commit 48ed5b1

Browse files
committed
added limits to 500 metrics queries
1 parent fd5d80f commit 48ed5b1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

cmd/root.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ const (
3737
appName = "aws_cloudwatch_exporter"
3838
appDescription = `AWS CloudWatch exporter for prometheus.io
3939
This exporter use GetMetricData API to get the metrics from AWS CloudWatch`
40-
appDescriptionShort = "AWS CloudWatch exporter for prometheus.io"
41-
appGitRepository = "https://github.com/slashdevops/aws_cloudwatch_exporter"
42-
appMetricsPath = "/metrics"
43-
appHealthPath = "/health"
44-
appIP = "127.0.0.1"
45-
appPort = 9690
40+
appDescriptionShort = "AWS CloudWatch exporter for prometheus.io"
41+
appGitRepository = "https://github.com/slashdevops/aws_cloudwatch_exporter"
42+
appMetricsPath = "/metrics"
43+
appHealthPath = "/health"
44+
appIP = "127.0.0.1"
45+
appPort = 9690
46+
appMaxMetricsQueries = 500
4647
)
4748

4849
// rootCmd represents the base command when called without any subcommands
@@ -239,6 +240,11 @@ func validateMetricsQueries(c *config.All) {
239240
} else {
240241
log.Fatal("Metrics Queries are empty, you need to define at least one metric in metrics file")
241242
}
243+
244+
// TODO: Allow more that 500 metrics queries and remove it
245+
if len(c.MetricDataQueries) > appMaxMetricsQueries {
246+
log.Fatal("You have defined %v metrics queries, the limits is %v", len(c.MetricDataQueries), appMaxMetricsQueries)
247+
}
242248
}
243249

244250
func fileExists(filename string) bool {

0 commit comments

Comments
 (0)