Skip to content

Commit

Permalink
feat: add historical data retrieval support to Google Cloud Monitorin…
Browse files Browse the repository at this point in the history
…g and Logic Monitor data sources (#292)
  • Loading branch information
mkaras-nobl9 authored Aug 23, 2024
1 parent 9f25a77 commit e63e54b
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
28 changes: 28 additions & 0 deletions docs/resources/direct_gcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ resource "nobl9_direct_gcm" "test-gcm" {

- `description` (String) Optional description of the resource. Here, you can add details about who is responsible for the integration (team/owner) or the purpose of creating it.
- `display_name` (String) User-friendly display name of the resource.
- `historical_data_retrieval` (Block List, Max: 1) [Replay configuration documentation](https://docs.nobl9.com/replay) (see [below for nested schema](#nestedblock--historical_data_retrieval))
- `log_collection_enabled` (Boolean) [Logs documentation](https://docs.nobl9.com/features/slo-troubleshooting/event-logs)
- `query_delay` (Block Set, Max: 1) [Query delay configuration documentation](https://docs.nobl9.com/features/query-delay). Computed if not provided. (see [below for nested schema](#nestedblock--query_delay))
- `release_channel` (String) Release channel of the created data source [stable/beta]
Expand All @@ -45,6 +46,33 @@ resource "nobl9_direct_gcm" "test-gcm" {
- `id` (String) The ID of this resource.
- `status` (String) The status of the created direct.

<a id="nestedblock--historical_data_retrieval"></a>
### Nested Schema for `historical_data_retrieval`

Required:

- `default_duration` (Block List, Min: 1) Used by default for any SLOs connected to this data source. (see [below for nested schema](#nestedblock--historical_data_retrieval--default_duration))
- `max_duration` (Block List, Min: 1) Defines the maximum period for which data can be retrieved. (see [below for nested schema](#nestedblock--historical_data_retrieval--max_duration))

<a id="nestedblock--historical_data_retrieval--default_duration"></a>
### Nested Schema for `historical_data_retrieval.default_duration`

Required:

- `unit` (String) Must be one of Minute, Hour, or Day.
- `value` (Number) Must be an integer greater than or equal to 0.


<a id="nestedblock--historical_data_retrieval--max_duration"></a>
### Nested Schema for `historical_data_retrieval.max_duration`

Required:

- `unit` (String) Must be one of Minute, Hour, or Day.
- `value` (Number) Must be an integer greater than or equal to 0.



<a id="nestedblock--query_delay"></a>
### Nested Schema for `query_delay`

Expand Down
28 changes: 28 additions & 0 deletions docs/resources/direct_logic_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ resource "nobl9_direct_logic_monitor" "logic_monitor" {
- `account_id` (String) [required] | Logic Monitor Application account ID.
- `description` (String) Optional description of the resource. Here, you can add details about who is responsible for the integration (team/owner) or the purpose of creating it.
- `display_name` (String) User-friendly display name of the resource.
- `historical_data_retrieval` (Block List, Max: 1) [Replay configuration documentation](https://docs.nobl9.com/replay) (see [below for nested schema](#nestedblock--historical_data_retrieval))
- `log_collection_enabled` (Boolean) [Logs documentation](https://docs.nobl9.com/features/slo-troubleshooting/event-logs)
- `query_delay` (Block Set, Max: 1) [Query delay configuration documentation](https://docs.nobl9.com/features/query-delay). Computed if not provided. (see [below for nested schema](#nestedblock--query_delay))
- `release_channel` (String) Release channel of the created data source [stable/beta]
Expand All @@ -54,6 +55,33 @@ resource "nobl9_direct_logic_monitor" "logic_monitor" {
- `id` (String) The ID of this resource.
- `status` (String) The status of the created direct.

<a id="nestedblock--historical_data_retrieval"></a>
### Nested Schema for `historical_data_retrieval`

Required:

- `default_duration` (Block List, Min: 1) Used by default for any SLOs connected to this data source. (see [below for nested schema](#nestedblock--historical_data_retrieval--default_duration))
- `max_duration` (Block List, Min: 1) Defines the maximum period for which data can be retrieved. (see [below for nested schema](#nestedblock--historical_data_retrieval--max_duration))

<a id="nestedblock--historical_data_retrieval--default_duration"></a>
### Nested Schema for `historical_data_retrieval.default_duration`

Required:

- `unit` (String) Must be one of Minute, Hour, or Day.
- `value` (Number) Must be an integer greater than or equal to 0.


<a id="nestedblock--historical_data_retrieval--max_duration"></a>
### Nested Schema for `historical_data_retrieval.max_duration`

Required:

- `unit` (String) Must be one of Minute, Hour, or Day.
- `value` (Number) Must be an integer greater than or equal to 0.



<a id="nestedblock--query_delay"></a>
### Nested Schema for `query_delay`

Expand Down
20 changes: 20 additions & 0 deletions nobl9/resource_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ resource "nobl9_agent" "%s" {
project = "%s"
agent_type = "gcm"
release_channel = "beta"
historical_data_retrieval {
default_duration {
unit = "Minute"
value = 10
}
max_duration {
unit = "Hour"
value = 19
}
}
query_delay {
unit = "Minute"
value = 6
Expand Down Expand Up @@ -398,6 +408,16 @@ resource "nobl9_agent" "%s" {
account = "account-name"
}
release_channel = "beta"
historical_data_retrieval {
default_duration {
unit = "Minute"
value = 10
}
max_duration {
unit = "Hour"
value = 19
}
}
query_delay {
unit = "Minute"
value = 6
Expand Down
3 changes: 2 additions & 1 deletion nobl9/resource_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ func (s gcmDirectSpec) GetSchema() map[string]*schema.Schema {
),
},
}
setHistoricalDataRetrievalSchema(gcmSchema)
setLogCollectionSchema(gcmSchema)

return gcmSchema
Expand Down Expand Up @@ -842,8 +843,8 @@ func (s logicMonitorDirectSpec) GetSchema() map[string]*schema.Schema {
),
},
}
setHistoricalDataRetrievalSchema(logicMonitorSchema)
setLogCollectionSchema(logicMonitorSchema)
// TODO: setHistoricalDataRetrievalSchema(logicMonitorSchema)

return logicMonitorSchema
}
Expand Down
28 changes: 28 additions & 0 deletions nobl9/resource_direct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestAcc_Nobl9Direct(t *testing.T) {
{cloudWatchDirectType, testCloudWatchDirect},
{datadogDirectType, testDatadogDirect},
{dynatraceDirectType, testDynatraceDirect},
{gcmDirectType, testGoogleCloudMonitoringDirect},
{honeycombDirectType, testHoneycombDirect},
{influxdbDirectType, testInfluxDBDirect},
{instanaDirectType, testInstanaDirect},
Expand Down Expand Up @@ -212,6 +213,33 @@ resource "nobl9_direct_%s" "%s" {
`, directType, name, name, testProject)
}

func testGoogleCloudMonitoringDirect(directType, name string) string {
return fmt.Sprintf(`
resource "nobl9_direct_%s" "%s" {
name = "%s"
project = "%s"
description = "desc"
service_account_key = "{ \"key\": \"secret\" }"
log_collection_enabled = true
historical_data_retrieval {
default_duration {
unit = "Day"
value = 1
}
max_duration {
unit = "Day"
value = 10
}
}
release_channel = "stable"
query_delay {
unit = "Minute"
value = 6
}
}
`, directType, name, name, testProject)
}

func testHoneycombDirect(directType, name string) string {
return fmt.Sprintf(`
resource "nobl9_direct_%s" "%s" {
Expand Down

0 comments on commit e63e54b

Please sign in to comment.