Skip to content

Commit

Permalink
feat(DMVP-1232): Added RDS widgets for iops, network, performance, cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
viktoryathegreat committed Oct 19, 2023
1 parent fd3b02b commit 89cadda
Show file tree
Hide file tree
Showing 22 changed files with 571 additions and 55 deletions.
3 changes: 3 additions & 0 deletions modules/dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@
| <a name="module_widget_rds_cpu"></a> [widget\_rds\_cpu](#module\_widget\_rds\_cpu) | ./modules/widgets/rds/cpu | n/a |
| <a name="module_widget_rds_db_connections"></a> [widget\_rds\_db\_connections](#module\_widget\_rds\_db\_connections) | ./modules/widgets/rds/db-connections | n/a |
| <a name="module_widget_rds_disk"></a> [widget\_rds\_disk](#module\_widget\_rds\_disk) | ./modules/widgets/rds/disk | n/a |
| <a name="module_widget_rds_iops"></a> [widget\_rds\_iops](#module\_widget\_rds\_iops) | ./modules/widgets/rds/iops | n/a |
| <a name="module_widget_rds_memory"></a> [widget\_rds\_memory](#module\_widget\_rds\_memory) | ./modules/widgets/rds/memory | n/a |
| <a name="module_widget_rds_network"></a> [widget\_rds\_network](#module\_widget\_rds\_network) | ./modules/widgets/rds/network | n/a |
| <a name="module_widget_rds_performance"></a> [widget\_rds\_performance](#module\_widget\_rds\_performance) | ./modules/widgets/rds/performance | n/a |
| <a name="module_widget_sla_slo_sli"></a> [widget\_sla\_slo\_sli](#module\_widget\_sla\_slo\_sli) | ./modules/widgets/sla-slo-sli | n/a |

## Resources
Expand Down
60 changes: 34 additions & 26 deletions modules/dashboard/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,34 @@ locals {

# necessary to always have at least empty list for each widget
widget_defaults = {
"container/cpu" = []
"container/memory" = []
"container/network" = []
"container/network-in" = []
"container/network-out" = []
"container/restarts" = []
"container/replicas" = []
"contaner/request-count" = []
"contaner/response-time" = []
"contaner/external-health-check" = []
"balancer/2xx" = []
"balancer/4xx" = []
"balancer/5xx" = []
"text/title" = []
"log-based" = []
"custom" = []
"application" = []
"logs-insight/logs" = []
"logs-insight/metric" = []
"alarm/status" = []
"alarm/metric" = []
"sla-slo-sli" = []
"rds/cpu" = []
"rds/memory" = []
"rds/disk" = []
"rds/connections" = []
"container/cpu" = []
"container/memory" = []
"container/network" = []
"container/network-in" = []
"container/network-out" = []
"container/restarts" = []
"container/replicas" = []
"container/request-count" = []
"container/response-time" = []
"container/external-health-check" = []
"balancer/2xx" = []
"balancer/4xx" = []
"balancer/5xx" = []
"text/title" = []
"log-based" = []
"custom" = []
"application" = []
"logs-insight/logs" = []
"logs-insight/metric" = []
"alarm/status" = []
"alarm/metric" = []
"sla-slo-sli" = []
"rds/cpu" = []
"rds/memory" = []
"rds/disk" = []
"rds/connections" = []
"rds/network" = []
"rds/performance" = []
}

# widget aliases
Expand Down Expand Up @@ -107,6 +109,9 @@ locals {
rds_memory = local.widget_config["rds/memory"]
rds_disk = local.widget_config["rds/disk"]
rds_connections = local.widget_config["rds/connections"]
rds_network = local.widget_config["rds/network"]
rds_iops = local.widget_config["rds/iops"]
rds_performance = local.widget_config["rds/performance"]

logs_insight_logs = local.widget_config["logs-insight/logs"]
logs_insight_metric = local.widget_config["logs-insight/metric"]
Expand Down Expand Up @@ -152,6 +157,9 @@ locals {
module.widget_rds_memory[*].data,
module.widget_rds_disk[*].data,
module.widget_rds_db_connections[*].data,
module.widget_rds_network[*].data,
module.widget_rds_iops[*].data,
module.widget_rds_performance[*].data,

# logs insights metrics/logs
module.widget_logs_insight_logs[*].data,
Expand Down
1 change: 1 addition & 0 deletions modules/dashboard/modules/widgets/rds/cpu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ No requirements.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_data_source_uid"></a> [data\_source\_uid](#input\_data\_source\_uid) | The grafana dashboard widget item data source id | `string` | n/a | yes |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/dashboard/modules/widgets/rds/cpu/base.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module "base" {

coordinates = var.coordinates

name = "CPUUtilization / ${var.rds_name}"
name = "CPU"

defaults = {
MetricNamespace = "AWS/RDS"
Expand All @@ -20,6 +20,6 @@ module "base" {
period = var.period

metrics = [
{ MetricName = "CPUUtilization" },
{ MetricName = "CPUUtilization", anomaly_detection = var.anomaly_detection },
]
}
6 changes: 6 additions & 0 deletions modules/dashboard/modules/widgets/rds/cpu/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ variable "rds_name" {
type = string
description = "Database name"
}

variable "anomaly_detection" {
type = bool
default = false
description = "Allow to enable anomaly detection on widget metrics"
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ No requirements.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `true` | no |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_data_source_uid"></a> [data\_source\_uid](#input\_data\_source\_uid) | The grafana dashboard widget item data source id | `string` | n/a | yes |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/dashboard/modules/widgets/rds/db-connections/base.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module "base" {

coordinates = var.coordinates

name = "DatabaseConnections / ${var.rds_name}"
name = "Connections"

defaults = {
MetricNamespace = "AWS/RDS"
Expand All @@ -20,6 +20,6 @@ module "base" {
period = var.period

metrics = [
{ MetricName = "DatabaseConnections" },
{ MetricName = "DatabaseConnections", label = "Connections", anomaly_detection = var.anomaly_detection },
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ variable "rds_name" {
type = string
description = "Database name"
}

variable "anomaly_detection" {
type = bool
default = true
description = "Allow to enable anomaly detection on widget metrics"
}
81 changes: 81 additions & 0 deletions modules/dashboard/modules/widgets/rds/iops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_base"></a> [base](#module\_base) | ../../base | n/a |

## Resources

| Name | Type |
|------|------|
| [aws_caller_identity.project](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | n/a | `string` | `null` | no |
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no |
| <a name="input_cluster"></a> [cluster](#input\_cluster) | n/a | `string` | n/a | yes |
| <a name="input_container"></a> [container](#input\_container) | n/a | `string` | n/a | yes |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | n/a | `string` | `"default"` | no |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_data"></a> [data](#output\_data) | n/a |
<!-- END_TF_DOCS -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_base"></a> [base](#module\_base) | ../../base | n/a |

## Resources

| Name | Type |
|------|------|
| [aws_caller_identity.project](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_data_source_uid"></a> [data\_source\_uid](#input\_data\_source\_uid) | The grafana dashboard widget item data source id | `string` | n/a | yes |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |
| <a name="input_platform"></a> [platform](#input\_platform) | The platform/service/adapter to create dashboard on. for now only cloudwatch and grafana supported | `string` | `"cloudwatch"` | no |
| <a name="input_rds_name"></a> [rds\_name](#input\_rds\_name) | Database name | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_data"></a> [data](#output\_data) | n/a |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
26 changes: 26 additions & 0 deletions modules/dashboard/modules/widgets/rds/iops/base.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
data "aws_caller_identity" "project" {
provider = aws
}

module "base" {
source = "../../base"

platform = var.platform
data_source_uid = var.data_source_uid

coordinates = var.coordinates

name = "IOPS"

defaults = {
MetricNamespace = "AWS/RDS"
DBInstanceIdentifier = var.rds_name
}

period = var.period

metrics = [
{ MetricName = "ReadIOPS", anomaly_detection = var.anomaly_detection },
{ MetricName = "WriteIOPS", anomaly_detection = var.anomaly_detection },
]
}
3 changes: 3 additions & 0 deletions modules/dashboard/modules/widgets/rds/iops/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "data" {
value = module.base.data
}
38 changes: 38 additions & 0 deletions modules/dashboard/modules/widgets/rds/iops/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
variable "platform" {
type = string
default = "cloudwatch"
description = "The platform/service/adapter to create dashboard on. for now only cloudwatch and grafana supported"
}

variable "data_source_uid" {
type = string
description = "The grafana dashboard widget item data source id"
}


# position
variable "coordinates" {
type = object({
x : number
y : number
width : number
height : number
})
}

# stats
variable "period" {
type = number
default = 300
}

variable "rds_name" {
type = string
description = "Database name"
}

variable "anomaly_detection" {
type = bool
default = false
description = "Allow to enable anomaly detection on widget metrics"
}
81 changes: 81 additions & 0 deletions modules/dashboard/modules/widgets/rds/network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_base"></a> [base](#module\_base) | ../../base | n/a |

## Resources

| Name | Type |
|------|------|
| [aws_caller_identity.project](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | n/a | `string` | `null` | no |
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no |
| <a name="input_cluster"></a> [cluster](#input\_cluster) | n/a | `string` | n/a | yes |
| <a name="input_container"></a> [container](#input\_container) | n/a | `string` | n/a | yes |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | n/a | `string` | `"default"` | no |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_data"></a> [data](#output\_data) | n/a |
<!-- END_TF_DOCS -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_base"></a> [base](#module\_base) | ../../base | n/a |

## Resources

| Name | Type |
|------|------|
| [aws_caller_identity.project](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_anomaly_detection"></a> [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no |
| <a name="input_coordinates"></a> [coordinates](#input\_coordinates) | position | <pre>object({<br> x : number<br> y : number<br> width : number<br> height : number<br> })</pre> | n/a | yes |
| <a name="input_data_source_uid"></a> [data\_source\_uid](#input\_data\_source\_uid) | The grafana dashboard widget item data source id | `string` | n/a | yes |
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `300` | no |
| <a name="input_platform"></a> [platform](#input\_platform) | The platform/service/adapter to create dashboard on. for now only cloudwatch and grafana supported | `string` | `"cloudwatch"` | no |
| <a name="input_rds_name"></a> [rds\_name](#input\_rds\_name) | Database name | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_data"></a> [data](#output\_data) | n/a |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Loading

0 comments on commit 89cadda

Please sign in to comment.