Skip to content

Commit

Permalink
Merge pull request #105 from philips-labs/feature/hsdp-metrics-exporter
Browse files Browse the repository at this point in the history
Add optional HSDP Metrics exporter
  • Loading branch information
loafoe authored Oct 15, 2022
2 parents 3b422a9 + c7a1451 commit 7d0cfcc
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## v6.1.0

- Add optional HSDP Metrics exporter

## v6.0.0

- BREAKING: requires Terraform 1.3.0 or newer

## v5.5.0

- Support for remote writes
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM prom/prometheus:v2.38.0 AS prometheus
FROM prom/prometheus:v2.39.1 AS prometheus

FROM thanosio/thanos:v0.28.1 AS thanos

Expand Down
41 changes: 41 additions & 0 deletions hsdp_metrics_exporter.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
resource "cloudfoundry_app" "hsdp_metrics_exporter" {
count = var.enable_hsdp_metrics_exporter ? 1 : 0

name = "tf-hsdp-metrics-exporter-${local.postfix}"
space = var.cf_space_id
memory = var.hsdp_metrics_exporter.memory
disk_quota = var.hsdp_metrics_exporter.disk_quota
docker_image = var.hsdp_metrics_exporter.image
timeout = var.hsdp_metrics_exporter.timeout

docker_credentials = {
username = var.hsdp_metrics_exporter.docker_username
password = var.hsdp_metrics_exporter.docker_password
}
environment = {
UAA_USERNAME = var.cf_functional_account.username
UAA_PASSWORD = var.cf_functional_account.password
HSDP_REGION = var.hsdp_metrics_exporter.region
}

routes {
route = cloudfoundry_route.hsdp_metrics_exporter_internal[0].id
}

labels = {
"variant.tva/exporter" = true
}

annotations = {
"prometheus.exporter.port" = "8889"
"prometheus.exporter.path" = "/metrics"
}
}

resource "cloudfoundry_route" "hsdp_metrics_exporter_internal" {
count = var.enable_hsdp_metrics_exporter ? 1 : 0

domain = data.cloudfoundry_domain.apps_internal_domain.id
space = var.cf_space_id
hostname = "hsdp-metrics-exporter-${local.postfix}"
}
37 changes: 33 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ variable "name_postfix" {

variable "thanos_image" {
description = "Image to use for Thanos app. Use a v* tagged version to prevent automatic updates"
default = "philipslabs/cf-thanos:v6.0.0"
default = "philipslabs/cf-thanos:v6.1.0"
type = string
}

variable "thanos_query_image" {
description = "Image to use for Thanos query. Use a v* tagged version to prevent automatic updates"
default = "philipslabs/cf-thanos:v6.0.0"
default = "philipslabs/cf-thanos:v6.1.0"
type = string
}

variable "thanos_store_image" {
description = "Image to use for Thanos store. Use a v* tagged version to prevent automatic updates"
default = "philipslabs/cf-thanos:v6.0.0"
default = "philipslabs/cf-thanos:v6.1.0"
type = string
}

variable "thanos_compactor_image" {
description = "Image to use for Thanos compactor. Use a v* tagged version to prevent automatic updates"
default = "philipslabs/cf-thanos:v6.0.0"
default = "philipslabs/cf-thanos:v6.1.0"
type = string
}

Expand Down Expand Up @@ -161,6 +161,35 @@ variable "cf_functional_account" {
}
}


variable "enable_hsdp_metrics_exporter" {
type = bool
description = "Enable scraping of HSDP Metrics instances"
default = false
}

variable "hsdp_metrics_exporter" {
type = object({
image = string
docker_username = string
docker_password = string
memory = number
disk_quota = number
timeout = number
region = string
})
default = {
image = "loafoe/prometheus-hsdp-metrics-exporter:v0.0.14"
docker_username = ""
docker_password = ""
memory = 256
disk_quota = 100
timeout = 120
region = "us-east"
}
description = "HSDP Metrics exporter configuration"
}

variable "cf_paas_exporter_image" {
description = "Image to use for cf paas exporter. Use a v* tagged version to prevent automatic updates"
default = "loafoe/paas-prometheus-exporter:v0.0.5"
Expand Down

0 comments on commit 7d0cfcc

Please sign in to comment.