-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for New Relic service levels (#21)
Add support for New Relic service levels
- Loading branch information
1 parent
cce1e2a
commit 36d7e4c
Showing
6 changed files
with
107 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "newrelic_entity" "app" { | ||
name = var.newrelic_fully_qualified_app_name | ||
type = "APPLICATION" | ||
} |
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,59 @@ | ||
resource "newrelic_service_level" "latency" { | ||
count = var.create_default_slos == true ? 1 : 0 | ||
|
||
guid = data.newrelic_entity.app.guid | ||
name = "Latency" | ||
description = "Proportion of requests that are served faster than a threshold." | ||
|
||
events { | ||
account_id = var.newrelic_account_id | ||
valid_events { | ||
from = "Transaction" | ||
where = "entityGuid = '${data.newrelic_entity.app.guid}' AND (transactionType = 'Web')" | ||
} | ||
good_events { | ||
from = "Transaction" | ||
where = "entityGuid = '${data.newrelic_entity.app.guid}' AND (transactionType = 'Web') AND duration < ${var.latency_slo_duration_threshold}" | ||
} | ||
} | ||
|
||
objective { | ||
target = var.latency_slo_target | ||
time_window { | ||
rolling { | ||
count = 7 | ||
unit = "DAY" | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "newrelic_service_level" "availability" { | ||
count = var.create_default_slos == true ? 1 : 0 | ||
|
||
guid = data.newrelic_entity.app.guid | ||
name = "Availability" | ||
description = "Proportion of requests that are served without errors." | ||
|
||
events { | ||
account_id = var.newrelic_account_id | ||
valid_events { | ||
from = "Transaction" | ||
where = "entityGuid = '${data.newrelic_entity.app.guid}'" | ||
} | ||
bad_events { | ||
from = "TransactionError" | ||
where = "entityGuid = '${data.newrelic_entity.app.guid}' AND error.expected IS FALSE" | ||
} | ||
} | ||
|
||
objective { | ||
target = var.availability_slo_target | ||
time_window { | ||
rolling { | ||
count = 7 | ||
unit = "DAY" | ||
} | ||
} | ||
} | ||
} |
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