Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deployment/Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN reflex compile

EXPOSE 8180 8181

CMD ["reflex", "run", "--env", "dev", "--backend-host", "0.0.0.0", "--frontend-port", "8180", "--backend-port", "8181"]
CMD ["reflex", "run", "--env", "prod", "--backend-host", "0.0.0.0", "--frontend-port", "8180", "--backend-port", "8180", "--loglevel", "debug"]
28 changes: 0 additions & 28 deletions openload_back/internal/delivery/http/server.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package http

import (
"strings"
"time"

"openload-backend/internal/delivery/http/handlers"
"openload-backend/internal/delivery/http/router"

"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/log"
"github.com/gofiber/fiber/v3/middleware/cache"
"github.com/gofiber/fiber/v3/middleware/compress"
"github.com/gofiber/fiber/v3/middleware/cors"
"github.com/gofiber/fiber/v3/middleware/logger"
Expand Down Expand Up @@ -46,30 +42,6 @@ func NewServer(analytics *handlers.AnalyticsHandler, project *handlers.ProjectHa
AllowCredentials: false,
}))

// Cache stable GET responses for a short window.
// Skipped for: run endpoints (change during active tests), progress/cancel,
// and any mutation method (cache middleware only processes GET/HEAD by default,
// but the Next guard makes the intent explicit).
app.Use(cache.New(cache.Config{
Expiration: 15 * time.Second,
Next: func(c fiber.Ctx) bool {
// Only cache GET requests.
if c.Method() != fiber.MethodGet {
return true
}
path := c.Path()
// Skip real-time / rapidly-changing run endpoints.
if strings.HasPrefix(path, "/api/v1/runs") {
return true
}
// Skip live progress and health (always fresh).
if strings.HasSuffix(path, "/progress") || path == "/health" {
return true
}
return false
},
}))

