Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add error reporting widget and add it to service dashboard #99

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions modules/dashboard/sections/errgrp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_collapsible"></a> [collapsible](#module\_collapsible) | ../collapsible | n/a |
| <a name="module_errgrp"></a> [errgrp](#module\_errgrp) | ../../widgets/errgrp | n/a |
| <a name="module_width"></a> [width](#module\_width) | ../width | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_collapsed"></a> [collapsed](#input\_collapsed) | n/a | `bool` | `false` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | n/a | `string` | n/a | yes |
| <a name="input_title"></a> [title](#input\_title) | n/a | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_section"></a> [section](#output\_section) | n/a |
<!-- END_TF_DOCS -->
35 changes: 35 additions & 0 deletions modules/dashboard/sections/errgrp/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
variable "title" { type = string }
variable "collapsed" { default = false }
variable "project_id" { type = string }
variable "service_name" { type = string }

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

module "errgrp" {
source = "../../widgets/errgrp"
title = var.title
project_id = var.project_id
service_name = var.service_name
}

locals {
tiles = [{
yPos = 0
xPos = 0,
height = module.width.size,
width = module.width.size / 4,
widget = module.errgrp.widget,
}]
}

module "collapsible" {
source = "../collapsible"

title = var.title
tiles = local.tiles
collapsed = var.collapsed
}

output "section" {
value = module.collapsible.section
}
2 changes: 2 additions & 0 deletions modules/dashboard/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ No requirements.
| Name | Source | Version |
|------|--------|---------|
| <a name="module_alerts"></a> [alerts](#module\_alerts) | ../sections/alerts | n/a |
| <a name="module_errgrp"></a> [errgrp](#module\_errgrp) | ../sections/errgrp | n/a |
| <a name="module_grpc"></a> [grpc](#module\_grpc) | ../sections/grpc | n/a |
| <a name="module_http"></a> [http](#module\_http) | ../sections/http | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../sections/layout | n/a |
Expand All @@ -81,6 +82,7 @@ No requirements.
|------|-------------|------|---------|:--------:|
| <a name="input_alerts"></a> [alerts](#input\_alerts) | Alerting policies to add to the dashboard. | `list(string)` | `[]` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Additional labels to apply to the dashboard. | `map` | `{}` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | ID of the GCP project | `string` | n/a | yes |
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | Name of the service(s) to monitor | `string` | n/a | yes |

## Outputs
Expand Down
8 changes: 8 additions & 0 deletions modules/dashboard/service/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
module "errgrp" {
source = "../sections/errgrp"
title = "Service Error Reporting"
project_id = var.project_id
service_name = var.service_name
}

module "logs" {
source = "../sections/logs"
title = "Service Logs"
Expand Down Expand Up @@ -39,6 +46,7 @@ module "layout" {
sections = concat(
[for x in var.alerts : module.alerts[x].section],
[
module.errgrp.section,
module.logs.section,
module.http.section,
module.grpc.section,
Expand Down
4 changes: 4 additions & 0 deletions modules/dashboard/service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ variable "alerts" {
default = []
}

variable "project_id" {
description = "ID of the GCP project"
type = string
}
31 changes: 31 additions & 0 deletions modules/dashboard/widgets/errgrp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

No modules.

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
| <a name="input_service_name"></a> [service\_name](#input\_service\_name) | n/a | `string` | n/a | yes |
| <a name="input_title"></a> [title](#input\_title) | n/a | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_widget"></a> [widget](#output\_widget) | https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards#ErrorReportingPanel |
<!-- END_TF_DOCS -->
14 changes: 14 additions & 0 deletions modules/dashboard/widgets/errgrp/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "title" { type = string }
variable "project_id" { type = string }
variable "service_name" { type = string }

// https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards#ErrorReportingPanel
output "widget" {
value = {
title = var.title
errorReportingPanel = {
projectNames = ["projects/${var.project_id}"]
services = [var.service_name]
}
}
}
5 changes: 4 additions & 1 deletion modules/dashboard/widgets/latency/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
variable "title" { type = string }
variable "group_by_fields" { default = [] }
variable "filter" { type = list(string) }
variable "band" { type = number, default = 99 }
variable "band" {
type = number
default = 99
}

// https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards#XyChart
output "widget" {
Expand Down
Loading