Add anlytics info and search to logs page

This commit is contained in:
Peter Stockings
2025-07-25 15:46:56 +10:00
parent 8f2838f920
commit d1f8f825c3
8 changed files with 116 additions and 18 deletions

View File

@@ -190,11 +190,7 @@ def logs(function_id):
if not http_function:
return jsonify({'error': 'Function not found'}), 404
name = http_function['name']
http_function_invocations = db.execute("""
SELECT id, http_function_id, STATUS, invocation_time, request_data, response_data, LOGS, version_number
FROM http_function_invocations
WHERE http_function_id=%s
ORDER BY invocation_time DESC""", [function_id])
http_function_invocations = db.get_http_function_invocations(function_id)
if htmx:
return render_block(environment, 'dashboard/http_functions/logs.html', 'page', user_id=user_id, function_id=function_id, name=name, http_function_invocations=http_function_invocations)
return render_template("dashboard/http_functions/logs.html", user_id=user_id, name=name, function_id=function_id, http_function_invocations=http_function_invocations)

View File

@@ -110,6 +110,7 @@ CREATE TABLE timer_function_invocations (
invocation_time TIMESTAMPTZ NOT NULL DEFAULT NOW(),
logs JSONB,
version_number INT NOT NULL,
execution_time FLOAT,
CONSTRAINT fk_timer_function_invocations
FOREIGN KEY (timer_function_id)
@@ -402,9 +403,9 @@ def logs(function_id):
# Fetch the invocation logs
timer_function_invocations = db.execute("""
SELECT id, timer_function_id, status, invocation_time,
logs, version_number
FROM timer_function_invocations
SELECT id, timer_function_id, status, invocation_time,
logs, version_number, execution_time
FROM timer_function_invocations
WHERE timer_function_id = %s
ORDER BY invocation_time DESC
LIMIT 100