grafana / clickhouse-datasource

Grafana Plugin for ClickHouse
Apache License 2.0
127 stars 58 forks source link

SQL Editor traceID link queries wrong table #874

Closed ryn9 closed 2 months ago

ryn9 commented 2 months ago

What happened:

Explore > Editor Type: SQL Editor > Query Type: table

Query:

SELECT
    TraceId AS traceID,
    SpanId AS spanID,
    SpanName AS operationName,
    ParentSpanId AS parentSpanID,
    ServiceName AS serviceName,
    Duration / 1000000 AS duration,
    Timestamp AS startTime,
    arrayMap(key -> map('key', key, 'value', SpanAttributes[key]), mapKeys(SpanAttributes)) AS tags,
    arrayMap(key -> map('key', key, 'value', ResourceAttributes[key]), mapKeys(ResourceAttributes)) AS serviceTags
FROM otel_traces
WHERE ( Timestamp >= $__fromTime AND Timestamp <= $__toTime )
 AND ( Duration > 0 )
ORDER BY startTime ASC

( reference: https://grafana.com/grafana/plugins/grafana-clickhouse-datasource/ "Visualizing traces with the Traces Panel" )

Clicking on the traceID link opens a trace panel, but errors: error querying the database: code: 60, message: Table MY_DB_NAME.MY_DB_NAME does not exist

Note: Datasource's Traces configuration is configured with Default trace database: MY_DB_NAME Default trace table: otel_traces use otel is enabled

What you expected to happen:

I would expect this to correctly load the trace panel

How to reproduce it (as minimally and precisely as possible):

Please see above

Screenshots

Anything else we need to know?:

Environment:

ryn9 commented 2 months ago

working now with latest grafana and latest plugin..