Documentation
¶
Index ¶
- Variables
- func Div(a, b float64) float64
- func FlattenInstant(rows []model.MetricRow) map[string]float64
- func FlattenRange(rows []model.MetricRow) map[string][]model.MetricPoint
- func FormatUptime(seconds float64) string
- func GetMetricNames(metrics []model.MetricSelector, instantOnly bool) []string
- func HasPermission(userPermissions []string, permission string) bool
- func HasPrefix(s, prefix string) bool
- func HumanizeBytes(b float64) string
- func Marshal(v interface{}) template.JS
- func SafeHTML(s string) template.HTML
- func Seq(from, to int) []int
- func Since(ts string) string
- type Breadcrumb
- type GoSightTemplate
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
View Source
var ContainerMetrics = []model.MetricSelector{ {Name: "container.podman.uptime_seconds", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.running", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.cpu_percent", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.mem_usage_bytes", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.mem_limit_bytes", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.net_rx_bytes", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, {Name: "container.podman.net_tx_bytes", Namespace: "Container", SubNamespace: "Container.Podman", Instant: true}, }
View Source
var HostMetrics = []model.MetricSelector{ {Name: "system.cpu.count_physical", Namespace: "System", SubNamespace: "System.CPU", Instant: true}, {Name: "system.cpu.usage_percent", Namespace: "System", SubNamespace: "System.CPU", Instant: true}, {Name: "system.cpu.time_user", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_system", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_idle", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_nice", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_guest", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_guest_nice", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_iowait", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_irq", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_softirq", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.time_steal", Namespace: "System", SubNamespace: "System.CPU", Instant: false}, {Name: "system.cpu.clock_mhz", Namespace: "System", SubNamespace: "System.CPU", Instant: true}, {Name: "system.cpu.count_logical", Namespace: "System", SubNamespace: "System.CPU", Instant: true}, {Name: "system.memory.available", Namespace: "System", SubNamespace: "System.Memory", Instant: true}, {Name: "system.memory.used", Namespace: "System", SubNamespace: "System.Memory", Instant: true}, {Name: "system.memory.used_percent", Namespace: "System", SubNamespace: "System.Memory", Instant: false}, {Name: "system.memory.total", Namespace: "System", SubNamespace: "System.Memory", Instant: true}, {Name: "system.host.procs", Namespace: "System", SubNamespace: "System.Host", Instant: true}, {Name: "system.host.users_loggedin", Namespace: "System", SubNamespace: "System.Host", Instant: true}, {Name: "system.host.info", Namespace: "System", SubNamespace: "System.Host", Instant: true}, {Name: "system.host.uptime", Namespace: "System", SubNamespace: "System.Host", Instant: true}, {Name: "system.diskio.read_bytes", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.read_time", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.write_time", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.merged_read_count", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.merged_write_count", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.weighted_io", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.read_count", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.write_count", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.write_bytes", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.diskio.io_time", Namespace: "System", SubNamespace: "System.DiskIO", Instant: false}, {Name: "system.disk.used_percent", Namespace: "System", SubNamespace: "System.Disk", Instant: false}, {Name: "system.disk.inodes_total", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.disk.total", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.disk.used", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.disk.inodes_used", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.disk.inodes_free", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.disk.inodes_used_percent", Namespace: "System", SubNamespace: "System.Disk", Instant: false}, {Name: "system.disk.free", Namespace: "System", SubNamespace: "System.Disk", Instant: true}, {Name: "system.network.packets_recv", Namespace: "System", SubNamespace: "System.Network", Instant: false}, {Name: "system.network.err_in", Namespace: "System", SubNamespace: "System.Network", Instant: false}, {Name: "system.network.err_out", Namespace: "System", SubNamespace: "System.Network", Instant: false}, {Name: "system.network.bytes_sent", Namespace: "System", SubNamespace: "System.Network", Instant: false}, {Name: "system.network.bytes_recv", Namespace: "System", SubNamespace: "System.Network", Instant: false}, {Name: "system.network.packets_sent", Namespace: "System", SubNamespace: "System.Network", Instant: false}, }
Functions ¶
func FlattenInstant ¶
FlattenInstant flattens the MetricRows returned by store and makes it usable for template
func FlattenRange ¶
func FlattenRange(rows []model.MetricRow) map[string][]model.MetricPoint
func FormatUptime ¶
func GetMetricNames ¶
func GetMetricNames(metrics []model.MetricSelector, instantOnly bool) []string
func HasPermission ¶
HasPermission checks if a user has a specific permission.
func HumanizeBytes ¶
HumanizeBytes converts a byte size in bytes to a human-readable string.
Types ¶
type Breadcrumb ¶
Breadcrumb represents a single breadcrumb in the navigation trail.
type GoSightTemplate ¶
type GoSightTemplate struct {
Cfg *config.Config
Tmpl *template.Template
MetricStore metricstore.MetricStore
MetricIndex *metricindex.MetricIndex
UserStore userstore.UserStore
// contains filtered or unexported fields
}
func NewGoSightTemplate ¶
func NewGoSightTemplate( ctx context.Context, cfg *config.Config, metricStore metricstore.MetricStore, metricIndex *metricindex.MetricIndex, userStore userstore.UserStore) (*GoSightTemplate, error)
func (*GoSightTemplate) BuildPageData ¶
func (t *GoSightTemplate) BuildPageData(user *usermodel.User, breadcrumbs, labels map[string]string, path, title string, meta *model.Meta, permissions []string) *TemplateData
BuildPageData constructs the TemplateData for rendering a page.
func (*GoSightTemplate) RenderTemplate ¶
func (t *GoSightTemplate) RenderTemplate(w http.ResponseWriter, layout, page string, data any) error
RenderTemplate renders a template with the given layout and page, passing in the provided data.
type TemplateData ¶
type TemplateData struct {
Title string
User *usermodel.User
UserData usermodel.SafeUser
Permissions []string
Metrics map[string]float64 // TODO: Revaluate need.
Timeseries map[string][]model.MetricPoint
Tags map[string]string
Labels map[string]string
Meta *model.Meta
Breadcrumbs []Breadcrumb
CurrentPath string
}
TemplateData holds the data passed to templates for rendering.
Click to show internal directories.
Click to hide internal directories.