Skip to content

Commit

Permalink
Add gRPC outbounds, remove grpc_service_name (#44)
Browse files Browse the repository at this point in the history
This makes use of what we added in #42

Signed-off-by: Nghia Tran <[email protected]>
  • Loading branch information
tcnghia authored Dec 24, 2023
1 parent b4e194f commit bb4faf3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
49 changes: 46 additions & 3 deletions dashboard/sections/grpc/grpc.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "title" { type = string }
variable "filter" { type = list(string) }
variable "collapsed" { default = false }
variable "grpc_service_name" { type = string }
variable "service_name" { type = string }

module "width" { source = "../width" }

Expand All @@ -10,7 +10,7 @@ module "request_count" {
title = "Request count"
filter = concat(var.filter, [
"metric.type=\"prometheus.googleapis.com/grpc_server_handled_total/counter\"",
"metric.label.grpc_service=monitoring.regex.full_match(\"${var.grpc_service_name}.*\")",
"resource.label.\"job\"=\"${var.service_name}\"",
])
group_by_fields = [
"metric.label.\"grpc_service\"",
Expand All @@ -28,7 +28,38 @@ module "incoming_latency" {
title = "Incoming request latency"
filter = concat(var.filter, [
"metric.type=\"prometheus.googleapis.com/grpc_server_handling_seconds/histogram\"",
"metric.label.\"grpc_service\"=monitoring.regex.full_match(\"${var.grpc_service_name}.*\")",
"resource.label.\"job\"=\"${var.service_name}\"",
])
group_by_fields = [
"metric.label.\"grpc_service\"",
"metric.label.\"grpc_method\"",
]
}

module "outbound_request_count" {
source = "../../widgets/xy"
title = "Outbound request count"
filter = concat(var.filter, [
"metric.type=\"prometheus.googleapis.com/grpc_client_handled_total/counter\"",
"resource.label.\"job\"=\"${var.service_name}\"",
])
group_by_fields = [
"metric.label.\"grpc_service\"",
"metric.label.\"grpc_method\"",
"metric.label.\"grpc_code\""
]
primary_align = "ALIGN_RATE"
primary_reduce = "REDUCE_NONE"
secondary_align = "ALIGN_NONE"
secondary_reduce = "REDUCE_SUM"
}

module "outbound_latency" {
source = "../../widgets/latency"
title = "Outbound request latency"
filter = concat(var.filter, [
"metric.type=\"prometheus.googleapis.com/grpc_client_handling_seconds/histogram\"",
"resource.label.\"job\"=\"${var.service_name}\"",
])
group_by_fields = [
"metric.label.\"grpc_service\"",
Expand Down Expand Up @@ -57,6 +88,18 @@ locals {
height = local.unit,
width = local.unit,
widget = module.incoming_latency.widget,
}, {
yPos = local.unit
xPos = local.col[0],
height = local.unit,
width = local.unit,
widget = module.outbound_request_count.widget,
}, {
yPos = local.unit
xPos = local.col[1],
height = local.unit,
width = local.unit,
widget = module.outbound_latency.widget,
},
]
}
Expand Down
1 change: 0 additions & 1 deletion dashboard/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ No requirements.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_alerts"></a> [alerts](#input\_alerts) | Alerting policies to add to the dashboard. | `list(string)` | `[]` | no |
| <a name="input_grpc_service_name"></a> [grpc\_service\_name](#input\_grpc\_service\_name) | Name of the GRPC service(s) to monitor | `string` | `""` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Additional labels to apply to the dashboard. | `map` | `{}` | no |
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | Name of the service(s) to monitor | `string` | n/a | yes |

Expand Down
2 changes: 1 addition & 1 deletion dashboard/service/dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "grpc" {
source = "../sections/grpc"
title = "GRPC"
filter = []
grpc_service_name = var.grpc_service_name
service_name = var.service_name
}

module "resources" {
Expand Down
8 changes: 0 additions & 8 deletions dashboard/service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ variable "alerts" {
default = []
}

# Currently our metrics does not have service_name label: we
# are working around by specifying the grpc_service name label
# instead while we fix the metric labeling.
variable "grpc_service_name" {
description = "Name of the GRPC service(s) to monitor"
type = string
default = ""
}

0 comments on commit bb4faf3

Please sign in to comment.