-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-custom-http-metrics-dash
Signed-off-by: Nghia Tran <[email protected]>
- Loading branch information
Showing
17 changed files
with
303 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,34 @@ | ||
variable "title" { type = string } | ||
variable "collapsed" { default = false } | ||
variable "alert" { type = string } | ||
|
||
module "width" { source = "../width" } | ||
|
||
module "alert" { | ||
source = "../../widgets/alert" | ||
title = var.title | ||
alert_name = var.alert | ||
} | ||
|
||
locals { | ||
tiles = [{ | ||
yPos = 0 | ||
xPos = 0 | ||
height = 3 | ||
width = module.width.size | ||
widget = module.alert.widget | ||
}] | ||
} | ||
|
||
module "collapsible" { | ||
source = "../collapsible" | ||
|
||
// If no alert is defined, this is an empty collapsed section. | ||
title = var.title | ||
tiles = local.tiles | ||
collapsed = var.collapsed | ||
} | ||
|
||
output "section" { | ||
value = module.collapsible.section | ||
} |
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
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
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
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
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,68 @@ | ||
# `otel-collector` | ||
|
||
This module encapsulates producing a sidecar image for publishing otel collected | ||
metrics, and granting the service account as which the sidecar runs permission | ||
to write those metrics (so it's impossible to forget): | ||
|
||
``` | ||
module "otel-collector" { | ||
source = "chainguard-dev/cloudrun/glue//otel-collector" | ||
project_id = var.project_id | ||
service_account = google_service_account.this.email | ||
} | ||
resource "google_cloud_run_v2_service" "this" { | ||
template { | ||
service_account = google_service_account.this.email | ||
containers { | ||
image = "..." | ||
// Specifying port is necessary when there are multiple containers. | ||
ports { container_port = 8080 } | ||
} | ||
// Install the sidecar! | ||
containers { image = module.otel-collector.image } | ||
} | ||
} | ||
``` | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_cosign"></a> [cosign](#provider\_cosign) | n/a | | ||
| <a name="provider_google"></a> [google](#provider\_google) | n/a | | ||
| <a name="provider_ko"></a> [ko](#provider\_ko) | n/a | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [cosign_sign.otel-image](https://registry.terraform.io/providers/chainguard-dev/cosign/latest/docs/resources/sign) | resource | | ||
| [google_project_iam_member.metrics-writer](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member) | resource | | ||
| [ko_build.otel-image](https://registry.terraform.io/providers/ko-build/ko/latest/docs/resources/build) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_otel_collector_image"></a> [otel\_collector\_image](#input\_otel\_collector\_image) | The otel collector image to use as a base. | `string` | `"cgr.dev/chainguard/opentelemetry-collector-contrib:latest"` | no | | ||
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes | | ||
| <a name="input_service_account"></a> [service\_account](#input\_service\_account) | The service account as which the collector will run. | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_image"></a> [image](#output\_image) | n/a | | ||
<!-- END_TF_DOCS --> |
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,68 @@ | ||
receivers: | ||
prometheus: | ||
config: | ||
scrape_configs: | ||
- job_name: "localhost" | ||
scrape_interval: 10s | ||
static_configs: | ||
# TODO: make this configurable | ||
- targets: ["localhost:2112"] | ||
metric_relabel_configs: | ||
- source_labels: [ __name__ ] | ||
regex: '^prometheus_.*' | ||
action: drop | ||
- source_labels: [ __name__ ] | ||
regex: '^process_.*' | ||
action: drop | ||
- source_labels: [ __name__ ] | ||
regex: '^go_.*' | ||
action: drop | ||
|
||
processors: | ||
batch: | ||
# batch metrics before sending to reduce API usage | ||
send_batch_max_size: 200 | ||
send_batch_size: 200 | ||
timeout: 5s | ||
|
||
memory_limiter: | ||
# drop metrics if memory usage gets too high | ||
check_interval: 1s | ||
limit_percentage: 65 | ||
spike_limit_percentage: 20 | ||
|
||
# automatically detect Cloud Run resource metadata | ||
resourcedetection: | ||
detectors: [env, gcp] | ||
timeout: 2s | ||
override: false | ||
|
||
resource: | ||
attributes: | ||
# add instance_id as a resource attribute | ||
- key: service.instance.id | ||
from_attribute: faas.id | ||
action: upsert | ||
# parse service name from K_SERVICE Cloud Run variable | ||
- key: service.name | ||
value: ${env:K_SERVICE} | ||
action: insert | ||
|
||
exporters: | ||
googlemanagedprometheus: | ||
|
||
extensions: | ||
health_check: | ||
|
||
service: | ||
telemetry: | ||
logs: | ||
# We don't want to see scraper startup logging every | ||
# cold start. | ||
level: "error" | ||
extensions: [health_check] | ||
pipelines: | ||
metrics: | ||
receivers: [prometheus] | ||
processors: [batch, memory_limiter, resourcedetection, resource] | ||
exporters: [googlemanagedprometheus] |
Oops, something went wrong.