go-graphite / carbon-clickhouse

Graphite metrics receiver with ClickHouse as storage
MIT License
187 stars 47 forks source link

Allow to store Date in UTC #114

Closed msaf1980 closed 1 year ago

msaf1980 commented 1 year ago
go test -race ./...
?       github.com/lomik/carbon-clickhouse  [no test files]
?       github.com/lomik/carbon-clickhouse/carbon   [no test files]
?       github.com/lomik/carbon-clickhouse/cmd/e2e-test [no test files]
?       github.com/lomik/carbon-clickhouse/grpc [no test files]
--- FAIL: TestSlowTimestampToDays (0.00s)
    --- FAIL: TestSlowTimestampToDays/1668106870_2022-11-10T14:01:10-05:00,_UTC_2022-11-10T19:01:10Z_[0] (0.00s)
        date_test.go:59: TimestampDaysFormat() = 19306 (2022-11-10), want 19307 (2022-11-11)
    --- FAIL: TestSlowTimestampToDays/1668193200_2022-11-11T14:00:00-05:00,_UTC_2022-11-11T19:00:00Z_[1] (0.00s)
        date_test.go:59: TimestampDaysFormat() = 19307 (2022-11-11), want 19308 (2022-11-12)
    --- FAIL: TestSlowTimestampToDays/1668124800_2022-11-10T19:00:00-05:00,_UTC_2022-11-11T00:00:00Z_[2] (0.00s)
        date_test.go:59: TimestampDaysFormat() = 19306 (2022-11-10), want 19307 (2022-11-11)
    --- FAIL: TestSlowTimestampToDays/1668142799_2022-11-10T23:59:59-05:00,_UTC_2022-11-11T04:59:59Z_[3] (0.00s)
        date_test.go:59: TimestampDaysFormat() = 19306 (2022-11-10), want 19307 (2022-11-11)
    --- FAIL: TestSlowTimestampToDays/1650776160_2022-04-23T23:56:00-05:00,_UTC_2022-04-24T04:56:00Z_[4] (0.00s)
        date_test.go:59: TimestampDaysFormat() = 19105 (2022-04-23), want 19106 (2022-04-24)
--- FAIL: TestTimestampToDays (0.00s)

As I think, is a cause of https://github.com/go-graphite/graphite-clickhouse/issues/184

This PR also provide a way to switch to UTC in future (need some changes in graphite-clickhouse and/or rebuild points/index/tags tables). See https://github.com/go-graphite/graphite-clickhouse/pull/203

Also, provide fix for https://github.com/go-graphite/carbon-clickhouse/issues/115 (store in UTC)