Skip to content

Commit

Permalink
Merge pull request #116 from gdashboard/cloudwatch-min-interval
Browse files Browse the repository at this point in the history
CloudWatch metrics: allow configuring min interval
  • Loading branch information
iRevive authored Mar 26, 2024
2 parents 90d7f1e + 383d13a commit b42283a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/bar_gauge.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/gauge.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/stat.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/timeseries.md
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ Optional:
- `hide` (Boolean) Whether to hide query result from the panel or not.
- `label` (String) The legend name.
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
- `min_interval` (String) The lower bounds on the interval between data points.
- `period` (String) The minimum interval between points in seconds.
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
- `region` (String) The AWS region to query the metrics from.
Expand Down
12 changes: 9 additions & 3 deletions internal/provider/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ type CloudWatchMetricsTarget struct {
MatchExact types.Bool `tfsdk:"match_exact"`
Region types.String `tfsdk:"region"`
// etc
RefId types.String `tfsdk:"ref_id"`
Period types.String `tfsdk:"period"`
Label types.String `tfsdk:"label"`
RefId types.String `tfsdk:"ref_id"`
MinInterval types.String `tfsdk:"min_interval"`
Period types.String `tfsdk:"period"`
Label types.String `tfsdk:"label"`
}

type CloudWatchLogGroup struct {
Expand Down Expand Up @@ -720,6 +721,10 @@ func queryBlock() schema.Block {
Optional: true,
Description: "The ID of the query. The ID can be used to reference queries in math expressions.",
},
"min_interval": schema.StringAttribute{
Optional: true,
Description: "The lower bounds on the interval between data points.",
},
"period": schema.StringAttribute{
Optional: true,
Description: "The minimum interval between points in seconds.",
Expand Down Expand Up @@ -1066,6 +1071,7 @@ func createTargets(queries []Query) []grafana.Target {
},
RefID: metrics.RefId.ValueString(),
Hide: metrics.Hide.ValueBool(),
Interval: metrics.MinInterval.ValueString(),
QueryMode: "Metrics",
MetricQueryType: &zero,
MetricEditorMode: &zero,
Expand Down

0 comments on commit b42283a

Please sign in to comment.