Skip to content

Commit d5c69ec

Browse files
authored
fix: use updated defaults for TCP check degraded/max response time (#306)
The maximum values were reduced at the backend level and the defaults were changed as well. This change syncs both values to current values used by the backend. This change is technically backwards incompatible, but even the current version is broken right now if the user relies on default values.
1 parent 9026040 commit d5c69ec

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

checkly/resource_tcp_check.go

+8-10
Original file line numberDiff line numberDiff line change
@@ -83,30 +83,28 @@ func resourceTCPCheck() *schema.Resource {
8383
"degraded_response_time": {
8484
Type: schema.TypeInt,
8585
Optional: true,
86-
Default: 15000,
86+
Default: 4000,
8787
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
88-
// https://checklyhq.com/docs/api-checks/limits/
8988
v := val.(int)
90-
if v < 0 || v > 30000 {
91-
errs = append(errs, fmt.Errorf("%q must be 0-30000 ms, got %d", key, v))
89+
if v < 0 || v > 5000 {
90+
errs = append(errs, fmt.Errorf("%q must be 0-5000 ms, got %d", key, v))
9291
}
9392
return warns, errs
9493
},
95-
Description: "The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 30000. (Default `15000`).",
94+
Description: "The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 5000. (Default `4000`).",
9695
},
9796
"max_response_time": {
9897
Type: schema.TypeInt,
9998
Optional: true,
100-
Default: 30000,
99+
Default: 5000,
101100
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
102101
v := val.(int)
103-
// https://checklyhq.com/docs/api-checks/limits/
104-
if v < 0 || v > 30000 {
105-
errs = append(errs, fmt.Errorf("%q must be 0-30000 ms, got: %d", key, v))
102+
if v < 0 || v > 5000 {
103+
errs = append(errs, fmt.Errorf("%q must be 0-5000 ms, got: %d", key, v))
106104
}
107105
return warns, errs
108106
},
109-
Description: "The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 30000. (Default `30000`).",
107+
Description: "The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 5000. (Default `5000`).",
110108
},
111109
"tags": {
112110
Type: schema.TypeSet,

checkly/resource_tcp_check_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ func TestAccTCPCheckFull(t *testing.T) {
100100
resource.TestCheckResourceAttr(
101101
"checkly_tcp_check.test",
102102
"degraded_response_time",
103-
"15000",
103+
"4000",
104104
),
105105
resource.TestCheckResourceAttr(
106106
"checkly_tcp_check.test",
107107
"max_response_time",
108-
"30000",
108+
"5000",
109109
),
110110
testCheckResourceAttrExpr(
111111
"checkly_tcp_check.test",
@@ -150,8 +150,8 @@ var wantTCPCheck = checkly.TCPCheck{
150150
ShouldFail: false,
151151
Locations: []string{"eu-west-1"},
152152
PrivateLocations: &[]string{},
153-
DegradedResponseTime: 15000,
154-
MaxResponseTime: 30000,
153+
DegradedResponseTime: 4000,
154+
MaxResponseTime: 5000,
155155
Tags: []string{
156156
"foo",
157157
"bar",
@@ -199,7 +199,7 @@ const tcpCheck_basic = `
199199
frequency = 60
200200
activated = true
201201
muted = true
202-
max_response_time = 18000
202+
max_response_time = 3000
203203
locations = [ "us-east-1", "eu-central-1" ]
204204
use_global_alert_settings = true
205205
request {
@@ -221,8 +221,8 @@ const tcpCheck_full = `
221221
frequency = 120
222222
activated = true
223223
muted = true
224-
degraded_response_time = 15000
225-
max_response_time = 30000
224+
degraded_response_time = 4000
225+
max_response_time = 5000
226226
locations = [
227227
"eu-central-1",
228228
"us-east-1",

docs/resources/tcp_check.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ resource "checkly_tcp_check" "example-tcp-check-2" {
102102

103103
- `alert_channel_subscription` (Block List) An array of channel IDs and whether they're activated or not. If you don't set at least one alert subscription for your check, we won't be able to alert you in case something goes wrong with it. (see [below for nested schema](#nestedblock--alert_channel_subscription))
104104
- `alert_settings` (Block List, Max: 1) (see [below for nested schema](#nestedblock--alert_settings))
105-
- `degraded_response_time` (Number) The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 30000. (Default `15000`).
105+
- `degraded_response_time` (Number) The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 5000. (Default `4000`).
106106
- `frequency_offset` (Number) To create a high frequency check, the property `frequency` must be `0` and `frequency_offset` can be `10`, `20` or `30`.
107107
- `group_id` (Number) The id of the check group this check is part of.
108108
- `group_order` (Number) The position of this check in a check group. It determines in what order checks are run when a group is triggered from the API or from CI/CD.
109109
- `locations` (Set of String) An array of one or more data center locations where to run the this check. (Default ["us-east-1"])
110-
- `max_response_time` (Number) The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 30000. (Default `30000`).
110+
- `max_response_time` (Number) The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 5000. (Default `5000`).
111111
- `muted` (Boolean) Determines if any notifications will be sent out when a check fails/degrades/recovers.
112112
- `private_locations` (Set of String) An array of one or more private locations slugs.
113113
- `retry_strategy` (Block Set, Max: 1) A strategy for retrying failed check runs. (see [below for nested schema](#nestedblock--retry_strategy))

0 commit comments

Comments
 (0)