go-graphite / graphite-clickhouse

Graphite cluster backend with ClickHouse support
MIT License
213 stars 52 forks source link

Fix missing results on day start #202

Closed msaf1980 closed 1 year ago

msaf1980 commented 1 year ago

Test run 2022-11-11 00:49 +06:00

{"level":"info","ts":1668109509.361047,"caller":"e2e-test/e2etesting.go:443","msg":"starting e2e test","config":"tests/one_table/test.toml","clickhouse version":"20.3","clickhouse config":"tests/clickhouse/rollup"}
- TRY[] 6d9aec330fc9094fea2effc9572a0286 /render/?format=carbonapi_v3_pb, from=1668109490, until=1668109500, targets [seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*'),seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4')] [0] = {Name:metric1;tag1=value1;tag2=value21;tag3=value3 PathExpression:seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*') ConsolidationFunc:avg StartTime:1668109490 StopTime:1668109510 StepTime:10 XFilesFactor:0 HighPrecisionTimestamps:false Values:[2 3] AppliedFunctions:[] RequestStartTime:1668109490 RequestStopTime:1668109510}
- TRY[] 6d9aec330fc9094fea2effc9572a0286 /render/?format=carbonapi_v3_pb, from=1668109490, until=1668109500, targets [seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*'),seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4')] [1] = {Name:metric1;tag1=value1;tag2=value23;tag3=value3 PathExpression:seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*') ConsolidationFunc:avg StartTime:1668109490 StopTime:1668109510 StepTime:10 XFilesFactor:0 HighPrecisionTimestamps:false Values:[4 3] AppliedFunctions:[] RequestStartTime:1668109490 RequestStopTime:1668109510}
- TRY[] 6d9aec330fc9094fea2effc9572a0286 /render/?format=carbonapi_v3_pb, from=1668109490, until=1668109500, targets [seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*'),seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4')] [2] = {Name:metric2;tag2=value21;tag4=value4 PathExpression:seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4') ConsolidationFunc:avg StartTime:1668109490 StopTime:1668109510 StepTime:10 XFilesFactor:0 HighPrecisionTimestamps:false Values:[0 1] AppliedFunctions:[] RequestStartTime:1668109490 RequestStopTime:1668109510}
{"level":"error","ts":1668109521.4397256,"caller":"e2e-test/e2etesting.go:341","msg":"verify render","config":"tests/one_table/test.toml","clickhouse version":"20.3","clickhouse config":"tests/clickhouse/rollup","graphite-clickhouse config":"graphite-clickhouse.conf.tpl","targets":["seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*')","seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4')"],"from_raw":"rnow-10","until_raw":"rnow+1","from":1668109490,"until":1668109501,"name":"[3]","stacktrace":"main.verifyGraphiteClickhouse\n\t/home/msv/go/src/github.com/lomik/graphite-clickhouse/cmd/e2e-test/e2etesting.go:341\nmain.testGraphiteClickhouse\n\t/home/msv/go/src/github.com/lomik/graphite-clickhouse/cmd/e2e-test/e2etesting.go:464\nmain.runTest\n\t/home/msv/go/src/github.com/lomik/graphite-clickhouse/cmd/e2e-test/e2etesting.go:793\nmain.main\n\t/home/msv/go/src/github.com/lomik/graphite-clickhouse/cmd/e2e-test/main.go:124\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"}
$ epoch2localtime 1668109490 1668109500
2022-11-11 00:44:50
2022-11-11 00:45:00
$ grep 6d9aec330fc9094fea2effc9572a0286 /tmp/graphite-clickhouse28409542/graphite-clickhouse.log
{"level":"INFO","timestamp":"2022-11-11T00:45:21.436+0500","logger":"render.pb3parser","message":"pb3_target","request_id":"6d9aec330fc9094fea2effc9572a0286","from":1668109490,"until":1668109500,"maxDataPoints":0,"target":"seriesByTag('name=metric1', 'tag2=~value', 'tag3=value*')"}
{"level":"INFO","timestamp":"2022-11-11T00:45:21.436+0500","logger":"render.pb3parser","message":"pb3_target","request_id":"6d9aec330fc9094fea2effc9572a0286","from":1668109490,"until":1668109500,"maxDataPoints":0,"target":"seriesByTag('name=metric2', 'tag2=~value', 'tag4=value4')"}
{"level":"INFO","timestamp":"2022-11-11T00:45:21.439+0500","logger":"render","message":"query","request_id":"6d9aec330fc9094fea2effc9572a0286","query":"SELECT Path FROM graphite_tags  WHERE (((Tag1='__name__=metric2') AND (arrayExists((x) -> x='tag4=value4', Tags))) AND (arrayExists((x) -> x LIKE 'tag2=%' AND match(x, '^tag2=.*value'), Tags))) AND (Date >='2022-11-11' AND Date <= '2022-11-11') GROUP BY Path FORMAT TabSeparatedRaw","written_rows":"0","written_bytes":"0","total_rows_to_read":"8192","read_rows":"18","read_bytes":"937","query_id":"6d9aec330fc9094fea2effc9572a0286::c96706e9825f2b95","time":0.002663623}
{"level":"INFO","timestamp":"2022-11-11T00:45:21.439+0500","logger":"render","message":"query","request_id":"6d9aec330fc9094fea2effc9572a0286","query":"SELECT Path FROM graphite_tags  WHERE (((Tag1='__name__=metric1') AND (arrayExists((x) -> x LIKE 'tag3=value%', Tags))) AND (arrayExists((x) -> x LIKE 'tag2=%' AND match(x, '^tag2=.*value'), Tags))) AND (Date >='2022-11-11' AND Date <= '2022-11-11') GROUP BY Path FORMAT TabSeparatedRaw","read_rows":"18","read_bytes":"937","written_rows":"0","written_bytes":"0","total_rows_to_read":"8192","query_id":"6d9aec330fc9094fea2effc9572a0286::61c3c2e56dd401f9","time":0.002531045}
{"level":"INFO","timestamp":"2022-11-11T00:45:21.439+0500","logger":"render","message":"finder","request_id":"6d9aec330fc9094fea2effc9572a0286","metrics":0,"find_cached":false}
{"level":"INFO","timestamp":"2022-11-11T00:45:21.439+0500","logger":"http","message":"access","request_id":"6d9aec330fc9094fea2effc9572a0286","time":0.003153252,"method":"GET","url":"/render/?format=carbonapi_v3_pb","peer":"127.0.0.1:38704","client":"","status":404,"find_cached":false}

No metrics in tags table for 2022-11-11 (But exists for 2022-11-11. stored in UTC)

SQL) SELECT Date, Path FROM graphite_tags  WHERE (((Tag1='__name__=metric2') AND (arrayExists((x) -> x='tag4=value4', Tags))) AND (arrayExists((x) -> x LIKE 'tag2=%' AND match(x, '^tag2=.*value'), Tags))) AND (Date >='2022-11-10' AND Date <= '2022-11-11') GROUP BY Date, Path

