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 unit and default_value config #32

Merged
merged 1 commit into from
Dec 4, 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
11 changes: 5 additions & 6 deletions storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,11 @@ resource "aws_cloudwatch_log_metric_filter" "slow_query_metric_filter" {
name = var.postgresql_slow_query_metric_filter_name
pattern = join("?", var.postgresql_slow_query_pattern)
metric_transformation {
name = var.postgresql_slow_query_metric_filter_name
namespace = var.postgresql_slow_query_metric_namespace
value = var.postgresql_slow_query_metric_value
name = var.postgresql_slow_query_metric_filter_name
namespace = var.postgresql_slow_query_metric_namespace
value = var.postgresql_slow_query_metric_value
unit = var.postgresql_slow_query_metric_unit
default_value = var.postgresql_slow_query_metric_default_value
}
}

Expand Down Expand Up @@ -341,7 +343,4 @@ resource "aws_cloudwatch_metric_alarm" "slow_query_metric_alarm" {
severity = var.postgresql_slow_query_severity
}

dimensions = {
DBInstanceIdentifier = (length(var.postgresql_source_snapshot_identifier) == 0 && var.postgresql_replicate_source_db == null) ? aws_db_instance.blank-database[0].identifier : var.postgresql_replicate_source_db != null ? aws_db_instance.replica-database[0].identifier : aws_db_instance.from-snapshot[0].identifier
}
}
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ variable "postgresql_slow_query_metric_value" {
default = 1
}

variable "postgresql_slow_query_metric_unit" {
type = string
description = "Unit of measurement"
default = "Count"
}

variable "postgresql_slow_query_metric_default_value" {
type = number
description = "The default value is published to the metric when the pattern does not match. If you leave this blank, no value is published when there is no match"
default = 0
}

variable "postgresql_slow_query_pattern" {
type = list(string)
description = "The terms or pattern to match in your log events to create metrics"
Expand Down
Loading