Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tamir-alltrue-ai opened this issue Sep 23, 2024 · 2 comments
Labels
bug Bug related to the Logfire Python SDK

Comments

@tamir-alltrue-ai
Copy link

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"
@tamir-alltrue-ai tamir-alltrue-ai added the bug Bug related to the Logfire Python SDK label Sep 23, 2024
@alexmojaki
Copy link
Contributor

This is specifically an issue with the new FF engine, see #408

The underlying problem is fixed in apache/datafusion#12514 but that code isn't being used yet on our platform.

Change epoch to second and the dashboard should work in both TS and FF.

@alexmojaki
Copy link
Contributor

This was fixed shortly after being opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug related to the Logfire Python SDK
Projects
None yet
Development

No branches or pull requests

2 participants