Learn how to use the Pie Chart Widget in OpenLIT to display proportions and segment distributions using ClickHouse data.
The Pie Chart Widget in OpenLIT is perfect for showing how values are distributed across categories. Use it to represent proportions such as traffic sources, user roles, or error types.
WITH parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time, parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time, SELECT DISTINCT ResourceAttributes['service.name'] as applicationName, ROUND(SUM(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost'])), 5) AS cost FROM otel_traces WHERE SpanAttributes['gen_ai.operation.name'] != 'vectordb' AND notEmpty(SpanAttributes['gen_ai.usage.cost']) AND notEmpty(ResourceAttributes['service.name']) AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset') AND Timestamp >= start_time AND Timestamp <= end_time GROUP BY applicationName;