mirror of
https://github.com/zaphar/Heracles.git
synced 2025-07-26 22:09:50 -04:00
Compare commits
2 Commits
4674a821d8
...
dbb69da516
Author | SHA1 | Date | |
---|---|---|---|
dbb69da516 | |||
0cf2c537ae |
@ -1,20 +1,24 @@
|
|||||||
---
|
--- # A list of dashboards
|
||||||
- title: Test Dasbboard 1
|
- title: Test Dasbboard 1
|
||||||
graphs:
|
graphs: # Each Dashboard can have 1 or more graphs in it.
|
||||||
- title: Node cpu
|
- title: Node cpu # Graphs have titles
|
||||||
d3_tick_format: "~s"
|
query_type: Range # The type of graph. Range for timeseries and Scalar for point in time
|
||||||
plots:
|
d3_tick_format: "~s" # Default tick format for the graph y axis
|
||||||
- source: http://heimdall:9001
|
plots: # List of pluts to show on the graph
|
||||||
query: 'sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))'
|
- source: http://heimdall:9001 # Prometheus source uri for this plot
|
||||||
meta:
|
query: 'sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))' # The PromQL query for this plot
|
||||||
name_label: instance
|
meta: # metadata for this plot
|
||||||
query_type: Range
|
name_label: instance # Grab a trace name from the query tags
|
||||||
span:
|
#d3_tick_format: "~%" # d3 tick format override for this plot's yaxis
|
||||||
end: now
|
#name_prefix: "Prefix" # A prefix for this sublots trace names
|
||||||
duration: 1d
|
#name_suffix: "Suffix" # A suffix for this subplots trace names
|
||||||
step_duration: 10min
|
#named_axis: "y" # yaxis name to use for this subplots traces
|
||||||
|
span: # The span for this range query
|
||||||
|
end: now # Where the span ends. RFC3339 format with special handling for the now keyword
|
||||||
|
duration: 1d # duration of the span. Uses SI formatting for duration amounts.
|
||||||
|
step_duration: 10min # step size for the duration amounts.
|
||||||
- title: Test Dasbboard 2
|
- title: Test Dasbboard 2
|
||||||
span:
|
span: # Dashboards can have default spans that get used if there is no override for the graph
|
||||||
end: 2024-02-10T00:00:00.00Z
|
end: 2024-02-10T00:00:00.00Z
|
||||||
duration: 2 days
|
duration: 2 days
|
||||||
step_duration: 1 minute
|
step_duration: 1 minute
|
||||||
@ -27,16 +31,18 @@
|
|||||||
query: |
|
query: |
|
||||||
sum by (instance)(irate(node_cpu_seconds_total{mode="system",job="nodestats"}[5m])) / sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
|
sum by (instance)(irate(node_cpu_seconds_total{mode="system",job="nodestats"}[5m])) / sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
|
||||||
meta:
|
meta:
|
||||||
d3_tick_format: "~s"
|
d3_tick_format: "~%"
|
||||||
name_label: instance
|
name_label: instance
|
||||||
name_prefix: "System"
|
name_prefix: "System"
|
||||||
|
named_axis: "y"
|
||||||
- source: http://heimdall:9001
|
- source: http://heimdall:9001
|
||||||
query: |
|
query: |
|
||||||
sum by (instance)(irate(node_cpu_seconds_total{mode="user",job="nodestats"}[5m])) / sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
|
sum by (instance)(irate(node_cpu_seconds_total{mode="user",job="nodestats"}[5m])) / sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
|
||||||
meta:
|
meta:
|
||||||
#d3_tick_format: "~s"
|
d3_tick_format: "~%"
|
||||||
name_label: instance
|
name_label: instance
|
||||||
name_suffix: "User"
|
name_suffix: "User"
|
||||||
|
named_axis: "y"
|
||||||
- title: Node memory
|
- title: Node memory
|
||||||
query_type: Scalar
|
query_type: Scalar
|
||||||
plots:
|
plots:
|
||||||
|
@ -120,6 +120,7 @@ pub struct PlotMeta {
|
|||||||
name_prefix: Option<String>,
|
name_prefix: Option<String>,
|
||||||
name_suffix: Option<String>,
|
name_suffix: Option<String>,
|
||||||
name_label: Option<String>,
|
name_label: Option<String>,
|
||||||
|
named_axis: Option<String>,
|
||||||
d3_tick_format: Option<String>,
|
d3_tick_format: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,12 +137,14 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
for (var subplot_idx in data) {
|
for (var subplot_idx in data) {
|
||||||
const subplot = data[subplot_idx];
|
const subplot = data[subplot_idx];
|
||||||
const subplotCount = Number(subplot_idx) + 1;
|
const subplotCount = Number(subplot_idx) + 1;
|
||||||
const yaxis = "y" + subplotCount
|
const default_yaxis = "y" + subplotCount
|
||||||
if (subplot.Series) {
|
if (subplot.Series) {
|
||||||
// https://plotly.com/javascript/reference/scatter/
|
// https://plotly.com/javascript/reference/scatter/
|
||||||
for (const triple of subplot.Series) {
|
for (const triple of subplot.Series) {
|
||||||
const labels = triple[0];
|
const labels = triple[0];
|
||||||
const meta = triple[1];
|
const meta = triple[1];
|
||||||
|
const yaxis = meta["named_axis"] || default_yaxis;
|
||||||
|
// https://plotly.com/javascript/reference/layout/yaxis/
|
||||||
layout["yaxis" + subplotCount] = {
|
layout["yaxis" + subplotCount] = {
|
||||||
anchor: yaxis,
|
anchor: yaxis,
|
||||||
tickformat: meta["d3_tick_format"] || this.#d3TickFormat
|
tickformat: meta["d3_tick_format"] || this.#d3TickFormat
|
||||||
@ -153,6 +155,8 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
mode: "lines+text",
|
mode: "lines+text",
|
||||||
x: [],
|
x: [],
|
||||||
y: [],
|
y: [],
|
||||||
|
// We always share the x axis for timeseries graphs.
|
||||||
|
xaxis: "x",
|
||||||
yaxis: yaxis,
|
yaxis: yaxis,
|
||||||
yhoverformat: meta["d3_tick_format"],
|
yhoverformat: meta["d3_tick_format"],
|
||||||
};
|
};
|
||||||
@ -201,7 +205,6 @@ class TimeseriesGraph extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.debug("traces: ", traces);
|
|
||||||
// https://plotly.com/javascript/plotlyjs-function-reference/#plotlyreact
|
// https://plotly.com/javascript/plotlyjs-function-reference/#plotlyreact
|
||||||
Plotly.react(this.getTargetNode(), traces, layout, config);
|
Plotly.react(this.getTargetNode(), traces, layout, config);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user