Skip to content

Web Server Monitoring Dashboard: Requests Average Duration Query error #438

@tamir-alltrue-ai

Description

@tamir-alltrue-ai

Description

In the default web dashboard, the underlying query fails with:

External error: Execution error: Cannot convert Duration(Microsecond) to epoch

I looked at the underlying query - it looks like valid postgres syntax to me but it is not running.

WITH dataset AS (
	SELECT
	 (attributes->>'http.method') || ' ' || COALESCE(attributes->>'http.route', attributes->>'http.target') as endpoint,
	 extract(epoch from end_timestamp - start_timestamp) * 1000 as duration_ms
	FROM records
	WHERE attributes ? 'http.method' and (attributes ? 'http.route' or attributes ? 'http.target')
)
SELECT endpoint, avg(duration_ms) as average_duration_ms
FROM dataset
GROUP BY endpoint
ORDER BY average_duration_ms desc
LIMIT 7;

Important line is extract(epoch from end_timestamp - start_timestamp) * 1000 as duration_ms

Python, Logfire & OS Versions, related packages (not required)

logfire="0.53.0"
platform="macOS-14.4-arm64-arm-64bit"
python="3.11.6 (v3.11.6:8b6ee5ba3b, Oct  2 2023, 11:18:21) [Clang 13.0.0 (clang-1300.0.29.30)]"
[related_packages]
requests="2.31.0"
pydantic="2.7.1"
fastapi="0.110.0"
openai="1.14.3"
protobuf="4.25.3"
rich="13.7.1"
executing="2.0.1"
opentelemetry-api="1.27.0"
opentelemetry-exporter-otlp-proto-common="1.27.0"
opentelemetry-exporter-otlp-proto-http="1.27.0"
opentelemetry-instrumentation="0.48b0"
opentelemetry-instrumentation-aiohttp-client="0.48b0"
opentelemetry-instrumentation-asgi="0.48b0"
opentelemetry-instrumentation-dbapi="0.48b0"
opentelemetry-instrumentation-fastapi="0.48b0"
opentelemetry-instrumentation-grpc="0.48b0"
opentelemetry-instrumentation-httpx="0.48b0"
opentelemetry-instrumentation-jinja2="0.48b0"
opentelemetry-instrumentation-psycopg2="0.48b0"
opentelemetry-instrumentation-redis="0.48b0"
opentelemetry-instrumentation-requests="0.48b0"
opentelemetry-instrumentation-sqlalchemy="0.48b0"
opentelemetry-instrumentation-sqlite3="0.48b0"
opentelemetry-instrumentation-system-metrics="0.48b0"
opentelemetry-instrumentation-tornado="0.48b0"
opentelemetry-instrumentation-urllib="0.48b0"
opentelemetry-instrumentation-urllib3="0.48b0"
opentelemetry-proto="1.27.0"
opentelemetry-sdk="1.27.0"
opentelemetry-semantic-conventions="0.48b0"
opentelemetry-util-http="0.48b0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug related to the Logfire Python SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions