Documentation
¶
Index ¶
- Constants
- func CPURateIntervalString() string
- func Dashboard(sources []Cache, sourceNames []string)
- func ExampleDashboard(width, height int) string
- func FourPaneGrid(width, height int) string
- func Horizontal(panes ...Pane) string
- func MaxCPURecords() int
- func NewDashboard(sources []Cache, sourceNames []string) *dashboardModel
- func SimpleTwoColumnLayout(leftContent, rightContent string, width, height int) string
- func ThreeColumnLayout(left, center, right string, width, height int) string
- func UpdateDuration() time.Duration
- func Vertical(panes ...Pane) string
- func Wrap(panesPerRow int, panes ...Pane) string
- type Cache
- type Chart
- type DashboardLayout
- type Data
- type DetectedSource
- type GridLayout
- type NodeExporterData
- type NodeRef
- type Pane
- func (p Pane) Init() tea.Cmd
- func (p Pane) Render() string
- func (p Pane) SetBorderStyle(style lipgloss.Style) Pane
- func (p Pane) SetContent(content string) Pane
- func (p Pane) SetFocused(focused bool) Pane
- func (p Pane) SetSize(width, height int) Pane
- func (p Pane) SetTitle(title string) Pane
- func (p Pane) SetTitleStyle(style lipgloss.Style) Pane
- func (p Pane) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (p Pane) View() string
- type PrometheusData
- type TabSet
- func (ts *TabSet) AddChart(chart Chart) *TabSet
- func (ts *TabSet) GetChartPointer(index int) *Chart
- func (ts *TabSet) GetCharts() []Chart
- func (ts *TabSet) GetSelectedTab() int
- func (ts *TabSet) NextTab() *TabSet
- func (ts *TabSet) PrevTab() *TabSet
- func (ts *TabSet) RemoveCurrentTab() bool
- func (ts *TabSet) Render() string
- func (ts *TabSet) SelectTab(index int) *TabSet
- func (ts *TabSet) SetSize(width, height int) *TabSet
- func (ts *TabSet) String() string
- type WrapTable
- func (wt *WrapTable) Border(border lipgloss.Border) *WrapTable
- func (wt *WrapTable) BorderStyle(style lipgloss.Style) *WrapTable
- func (wt *WrapTable) Headers(headers ...string) *WrapTable
- func (wt *WrapTable) MaxHeight(height int) *WrapTable
- func (wt *WrapTable) MaxWidth(width int) *WrapTable
- func (wt *WrapTable) Render() string
- func (wt *WrapTable) Rows(rows ...[]string) *WrapTable
- func (wt *WrapTable) String() string
Constants ¶
const ( // CPU_RATE_INTERVAL is the time window in seconds used to calculate CPU usage rates CPU_RATE_INTERVAL = 60 // UPDATE_INTERVAL is the time between data updates in seconds UPDATE_INTERVAL = 1 )
Variables ¶
This section is empty.
Functions ¶
func CPURateIntervalString ¶ added in v0.0.2
func CPURateIntervalString() string
CPURateIntervalString returns the CPU rate interval formatted for Prometheus queries (e.g., "60s")
func ExampleDashboard ¶
ExampleDashboard demonstrates how to use Pane and layout helpers
func FourPaneGrid ¶
FourPaneGrid demonstrates using Wrap to create a 2x2 grid of metric panes
func MaxCPURecords ¶ added in v0.0.2
func MaxCPURecords() int
MaxCPURecords returns the maximum number of CPU readings to store Calculated as CPU_RATE_INTERVAL / UPDATE_INTERVAL, rounded
func NewDashboard ¶
func SimpleTwoColumnLayout ¶
SimpleTwoColumnLayout creates a basic two-column dashboard
func ThreeColumnLayout ¶
ThreeColumnLayout creates a three-column dashboard
func UpdateDuration ¶ added in v0.0.2
UpdateDuration returns the update interval as a time.Duration
Types ¶
type Cache ¶
type Cache struct {
Data
// contains filtered or unexported fields
}
func (*Cache) MaxNodeNameLen ¶
func (*Cache) NumberOfNodes ¶
type Chart ¶
type Chart struct {
NodeRef NodeRef
ChartType string // "cpu", "memory", "disk", "network"
CpuData map[string][]float64 // CPU name -> time series
MemoryData map[string]float64 // Memory metrics: total, available, used, used_percent, cached, buffers
}
Chart represents a chart displaying metrics for a specific node
type DashboardLayout ¶
type DashboardLayout struct {
// contains filtered or unexported fields
}
DashboardLayout handles positioning and rendering of multiple panes
func NewDashboardLayout ¶
func NewDashboardLayout(width, height int) *DashboardLayout
NewDashboardLayout creates a new dashboard layout
func (*DashboardLayout) AddPane ¶
func (d *DashboardLayout) AddPane(pane Pane)
AddPane adds a pane to the layout
func (*DashboardLayout) SetSize ¶
func (d *DashboardLayout) SetSize(width, height int)
SetSize updates the layout dimensions
type DetectedSource ¶
DetectedSource holds a data source and its display name
func TryConnectWithFallbacks ¶
func TryConnectWithFallbacks(baseURL *url.URL) []DetectedSource
TryConnectWithFallbacks tries multiple URL variants to connect to data sources Returns all successful connections (can be both Prometheus and node_exporter)
type GridLayout ¶
type GridLayout struct {
// contains filtered or unexported fields
}
Grid renders panes in a 2D grid layout
func (*GridLayout) AddRow ¶
func (g *GridLayout) AddRow(panes ...Pane)
AddRow adds a row of panes to the grid
type NodeExporterData ¶
type NodeExporterData struct {
// contains filtered or unexported fields
}
func NewNodeExporterData ¶
func NewNodeExporterData(urls []*url.URL) (*NodeExporterData, error)
func (*NodeExporterData) Check ¶
func (n *NodeExporterData) Check() error
func (*NodeExporterData) GetMemory ¶ added in v0.0.2
func (n *NodeExporterData) GetMemory(node string) map[string]float64
func (*NodeExporterData) GetNodes ¶
func (n *NodeExporterData) GetNodes() []string
func (*NodeExporterData) GetType ¶
func (n *NodeExporterData) GetType() string
type NodeRef ¶
type NodeRef struct {
Type string // prometheus, prometheus_node, node_exporter
SourceIndex int // Index into sources array
SourceName string // Human-readable source name (hostname from URL)
NodeName string // Node name from GetNodes() (empty if IsSourceHeader)
DisplayName string // Formatted for UI
}
type Pane ¶
type Pane struct {
// contains filtered or unexported fields
}
Pane represents a bordered panel in the dashboard.
Example usage:
pane := NewPane("CPU Metrics", 40, 10).
SetContent("Core 0: 45%\nCore 1: 23%").
SetFocused(true)
fmt.Println(pane.Render())
Panes can be composed using layout helpers:
leftPane := NewPane("Left", 30, 20).SetContent("content")
rightPane := NewPane("Right", 50, 20).SetContent("content")
dashboard := Horizontal(leftPane, rightPane)
Pane implements tea.Model so it can be used as a standalone Bubble Tea component
func MetricPane ¶
MetricPane creates a formatted metric display pane
func (Pane) SetBorderStyle ¶
SetBorderStyle sets the border style
func (Pane) SetContent ¶
SetContent sets the pane content
func (Pane) SetFocused ¶
SetFocused sets the focus state
func (Pane) SetTitleStyle ¶
SetTitleStyle sets the title style
type PrometheusData ¶
type PrometheusData struct {
// contains filtered or unexported fields
}
func NewPrometheusData ¶
func NewPrometheusData(prometheusURL *url.URL) (*PrometheusData, error)
func (*PrometheusData) Check ¶
func (p *PrometheusData) Check() error
func (*PrometheusData) GetMemory ¶ added in v0.0.2
func (p *PrometheusData) GetMemory(node string) map[string]float64
func (*PrometheusData) GetNodes ¶
func (p *PrometheusData) GetNodes() []string
func (*PrometheusData) GetType ¶
func (p *PrometheusData) GetType() string
type TabSet ¶
type TabSet struct {
// contains filtered or unexported fields
}
TabSet manages multiple charts with tab navigation
func (*TabSet) GetChartPointer ¶ added in v0.0.2
GetChartPointer returns a pointer to a chart at the given index
func (*TabSet) GetSelectedTab ¶
GetSelectedTab returns the currently selected tab index
func (*TabSet) RemoveCurrentTab ¶
RemoveCurrentTab removes the currently selected tab Returns true if tab was removed, false if it was the last tab
type WrapTable ¶
type WrapTable struct {
// contains filtered or unexported fields
}
WrapTable wraps lipgloss table to support height-based wrapping When data exceeds maxHeight, it creates multiple tables side-by-side
func (*WrapTable) BorderStyle ¶
BorderStyle sets the border styling