┌───────Date─┬─Path─────────────────────────────┐
│ 2022-11-10 │ metric2?tag2=value21&tag4=value4 │
└────────────┴──────────────────────────────────┘
{"level":"INFO","timestamp":"2022-11-11T00:58:30.452+0500","logger":"render","message":"query","request_id":"23a3047301886b6783ce867f75259878","query":"SELECT Path FROM graphite_index WHERE ((Level=10002) AND (Path LIKE 'plain.test%' AND
 match(Path, '^plain[.]test(1|2)[.]?$'))) AND (Date >='2022-11-10' AND Date <= '2022-11-10') GROUP BY Path FORMAT TabSeparatedRaw","read_rows":"10","read_bytes":"258","written_rows":"0","written_bytes":"0","total_rows_to_read":"10","quer
y_id":"23a3047301886b6783ce867f75259878::12552dfcef4257fb","time":0.002248672}

Queries to index table with 2022-11-10

SQL> SELECT Date, Path FROM graphite_index WHERE ((Level=10002) AND (Path LIKE 'plain.test%' AND
 match(Path, '^plain[.]test(1|2)[.]?$'))) AND (Date >='2022-11-10' AND Date <= '2022-11-11') GROUP BY Date, Path

┌───────Date─┬─Path────────┐
│ 2022-11-10 │ plain.test2 │
└────────────┴─────────────┘