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

fix: allow auto ('0') granularity #514

Merged
merged 4 commits into from
Jul 29, 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
2 changes: 1 addition & 1 deletion client/v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (c *Client) retryHTTPCheck(
case http.StatusTooManyRequests:
// TODO: use new retry header timestamps to determine when to retry
return true, nil
case http.StatusBadGateway, http.StatusGatewayTimeout:
case http.StatusBadGateway, http.StatusGatewayTimeout, http.StatusInternalServerError:
return true, nil
default:
return false, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/query_specification_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (d *querySpecDataSource) Read(ctx context.Context, req datasource.ReadReque
"granularity can not be greater than time_range/10",
)
}
if *querySpec.Granularity < (*querySpec.TimeRange / 1000) {
if *querySpec.Granularity != 0 && *querySpec.Granularity < (*querySpec.TimeRange/1000) {
resp.Diagnostics.AddAttributeError(
path.Root("granularity"),
"invalid granularity",
Expand Down
5 changes: 4 additions & 1 deletion internal/provider/query_specification_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ func TestAcc_QuerySpecificationDataSource_zerovalue(t *testing.T) {
"value": 0
}
],
"time_range": 7200
"time_range": 7200,
"granularity": 0
}`)
require.NoError(t, err)

Expand All @@ -419,6 +420,8 @@ data "honeycombio_query_specification" "test" {
op = ">"
value = 0
}

granularity = 0
}

output "query_json" {
Expand Down