Skip to content

Commit d837a16

Browse files
Add query_plans_per_minute to query insights (#6720) (#12951)
Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent d2a3e31 commit d837a16

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

.changelog/6720.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
sql: added `query_plan_per_minute` field to `insights_config` in `google_sql_database_instance` resource
3+
```

google/resource_sql_database_instance.go

+11
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ var (
8181
"settings.0.insights_config.0.query_string_length",
8282
"settings.0.insights_config.0.record_application_tags",
8383
"settings.0.insights_config.0.record_client_address",
84+
"settings.0.insights_config.0.query_plans_per_minute",
8485
}
8586
)
8687

@@ -466,6 +467,14 @@ is set to true. Defaults to ZONAL.`,
466467
AtLeastOneOf: insightsConfigKeys,
467468
Description: `True if Query Insights will record client address when enabled.`,
468469
},
470+
"query_plans_per_minute": {
471+
Type: schema.TypeInt,
472+
Optional: true,
473+
Computed: true,
474+
ValidateFunc: validation.IntBetween(0, 20),
475+
AtLeastOneOf: insightsConfigKeys,
476+
Description: `Number of query execution plans captured by Insights per minute for all queries combined. Between 0 and 20. Default to 5.`,
477+
},
469478
},
470479
},
471480
Description: `Configuration of Query Insights.`,
@@ -1253,6 +1262,7 @@ func expandInsightsConfig(configured []interface{}) *sqladmin.InsightsConfig {
12531262
QueryStringLength: int64(_insightsConfig["query_string_length"].(int)),
12541263
RecordApplicationTags: _insightsConfig["record_application_tags"].(bool),
12551264
RecordClientAddress: _insightsConfig["record_client_address"].(bool),
1265+
QueryPlansPerMinute: int64(_insightsConfig["query_plans_per_minute"].(int)),
12561266
}
12571267
}
12581268

@@ -1806,6 +1816,7 @@ func flattenInsightsConfig(insightsConfig *sqladmin.InsightsConfig) interface{}
18061816
"query_string_length": insightsConfig.QueryStringLength,
18071817
"record_application_tags": insightsConfig.RecordApplicationTags,
18081818
"record_client_address": insightsConfig.RecordClientAddress,
1819+
"query_plans_per_minute": insightsConfig.QueryPlansPerMinute,
18091820
}
18101821

18111822
return []map[string]interface{}{data}

google/resource_sql_database_instance_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,7 @@ resource "google_sql_database_instance" "instance" {
22122212
query_string_length = 256
22132213
record_application_tags = true
22142214
record_client_address = true
2215+
query_plans_per_minute = 10
22152216
}
22162217
}
22172218
}

website/docs/r/sql_database_instance.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ The optional `settings.insights_config` subblock for instances declares [Query I
353353

354354
* `record_client_address` - True if Query Insights will record client address when enabled.
355355

356+
* `query_plans_per_minute` - Number of query execution plans captured by Insights per minute for all queries combined. Between 0 and 20. Default to 5.
357+
356358
The optional `settings.password_validation_policy` subblock for instances declares [Password Validation Policy](https://cloud.google.com/sql/docs/postgres/built-in-authentication) configuration. It contains:
357359

358360
* `min_length` - Specifies the minimum number of characters that the password must have.

0 commit comments

Comments
 (0)