Skip to content

Commit

Permalink
add pgbouncer
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Dec 12, 2023
1 parent 89b8771 commit 5a20d71
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion database/pgbouncer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Creates DataDog monitors with the following checks:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_environment"></a> [environment](#input\_environment) | Environment | `string` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Architecture Environment | `string` | n/a | yes |
| <a name="input_evaluation_delay"></a> [evaluation\_delay](#input\_evaluation\_delay) | Delay in seconds for the metric evaluation | `number` | `15` | no |
| <a name="input_filter_tags_custom"></a> [filter\_tags\_custom](#input\_filter\_tags\_custom) | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no |
| <a name="input_filter_tags_custom_excluded"></a> [filter\_tags\_custom\_excluded](#input\_filter\_tags\_custom\_excluded) | Tags excluded for custom filtering when filter\_tags\_use\_defaults is false | `string` | `""` | no |
Expand Down Expand Up @@ -91,6 +91,8 @@ Creates DataDog monitors with the following checks:
| <a name="input_pgbouncer_wait_time_time_aggregator"></a> [pgbouncer\_wait\_time\_time\_aggregator](#input\_pgbouncer\_wait\_time\_time\_aggregator) | Monitor time aggregator for PGBouncer connection monitor [available values: min, max or avg] | `string` | `"avg"` | no |
| <a name="input_pgbouncer_wait_time_timeframe"></a> [pgbouncer\_wait\_time\_timeframe](#input\_pgbouncer\_wait\_time\_timeframe) | Monitor timeframe for PGBouncer connection monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no |
| <a name="input_prefix_slug"></a> [prefix\_slug](#input\_prefix\_slug) | Prefix string to prepend between brackets on every monitors names | `string` | `""` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Global variables | `list(string)` | <pre>[<br> "type:database",<br> "provider:pgbouncer",<br> "resource:pgbouncer"<br>]</pre> | no |
| <a name="input_team"></a> [team](#input\_team) | n/a | `string` | `"claranet"` | no |
| <a name="input_timeout_h"></a> [timeout\_h](#input\_timeout\_h) | Default auto-resolving state (in hours) | `number` | `0` | no |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions database/pgbouncer/common-inputs.tf
1 change: 1 addition & 0 deletions database/pgbouncer/common-locals.tf
7 changes: 4 additions & 3 deletions database/pgbouncer/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
variable "environment" {
description = "Environment"
type = string
# Global variables
variable "tags" {
type = list(string)
default = ["type:database", "provider:pgbouncer", "resource:pgbouncer"]
}

# Global DataDog
Expand Down
8 changes: 4 additions & 4 deletions database/pgbouncer/monitors-pgbouncer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ EOQ
include_tags = true
require_full_window = true

tags = concat(["env:${var.environment}", "type:database", "provider:pgbouncer", "resource:pgbouncer", "team:claranet", "created-by:terraform"], var.pgbouncer_availability_extra_tags)
tags = concat(local.common_tags, var.tags, var.pgbouncer_availability_extra_tags)
}

resource "datadog_monitor" "pgbouncer_pool_connection_limit" {
Expand Down Expand Up @@ -51,7 +51,7 @@ EOQ
timeout_h = 0
include_tags = true

tags = concat(["env:${var.environment}", "type:database", "provider:pgbouncer", "resource:pgbouncer", "team:claranet", "created-by:terraform"], var.pgbouncer_pool_connection_limit_extra_tags)
tags = concat(local.common_tags, var.tags, var.pgbouncer_pool_connection_limit_extra_tags)
}

resource "datadog_monitor" "pgbouncer_database_connection_limit" {
Expand Down Expand Up @@ -80,7 +80,7 @@ EOQ
timeout_h = 0
include_tags = true

tags = concat(["env:${var.environment}", "type:database", "provider:pgbouncer", "resource:pgbouncer", "team:claranet", "created-by:terraform"], var.pgbouncer_database_connection_limit_extra_tags)
tags = concat(local.common_tags, var.tags, var.pgbouncer_database_connection_limit_extra_tags)
}

resource "datadog_monitor" "pgbouncer_wait_time" {
Expand Down Expand Up @@ -108,5 +108,5 @@ EOQ
timeout_h = 0
include_tags = true

tags = concat(["env:${var.environment}", "type:database", "provider:pgbouncer", "resource:pgbouncer", "team:claranet", "created-by:terraform"], var.pgbouncer_wait_time_extra_tags)
tags = concat(local.common_tags, var.tags, var.pgbouncer_wait_time_extra_tags)
}

0 comments on commit 5a20d71

Please sign in to comment.