router.Register(app, analytics, project, scheduled, sequence, dataset)
return app
}
76 changes: 37 additions & 39 deletions openload_front/openload/pages/analytics/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,31 @@ def run_card_stats_grid(
value=rx.cond(
(median_time == "") | (median_time == 0),
"—ms",
rx.text(f"{median_time:.2f}ms", size="4", weight="bold"),
f"{median_time:.2f}ms",
),
),
stat_cell(
label="Avg",
value=rx.cond(
(avg_time == "") | (avg_time == 0),
"—ms",
rx.text(f"{avg_time:.2f}ms", size="4", weight="bold"),
f"{avg_time:.2f}ms",
),
),
stat_cell(
label="Min",
value=rx.cond(
(min_time == "") | (min_time == 0),
"—ms",
rx.text(f"{min_time:.2f}ms", size="4", weight="bold"),
f"{min_time:.2f}ms",
),
),
stat_cell(
label="Max",
value=rx.cond(
(max_time == "") | (max_time == 0),
"—ms",
rx.text(f"{max_time:.2f}ms", size="4", weight="bold"),
f"{max_time:.2f}ms",
),
),
columns="2",
Expand Down Expand Up @@ -183,46 +183,44 @@ def run_card(run: rx.Var[dict], back_url: str | rx.Var | None = None) -> rx.Comp
run["run_id"], run["project_iid"], run["service_iid"]
),
),
# Card content
rx.link(
rx.box(
rx.vstack(
run_card_header(
name=run["name"],
has_report=run["has_report"],
kind=run.get("kind", "http"),
),
run_card_metadata(
project_iid=run["project_iid"],
service_iid=run["service_iid"],
),
rx.divider(),
run_card_stats_grid(
total_requests=run["total_requests"],
failures=run["failures"],
median_time=run["median_time"],
avg_time=run["avg_time"],
min_time=run["min_time"],
max_time=run["max_time"],
),
rx.cond(
run["created_at"] != "",
rx.moment(
run["created_at"],
format="HH:mm:ss DD MMM YYYY",
),
rx.text("—", size="2", color=rx.color("gray", 11)),
# Card content — rx.box with on_click avoids <a> inside <a> hydration error
# (run_card_metadata contains project/service rx.link elements)
rx.box(
rx.vstack(
run_card_header(
name=run["name"],
has_report=run["has_report"],
kind=run.get("kind", "http"),
),
run_card_metadata(
project_iid=run["project_iid"],
service_iid=run["service_iid"],
),
rx.divider(),
run_card_stats_grid(
total_requests=run["total_requests"],
failures=run["failures"],
median_time=run["median_time"],
avg_time=run["avg_time"],
min_time=run["min_time"],
max_time=run["max_time"],
),
rx.cond(
run["created_at"] != "",
rx.moment(
run["created_at"],
format="HH:mm:ss DD MMM YYYY",
),
spacing="4",
align="start",
width="100%",
rx.text("—", size="2", color=rx.color("gray", 11)),
),
spacing="4",
align="start",
width="100%",
),
href=href,
underline="none",
_hover={"text_decoration": "none"},
on_click=rx.redirect(href),
cursor="pointer",
flex_grow=1,
width="100%",
),
width="100%",
align="start",
Expand Down
5 changes: 3 additions & 2 deletions openload_front/openload/pages/analytics/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def sidebar_filters() -> rx.Component:
)


@rx.page(route="/analytics", title="Analytics")
@rx.page(
route="/analytics", title="Analytics", on_load=[AnalyticsState.on_mount, CompareSelectionState.clear_selection]
)
def analytics() -> rx.Component:
return base_page(
rx.box(
Expand Down Expand Up @@ -215,7 +217,6 @@ def analytics() -> rx.Component:
height="100vh",
spacing="0",
overflow="hidden",
on_mount=[AnalyticsState.on_mount, CompareSelectionState.clear_selection],
),
# Floating action buttons (Compare and Select All)
rx.box(
Expand Down
5 changes: 1 addition & 4 deletions openload_front/openload/pages/analytics_run/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import reflex as rx

from ...shared.components.badges import protocol_badge
from ...shared.components.charts import (
analytics_chart,
response_time_chart,
)
from ...shared.components.charts import analytics_chart, response_time_chart
from ...states import RunAnalyticsState


Expand Down
3 changes: 1 addition & 2 deletions openload_front/openload/pages/analytics_run/run_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .common import run_analytics_empty_view, run_analytics_loaded_view


@rx.page(route="/analytics/run", title="Run Analytics")
@rx.page(route="/analytics/run", title="Run Analytics", on_load=RunAnalyticsState.on_mount)
def run_analytics() -> rx.Component:
return base_page(
rx.vstack(
Expand All @@ -18,6 +18,5 @@ def run_analytics() -> rx.Component:
min_height="100vh",
spacing="0",
padding="2rem",
on_mount=RunAnalyticsState.on_mount,
)
)
19 changes: 6 additions & 13 deletions openload_front/openload/pages/compare/degradation_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

def degradation_graph() -> rx.Component:
"""Metric trend chart across selected runs."""

return rx.vstack(
# Controls
rx.hstack(
rx.vstack(
rx.text("Metric", size="2", weight="bold"),
Expand All @@ -34,14 +32,13 @@ def degradation_graph() -> rx.Component:
spacing="3",
align="end",
),
# Chart
rx.cond(
CompareState.graph_data,
rx.match(
CompareState.graph_metric,
(
"time metrics",
rx.recharts.composed_chart(
rx.recharts.line_chart(
rx.recharts.line(
data_key="avg_val",
stroke=rx.color("blue", 9),
Expand Down Expand Up @@ -78,9 +75,7 @@ def degradation_graph() -> rx.Component:
rx.recharts.y_axis(),
rx.recharts.cartesian_grid(stroke_dasharray="3 3"),
rx.recharts.legend(),
rx.recharts.graphing_tooltip(
formatter=rx.Var.create("(v) => v != null ? v.toFixed(2) + ' ms' : '—'"),
),
rx.recharts.graphing_tooltip(),
rx.recharts.brush(data_key="date_label"),
data=CompareState.graph_data,
width="100%",
Expand All @@ -90,7 +85,7 @@ def degradation_graph() -> rx.Component:
),
(
"percentiles",
rx.recharts.composed_chart(
rx.recharts.line_chart(
rx.recharts.line(
data_key="p50_val",
stroke=rx.color("blue", 9),
Expand Down Expand Up @@ -127,9 +122,7 @@ def degradation_graph() -> rx.Component:
rx.recharts.y_axis(),
rx.recharts.cartesian_grid(stroke_dasharray="3 3"),
rx.recharts.legend(),
rx.recharts.graphing_tooltip(
formatter=rx.Var.create("(v) => v != null ? v.toFixed(2) + ' ms' : '—'"),
),
rx.recharts.graphing_tooltip(),
rx.recharts.brush(data_key="date_label"),
data=CompareState.graph_data,
width="100%",
Expand All @@ -139,7 +132,7 @@ def degradation_graph() -> rx.Component:
),
(
"total reqs & % err",
rx.recharts.composed_chart(
rx.recharts.line_chart(
rx.recharts.line(
data_key="total_requests",
stroke=rx.color("blue", 9),
Expand Down Expand Up @@ -170,7 +163,7 @@ def degradation_graph() -> rx.Component:
margin={"top": 5, "right": 40, "left": 0, "bottom": 50},
),
),
rx.recharts.composed_chart(
rx.recharts.line_chart(
rx.recharts.line(
data_key="req_per_sec_val",
stroke=rx.color("blue", 9),
Expand Down
3 changes: 1 addition & 2 deletions openload_front/openload/pages/compare/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .degradation_graph import degradation_graph


@rx.page(route="/compare", title="Compare")
@rx.page(route="/compare", title="Compare", on_load=CompareState.on_mount)
def compare() -> rx.Component:
"""Comparison page with table and degradation graph."""
return rx.box(
Expand Down Expand Up @@ -128,7 +128,6 @@ def compare() -> rx.Component:
),
width="100%",
spacing="6",
on_mount=CompareState.on_mount,
),
),
)
3 changes: 1 addition & 2 deletions openload_front/openload/pages/create_service/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def method_row(method: rx.Var[dict], idx: int) -> rx.Component:
)


@rx.page(route="/create-service/[project_iid]", title="Create Service")
@rx.page(route="/create-service/[project_iid]", title="Create Service", on_load=ProjectState.on_mount_create_service)
def create_service() -> rx.Component:
return base_page(
rx.vstack(
Expand Down Expand Up @@ -357,6 +357,5 @@ def create_service() -> rx.Component:
min_height="100vh",
spacing="0",
padding="2rem",
on_mount=ProjectState.on_mount_create_service,
)
)
3 changes: 1 addition & 2 deletions openload_front/openload/pages/create_test/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .websocket_tab import websocket_tab


@rx.page(route="/create-test", title="Create Test")
@rx.page(route="/create-test", title="Create Test", on_load=LoadTestState.on_mount_combined)
def create_test() -> rx.Component:
return base_page(
rx.vstack(
Expand Down Expand Up @@ -67,6 +67,5 @@ def create_test() -> rx.Component:
width="100%",
min_height="100vh",
padding="2rem",
on_mount=LoadTestState.on_mount_combined,
)
)
3 changes: 1 addition & 2 deletions openload_front/openload/pages/project_detail/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _services_section() -> rx.Component:
)


@rx.page(route="/project/[iid]", title="Project")
@rx.page(route="/project/[iid]", title="Project", on_load=ProjectState.on_mount_project_detail)
def project_detail() -> rx.Component:
return base_page(
rx.vstack(
Expand Down Expand Up @@ -451,6 +451,5 @@ def project_detail() -> rx.Component:
min_height="100vh",
spacing="0",
padding="2rem",
on_mount=ProjectState.on_mount_project_detail,
)
)
3 changes: 1 addition & 2 deletions openload_front/openload/pages/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _blank_state() -> rx.Component:
)


@rx.page(route="/projects", title="Projects")
@rx.page(route="/projects", title="Projects", on_load=ProjectState.on_mount_list)
def projects() -> rx.Component:
return base_page(
rx.vstack(
Expand Down Expand Up @@ -198,6 +198,5 @@ def projects() -> rx.Component:
min_height="100vh",
spacing="0",
padding="2rem",
on_mount=ProjectState.on_mount_list,
)
)
5 changes: 3 additions & 2 deletions openload_front/openload/pages/scheduled_runs/detail_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def _exec_skeleton_rows() -> rx.Component:
)


@rx.page(route="/scheduled-runs/scheduled-run", title="Scheduled Run Detail")
@rx.page(
route="/scheduled-runs/scheduled-run", title="Scheduled Run Detail", on_load=ScheduledRunsState.on_mount_detail
)
def scheduled_run_detail() -> rx.Component:
"""Scheduled run detail page."""
return base_page(
Expand Down Expand Up @@ -482,6 +484,5 @@ def scheduled_run_detail() -> rx.Component:
width="100%",
min_height="100vh",
padding="2rem",
on_mount=ScheduledRunsState.on_mount_detail,
)
)
Loading