Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #75 from nvaller/add_violation_close_timer_to_nrql
Browse files Browse the repository at this point in the history
add ViolationCloseTimer field to NrqlAlertCondition type
  • Loading branch information
ctrombley authored Nov 12, 2019
2 parents f54ac20 + 592d46d commit a380ee3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
8 changes: 8 additions & 0 deletions api/alert_nrql_conditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestQueryAlertNrqlConditions(t *testing.T) {
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"enabled": true,
"violation_time_limit_seconds": 3600,
"terms": [
{
"duration": "10",
Expand Down Expand Up @@ -65,6 +66,7 @@ func TestGetAlertNrqlCondition(t *testing.T) {
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"enabled": true,
"violation_time_limit_seconds": 3600,
"terms": [
{
"duration": "10",
Expand Down Expand Up @@ -110,6 +112,7 @@ func TestListAlertNrqlConditions(t *testing.T) {
"id": 12345,
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down Expand Up @@ -155,6 +158,7 @@ func TestCreateAlertNrqlCondition(t *testing.T) {
"id": 12345,
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestCreateAlertNrqlStaticCondition(t *testing.T) {
"type": "static",
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down Expand Up @@ -319,6 +324,7 @@ func TestCreateAlertNrqlBaselineCondition(t *testing.T) {
"type": "baseline",
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down Expand Up @@ -409,6 +415,7 @@ func TestCreateAlertNrqlOutlierCondition(t *testing.T) {
"type": "outlier",
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down Expand Up @@ -493,6 +500,7 @@ func TestUpdateAlertNrqlCondition(t *testing.T) {
"id": 12345,
"name": "NRQL Condition",
"runbook_url": "https://example.com/runbook.md",
"violation_time_limit_seconds": 3600,
"enabled": true,
"terms": [
{
Expand Down
23 changes: 12 additions & 11 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,18 @@ type AlertNrqlQuery struct {

// AlertNrqlCondition represents a New Relic NRQL Alert condition.
type AlertNrqlCondition struct {
PolicyID int `json:"-"`
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled"`
RunbookURL string `json:"runbook_url,omitempty"`
Terms []AlertConditionTerm `json:"terms,omitempty"`
ValueFunction string `json:"value_function,omitempty"`
ExpectedGroups int `json:"expected_groups,omitempty"`
IgnoreOverlap bool `json:"ignore_overlap,omitempty"`
Nrql AlertNrqlQuery `json:"nrql,omitempty"`
PolicyID int `json:"-"`
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled"`
RunbookURL string `json:"runbook_url,omitempty"`
Terms []AlertConditionTerm `json:"terms,omitempty"`
ValueFunction string `json:"value_function,omitempty"`
ExpectedGroups int `json:"expected_groups,omitempty"`
IgnoreOverlap bool `json:"ignore_overlap,omitempty"`
Nrql AlertNrqlQuery `json:"nrql,omitempty"`
ViolationCloseTimer int `json:"violation_time_limit_seconds,omitempty"`
}

// AlertPlugin represents a plugin to use with a Plugin alert condition.
Expand Down

0 comments on commit a380ee3

Please sign in to comment.