duck.etc.blueprints.dashboard.ui.components.latency_panel¶
LatencyPanel component — displays latency percentile tiles and an inline SVG sparkline chart of recent latency history.
Module Contents¶
Classes¶
Renders a panel with p50/p90/p95/p99 latency tiles and a sparkline. |
API¶
- class duck.etc.blueprints.dashboard.ui.components.latency_panel.LatencyPanel(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]¶
Bases:
duck.html.components.InnerComponentRenders a panel with p50/p90/p95/p99 latency tiles and a sparkline.
Props: data (dict): Output of services.get_latency_stats().
Initialization
Initialize an HTML component.
- Parameters:
element – The HTML element tag name (e.g., textarea, input, button). Can be None, but make sure element is returned by get_element method.
accept_inner_html – Whether the HTML component accepts an inner body (e.g., inner-body-here).
inner_html – Inner html to add to the HTML component. Defaults to None.
properties – Dictionary for properties to initialize the component with.
props – Just same as properties argument (added for simplicity).
style – Dictionary for style to initialize the component with.
**kwargs – Extra keyword arguments
- Raises:
HtmlComponentError – If ‘element’ is not a string or ‘inner_html’ is set but ‘accept_inner_html’ is False.
- build_body(data: dict) duck.html.components.container.Container[source]¶
Returns the panel body containing the percentile grid and sparkline.
- Parameters:
data – Latency stats dict from the service layer.
- Returns:
A Container wrapping both the grid and sparkline.
- build_header() duck.html.components.container.Container[source]¶
Returns the panel header with title and avg latency label.
- Returns:
A Container with the header row markup.
- build_percentile_grid(data: dict) duck.html.components.container.Container[source]¶
Returns a grid of four latency percentile tiles.
- Parameters:
data – Latency stats dict containing p50, p90, p95, p99 keys.
- Returns:
A Container styled as the latency grid.
- build_sparkline(history: list) duck.html.components.container.Container[source]¶
Returns an SVG sparkline chart from the latency history list.
- Parameters:
history – List of latency integers representing recent measurements.
- Returns:
A Container holding the inline SVG sparkline.