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

dashboard: add markdown section with Logs Explorer link #326

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions modules/bucket-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ No requirements.
| <a name="module_http"></a> [http](#module\_http) | ../dashboard/sections/http | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../dashboard/sections/layout | n/a |
| <a name="module_logs"></a> [logs](#module\_logs) | ../dashboard/sections/logs | n/a |
| <a name="module_logurl"></a> [logurl](#module\_logurl) | ../logurl | n/a |
| <a name="module_markdown"></a> [markdown](#module\_markdown) | ../sections/markdown | n/a |
| <a name="module_resources"></a> [resources](#module\_resources) | ../dashboard/sections/resources | n/a |
| <a name="module_this"></a> [this](#module\_this) | ../regional-go-service | n/a |
| <a name="module_topic"></a> [topic](#module\_topic) | ../dashboard/sections/topic | n/a |
Expand Down
20 changes: 20 additions & 0 deletions modules/bucket-events/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_revision"
"resource.labels.service_name" = var.name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "topic" {
source = "../dashboard/sections/topic"
title = "Notification Topic"
Expand Down Expand Up @@ -31,6 +50,7 @@ module "width" { source = "../dashboard/sections/width" }
module "layout" {
source = "../dashboard/sections/layout"
sections = [
module.markdown.section,
module.topic.section,
module.logs.section,
module.http.section,
Expand Down
2 changes: 2 additions & 0 deletions modules/cloudevent-broker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ No requirements.
| <a name="module_http"></a> [http](#module\_http) | ../dashboard/sections/http | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../dashboard/sections/layout | n/a |
| <a name="module_logs"></a> [logs](#module\_logs) | ../dashboard/sections/logs | n/a |
| <a name="module_logurl"></a> [logurl](#module\_logurl) | ../logurl | n/a |
| <a name="module_markdown"></a> [markdown](#module\_markdown) | ../sections/markdown | n/a |
| <a name="module_resources"></a> [resources](#module\_resources) | ../dashboard/sections/resources | n/a |
| <a name="module_this"></a> [this](#module\_this) | ../regional-go-service | n/a |
| <a name="module_topic"></a> [topic](#module\_topic) | ../dashboard/sections/topic | n/a |
Expand Down
20 changes: 20 additions & 0 deletions modules/cloudevent-broker/ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ module "this" {
notification_channels = var.notification_channels
}

module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_revision"
"resource.labels.service_name" = var.name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "topic" {
source = "../dashboard/sections/topic"
title = "Broker Events"
Expand Down Expand Up @@ -84,6 +103,7 @@ module "width" { source = "../dashboard/sections/width" }
module "layout" {
source = "../dashboard/sections/layout"
sections = [
module.markdown.section,
module.topic.section,
module.logs.section,
module.http.section,
Expand Down
20 changes: 20 additions & 0 deletions modules/dashboard/cloudevent-receiver/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_revision"
"resource.labels.service_name" = var.service_name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "subscription" {
for_each = var.triggers

Expand Down Expand Up @@ -56,6 +75,7 @@ module "width" { source = "../sections/width" }
module "layout" {
source = "../sections/layout"
sections = concat(
[module.markdown.section],
[for key in sort(keys(var.triggers)) : module.subscription[key].section],
[
module.errgrp.section,
Expand Down
2 changes: 2 additions & 0 deletions modules/dashboard/job/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ No requirements.
| <a name="module_errgrp"></a> [errgrp](#module\_errgrp) | ../sections/errgrp | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../sections/layout | n/a |
| <a name="module_logs"></a> [logs](#module\_logs) | ../sections/logs | n/a |
| <a name="module_logurl"></a> [logurl](#module\_logurl) | ../logurl | n/a |
| <a name="module_markdown"></a> [markdown](#module\_markdown) | ../sections/markdown | n/a |
| <a name="module_resources"></a> [resources](#module\_resources) | ../sections/resources | n/a |
| <a name="module_width"></a> [width](#module\_width) | ../sections/width | n/a |

Expand Down
20 changes: 20 additions & 0 deletions modules/dashboard/job/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_job"
"resource.labels.service_name" = var.job_name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "errgrp" {
source = "../sections/errgrp"
title = "Job Error Reporting"
Expand All @@ -24,6 +43,7 @@ module "width" { source = "../sections/width" }
module "layout" {
source = "../sections/layout"
sections = [
module.markdown.section,
module.errgrp.section,
module.logs.section,
module.resources.section,
Expand Down
31 changes: 31 additions & 0 deletions modules/dashboard/logurl/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_params"></a> [params](#input\_params) | n/a | `map(string)` | n/a | yes |
| <a name="input_project"></a> [project](#input\_project) | n/a | `string` | n/a | yes |
| <a name="input_text"></a> [text](#input\_text) | n/a | `string` | `"Logs Explorer"` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_markdown"></a> [markdown](#output\_markdown) | n/a |
<!-- END_TF_DOCS -->

Check failure on line 31 in modules/dashboard/logurl/README.md

View workflow job for this annotation

GitHub Actions / Lint

[EOF Newline] reported by reviewdog 🐶 Missing newline Raw Output: modules/dashboard/logurl/README.md:31: Missing newline
12 changes: 12 additions & 0 deletions modules/dashboard/logurl/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variable "text" { default = "Logs Explorer" }
variable "project" { type = string }
variable "params" { type = map(string) }

locals {
params = urlencode(join("\n", [for key, value in var.params : "${key}=\"${value}\""]))
link = "https://console.cloud.google.com/logs/query;query=${local.params}?project=${var.project}"
}

output "markdown" {
value = "[${var.text}](${local.link})"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

## Modules

No modules.
| Name | Source | Version |
|------|--------|---------|
| <a name="module_width"></a> [width](#module\_width) | ../width | n/a |

## Resources

Expand All @@ -26,5 +28,5 @@

| Name | Description |
|------|-------------|
| <a name="output_widget"></a> [widget](#output\_widget) | https://cloud.google.com/monitoring/api/ref_v3/rest/v1/projects.dashboards#Text |
<!-- END_TF_DOCS -->
| <a name="output_section"></a> [section](#output\_section) | n/a |
<!-- END_TF_DOCS -->

Check failure on line 32 in modules/dashboard/sections/markdown/README.md

View workflow job for this annotation

GitHub Actions / Lint

[EOF Newline] reported by reviewdog 🐶 Missing newline Raw Output: modules/dashboard/sections/markdown/README.md:32: Missing newline
20 changes: 20 additions & 0 deletions modules/dashboard/sections/markdown/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "title" { type = string }
variable "content" { type = string }

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

output "section" {
value = [{
yPos = 0
xPos = 0
height = 3
width = module.width.size,
widget = {
title = var.title
text = {
format = "MARKDOWN"
content = var.content
}
}
}]
}
20 changes: 20 additions & 0 deletions modules/dashboard/service/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_revision"
"resource.labels.service_name" = var.service_name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "errgrp" {
source = "../sections/errgrp"
title = "Service Error Reporting"
Expand Down Expand Up @@ -59,6 +78,7 @@ module "width" { source = "../sections/width" }
module "layout" {
source = "../sections/layout"
sections = concat(
module.markdown.section,
[for x in keys(var.alerts) : module.alerts[x].section],
[
module.errgrp.section,
Expand Down
11 changes: 0 additions & 11 deletions modules/dashboard/widgets/markdown/main.tf

This file was deleted.

2 changes: 2 additions & 0 deletions modules/github-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ No requirements.
| <a name="module_http"></a> [http](#module\_http) | ../dashboard/sections/http | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../dashboard/sections/layout | n/a |
| <a name="module_logs"></a> [logs](#module\_logs) | ../dashboard/sections/logs | n/a |
| <a name="module_logurl"></a> [logurl](#module\_logurl) | ../logurl | n/a |
| <a name="module_markdown"></a> [markdown](#module\_markdown) | ../sections/markdown | n/a |
| <a name="module_resources"></a> [resources](#module\_resources) | ../dashboard/sections/resources | n/a |
| <a name="module_this"></a> [this](#module\_this) | ../regional-go-service | n/a |
| <a name="module_trampoline-emits-events"></a> [trampoline-emits-events](#module\_trampoline-emits-events) | ../authorize-private-service | n/a |
Expand Down
20 changes: 20 additions & 0 deletions modules/github-events/dashboard.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
module "logurl" {
source = "../logurl"

text = "Logs Explorer"
project = var.project_id
params = {
"resource.type" = "cloud_run_revision"
"resource.labels.service_name" = var.name
}
}

module "markdown" {
source = "../sections/markdown"
title = "Overview"
content = <<EOM
# ${module.logurl.markdown}
EOM
}

module "logs" {
source = "../dashboard/sections/logs"
title = "Service Logs"
Expand Down Expand Up @@ -25,6 +44,7 @@ module "width" { source = "../dashboard/sections/width" }
module "layout" {
source = "../dashboard/sections/layout"
sections = [
module.markdown.section,
module.logs.section,
module.http.section,
module.resources.section,
Expand Down
Loading