Repository navigation
Closed
Description
Error when output dir is .
clickhouse-flamegraph --clickhouse-dsn http://xxx?allow_introspection_functions=1 --query-id 7d6b01fa-89f0-4eaf-9d4b-e273a6e9ee84 --flamegraph-script /data1/home/wujianchao/cmd/FlameGraph --output-dir . --trace-type CPU --format svg --debug --from '2024-04-25 00:00:00' --to '2024-04-26 00:00:00'
{"level":"info","dsn":"http://xxx?allow_introspection_functions=1","time":"2024-04-25T15:38:21+08:00","message":"connected to ClickHouse"}
{"level":"debug","sql":"SELECT version() AS version","sqlArgs":"[]","time":"2024-04-25T15:38:21+08:00","message":"query OK"}
{"level":"debug","sql":"\nSELECT DISTINCT hostName() AS host_name, q.query, q.query_id \nFROM system.query_log AS q\nWHERE event_time >= ? AND event_time <= ? AND query_id IN ('7d6b01fa-89f0-4eaf-9d4b-e273a6e9ee84') \n","sqlArgs":"[2024-04-25 00:00:00 +0000 UTC 2024-04-26 00:00:00 +0000 UTC]","time":"2024-04-25T15:38:21+08:00","message":"query OK"}
{"level":"info","sqlFiles":1,"time":"2024-04-25T15:38:21+08:00","message":"write .sql files"}
{"level":"debug","sql":"\nSELECT \n\thostName() AS host_name,\n replaceAll(t.query_id,':','_') AS query_id,\n\ttrace_type,\n\tsum(abs(size)) AS total_size,\n\tcount() AS samples, \n\tconcat(\n\t\tmultiIf( \n\t\t\tposition( toString(trace_type), 'Memory') > 0 AND sum(size) >= 0, 'allocate;',\n\t\t\tposition( toString(trace_type), 'Memory') > 0 AND sum(size) < 0, 'free;',\n\t\t\tconcat( toString(trace_type), ';')\n\t\t),\n\t\tarrayStringConcat(arrayReverse(arrayMap(x -> concat( demangle(addressToSymbol(x)), '#', addressToLine(x) ), trace)), ';')\n\t) AS stack\nFROM system.trace_log AS t ANY LEFT JOIN system.query_log AS q ON q.query_id=t.query_id\nWHERE trace_type IN ('CPU') AND event_time >= ? AND event_time <= ? AND query_id IN ('7d6b01fa-89f0-4eaf-9d4b-e273a6e9ee84') \nGROUP BY host_name, query_id, trace_type, trace\nSETTINGS allow_introspection_functions=1\n","sqlArgs":"[2024-04-25 00:00:00 +0000 UTC 2024-04-26 00:00:00 +0000 UTC]","time":"2024-04-25T15:38:21+08:00","message":"query OK"}
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
main.generate(0xc0001ce680)
/data1/home/wujianchao/project/github/clickhouse-flamegraph/main.go:349 +0xb45
main.run(0xc000256160?)
/data1/home/wujianchao/project/github/clickhouse-flamegraph/main.go:199 +0x1e6
github.com/urfave/cli/v2.(*Command).Run(0xc000256160, 0xc0001ce680, {0xc0001aa000, 0x12, 0x12})
/data1/home/wujianchao/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279 +0x9dd
github.com/urfave/cli/v2.(*App).RunContext(0xc00024c000, {0x8e9860?, 0xbb1b20}, {0xc0001aa000, 0x12, 0x12})
/data1/home/wujianchao/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337 +0x5db
github.com/urfave/cli/v2.(*App).Run(...)
/data1/home/wujianchao/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:311
main.main()
/data1/home/wujianchao/project/github/clickhouse-flamegraph/main.go:152 +0x1725
The formatted sql in log :
SELECT
hostName() AS host_name,
replaceAll(t.query_id, ':', '_') AS query_id,
trace_type,
sum(abs(size)) AS total_size,
count() AS samples,
concat(
multiIf(
position(toString(trace_type), 'Memory') > 0 AND sum(size) >= 0, 'allocate;',
position(toString(trace_type), 'Memory') > 0 AND sum(size) < 0, 'free;',
concat(toString(trace_type), ';')
),
arrayStringConcat(arrayReverse(arrayMap(x -> concat(demangle(addressToSymbol(x)), '#', addressToLine(x)), trace)), ';')
) AS stack
FROM
system.trace_log AS t
ANY LEFT JOIN system.query_log AS q ON q.query_id = t.query_id
WHERE
trace_type IN ('CPU')
AND event_time >= '2024-04-25 00:00:00'
AND event_time <= '2024-04-26 00:00:00'
AND query_id IN ('7d6b01fa-89f0-4eaf-9d4b-e273a6e9ee84')
GROUP BY
host_name,
query_id,
trace_type,
trace
SETTINGS
allow_introspection_functions = 1
;
And got 79 rows in my ClickHouse instance.
Originally posted by @JackyWoo in #121 (comment)
Metadata
Metadata
Assignees
Labels
No labels
Activity