-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DMVP-5378): Updated ingress/latency widget
- Loading branch information
1 parent
7a7ac11
commit 4ab432a
Showing
4 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
modules/dashboard/modules/widgets/ingress/latency/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# response-time | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_base"></a> [base](#module\_base) | ../../base | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_acceptable"></a> [acceptable](#input\_acceptable) | The number which indicates the acceptable timeout | `number` | `1` | no | | ||
| <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_anomaly_deviation"></a> [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | | ||
| <a name="input_by_host"></a> [by\_host](#input\_by\_host) | n/a | `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"></a> [data\_source](#input\_data\_source) | The custom datasource for widget item | <pre>object({<br> uid = optional(string, null)<br> type = optional(string, "prometheus")<br> })</pre> | n/a | yes | | ||
| <a name="input_ingress_type"></a> [ingress\_type](#input\_ingress\_type) | n/a | `string` | `"nginx"` | no | | ||
| <a name="input_period"></a> [period](#input\_period) | stats | `number` | `3` | no | | ||
| <a name="input_problem"></a> [problem](#input\_problem) | The number which indicates the max timeout above which we have problem | `number` | `2` | no | | ||
| <a name="input_region"></a> [region](#input\_region) | n/a | `string` | `""` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_data"></a> [data](#output\_data) | n/a | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module "base" { | ||
source = "../../base" | ||
|
||
name = "Latency (${var.ingress_type})${var.by_host ? " by host" : ""} [${var.period}m]" | ||
data_source = var.data_source | ||
coordinates = var.coordinates | ||
period = var.period | ||
region = var.region | ||
anomaly_detection = var.anomaly_detection | ||
anomaly_deviation = var.anomaly_deviation | ||
|
||
defaults = { | ||
MetricNamespace = "ContainerInsights" | ||
accountId = var.account_id | ||
} | ||
|
||
metrics = var.by_host ? [ | ||
{ label : "Avg", color : "7AAFF9", expression : "avg(increase(nginx_ingress_controller_request_duration_seconds_sum[${var.period}m]))" }, | ||
{ label : "__auto", expression : "max by (path) (rate(nginx_ingress_controller_request_duration_seconds_sum[${var.period}m])) > 1" }, | ||
] : [ | ||
{ label = "Avg", color : "FFC300", expression = "avg(rate(nginx_ingress_controller_request_duration_seconds_sum[${var.period}m]))" }, | ||
{ label = "Max", color : "7AAFF9", expression = "max(rate(nginx_ingress_controller_request_duration_seconds_sum[${var.period}m]))" }, | ||
{ label = "Acceptable", color : "3ECE76", expression = "${var.acceptable}" }, | ||
{ label = "Problem", color : "FF0F3C", expression = "${var.problem}" }, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "data" { | ||
value = module.base.data | ||
} |
67 changes: 67 additions & 0 deletions
67
modules/dashboard/modules/widgets/ingress/latency/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
variable "data_source" { | ||
type = object({ | ||
uid = optional(string, null) | ||
type = optional(string, "prometheus") | ||
}) | ||
description = "The custom datasource for widget item" | ||
} | ||
|
||
variable "ingress_type" { | ||
type = string | ||
default = "nginx" | ||
} | ||
|
||
variable "problem" { | ||
type = number | ||
default = 2 | ||
description = "The number which indicates the max timeout above which we have problem" | ||
} | ||
|
||
variable "acceptable" { | ||
type = number | ||
default = 1 | ||
description = "The number which indicates the acceptable timeout" | ||
} | ||
|
||
variable "account_id" { | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
# position | ||
variable "coordinates" { | ||
type = object({ | ||
x : number | ||
y : number | ||
width : number | ||
height : number | ||
}) | ||
} | ||
|
||
# stats | ||
variable "period" { | ||
type = number | ||
default = 3 | ||
} | ||
|
||
variable "by_host" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "anomaly_detection" { | ||
type = bool | ||
default = false | ||
description = "Allow to enable anomaly detection on widget metrics" | ||
} | ||
|
||
variable "anomaly_deviation" { | ||
type = number | ||
default = 6 | ||
description = "Deviation of the anomaly band" | ||
} |