Skip to content

Commit

Permalink
Enable prometheus metrics when running on Kubernetes (#135)
Browse files Browse the repository at this point in the history
* add prometheus scrape annotations

* only create cloudwatch dashboard when running on ecs

* update changelog

* Update CHANGELOG.md

Co-Authored-By: Adrian Woodhead <awoodhead@expediagroup.com>

Co-authored-by: Adrian Woodhead <massdosage@gmail.com>
  • Loading branch information
rpoluri and massdosage authored Feb 10, 2020
1 parent 339b0b0 commit f752406
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.3.0] - 2020-02-10

### Added
- Added Prometheus scrape annotations to Kubernetes deployments.

### Changed
- Disable CloudWatch dashboard when running on Kubernetes.

## [4.2.0] - 2020-02-06

### Added
Expand Down
1 change: 1 addition & 0 deletions cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ EOF
}

resource "aws_cloudwatch_dashboard" "apiary" {
count = var.hms_instance_type == "ecs" ? 1 : 0
dashboard_name = "${local.instance_alias}-${var.aws_region}"

dashboard_body = <<EOF
Expand Down
7 changes: 6 additions & 1 deletion k8s-readonly.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ resource "kubernetes_deployment" "apiary_hms_readonly" {
}
annotations = {
"iam.amazonaws.com/role" = aws_iam_role.apiary_hms_readonly.name
"prometheus.io/path" = "/metrics"
"prometheus.io/port" = "8080"
"prometheus.io/scrape" = "true"
}
}

spec {
container {
image = "${var.hms_docker_image}:${var.hms_docker_version}"
name = "hms-readonly"

port {
container_port = 9083
}
env {
name = "MYSQL_DB_HOST"
value = var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.endpoint) : var.external_database_host
Expand Down
7 changes: 6 additions & 1 deletion k8s-readwrite.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ resource "kubernetes_deployment" "apiary_hms_readwrite" {
}
annotations = {
"iam.amazonaws.com/role" = aws_iam_role.apiary_hms_readwrite.name
"prometheus.io/path" = "/metrics"
"prometheus.io/port" = "8080"
"prometheus.io/scrape" = "true"
}
}

spec {
container {
image = "${var.hms_docker_image}:${var.hms_docker_version}"
name = "hms-readwrite"

port {
container_port = 9083
}
env {
name = "MYSQL_DB_HOST"
value = var.external_database_host == "" ? join("", aws_rds_cluster.apiary_cluster.*.endpoint) : var.external_database_host
Expand Down

0 comments on commit f752406

Please sign in to comment.