Documentation
¶
Overview ¶
Package devops implements the multi-provider devops capability aggregator.
Index ¶
- Constants
- func Register(app string, svc Service) error
- type Adapter
- func (a *Adapter) BeszelGetSystem(ctx context.Context, in GetSystemInput) (*capability.DevopsSystem, error)
- func (a *Adapter) BeszelListSystems(ctx context.Context) (*capability.ListResult[capability.DevopsSystem], error)
- func (a *Adapter) DozzleHealth(ctx context.Context) (*capability.DevopsDozzleInfo, error)
- func (a *Adapter) GrafanaHealth(ctx context.Context) (*capability.DevopsGrafanaHealth, error)
- func (a *Adapter) GrafanaListDatasources(ctx context.Context) (*capability.ListResult[capability.DevopsDatasource], error)
- func (a *Adapter) GrafanaQuery(ctx context.Context, in GrafanaQueryInput) (*capability.DevopsGrafanaQueryResult, error)
- func (a *Adapter) GrafanaSearchDashboards(ctx context.Context, in SearchDashboardsInput) (*capability.ListResult[capability.DevopsDashboard], error)
- func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)
- func (a *Adapter) NetalertxHealth(ctx context.Context) error
- func (a *Adapter) NetalertxListDevices(ctx context.Context) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
- func (a *Adapter) NetalertxSearchDevices(ctx context.Context, in SearchDevicesInput) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
- func (a *Adapter) NetalertxTotals(ctx context.Context) (*capability.DevopsNetalertxTotals, error)
- func (a *Adapter) Status(ctx context.Context) (*capability.DevopsStatus, error)
- func (a *Adapter) TraefikListRouters(ctx context.Context) (*capability.ListResult[capability.DevopsRouter], error)
- func (a *Adapter) TraefikListServices(ctx context.Context) (*capability.ListResult[capability.DevopsService], error)
- func (a *Adapter) TraefikOverview(ctx context.Context) (*capability.DevopsTraefikOverview, error)
- func (a *Adapter) UptimekumaHealth(ctx context.Context) error
- func (a *Adapter) UptimekumaMetrics(ctx context.Context) (*capability.ListResult[capability.DevopsMetricFamily], error)
- func (a *Adapter) WakapiListProjects(ctx context.Context) (*capability.ListResult[capability.DevopsWakapiProject], error)
- func (a *Adapter) WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)
- type Clients
- type GetSystemInput
- type GrafanaQueryInput
- type SearchDashboardsInput
- type SearchDevicesInput
- type Service
- type SummaryInput
Constants ¶
const ( OpHealth = "health" OpStatus = "status" OpBeszelListSystems = "beszel_list_systems" OpBeszelGetSystem = "beszel_get_system" OpUptimekumaHealth = "uptimekuma_health" OpUptimekumaMetrics = "uptimekuma_metrics" OpTraefikOverview = "traefik_overview" OpTraefikListRouters = "traefik_list_routers" OpTraefikListServices = "traefik_list_services" OpGrafanaHealth = "grafana_health" OpGrafanaListDatasources = "grafana_list_datasources" OpGrafanaSearchDashboards = "grafana_search_dashboards" OpGrafanaQuery = "grafana_query" OpWakapiSummary = "wakapi_summary" OpWakapiListProjects = "wakapi_list_projects" OpDozzleHealth = "dozzle_health" OpNetalertxHealth = "netalertx_health" OpNetalertxListDevices = "netalertx_list_devices" OpNetalertxTotals = "netalertx_totals" OpNetalertxSearchDevices = "netalertx_search_devices" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements Service using optional provider clients.
func (*Adapter) BeszelGetSystem ¶
func (a *Adapter) BeszelGetSystem(ctx context.Context, in GetSystemInput) (*capability.DevopsSystem, error)
BeszelGetSystem returns one Beszel system.
func (*Adapter) BeszelListSystems ¶
func (a *Adapter) BeszelListSystems(ctx context.Context) (*capability.ListResult[capability.DevopsSystem], error)
BeszelListSystems lists Beszel systems.
func (*Adapter) DozzleHealth ¶
func (a *Adapter) DozzleHealth(ctx context.Context) (*capability.DevopsDozzleInfo, error)
DozzleHealth checks Dozzle and returns version when available.
func (*Adapter) GrafanaHealth ¶
func (a *Adapter) GrafanaHealth(ctx context.Context) (*capability.DevopsGrafanaHealth, error)
GrafanaHealth returns Grafana health.
func (*Adapter) GrafanaListDatasources ¶
func (a *Adapter) GrafanaListDatasources(ctx context.Context) (*capability.ListResult[capability.DevopsDatasource], error)
GrafanaListDatasources lists Grafana datasources.
func (*Adapter) GrafanaQuery ¶
func (a *Adapter) GrafanaQuery(ctx context.Context, in GrafanaQueryInput) (*capability.DevopsGrafanaQueryResult, error)
GrafanaQuery runs a query against prometheus/alloy/loki/tempo/pyroscope via Grafana.
func (*Adapter) GrafanaSearchDashboards ¶
func (a *Adapter) GrafanaSearchDashboards(ctx context.Context, in SearchDashboardsInput) (*capability.ListResult[capability.DevopsDashboard], error)
GrafanaSearchDashboards searches Grafana dashboards.
func (*Adapter) HealthCheck ¶
HealthCheck probes configured backends that expose a health endpoint. Returns true when at least one such backend is configured and all of them succeed.
func (*Adapter) NetalertxHealth ¶
NetalertxHealth checks NetAlertX reachability.
func (*Adapter) NetalertxListDevices ¶
func (a *Adapter) NetalertxListDevices(ctx context.Context) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
NetalertxListDevices lists NetAlertX devices.
func (*Adapter) NetalertxSearchDevices ¶
func (a *Adapter) NetalertxSearchDevices(ctx context.Context, in SearchDevicesInput) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
NetalertxSearchDevices searches NetAlertX devices.
func (*Adapter) NetalertxTotals ¶
func (a *Adapter) NetalertxTotals(ctx context.Context) (*capability.DevopsNetalertxTotals, error)
NetalertxTotals returns NetAlertX device category counts.
func (*Adapter) Status ¶
func (a *Adapter) Status(ctx context.Context) (*capability.DevopsStatus, error)
Status reports which backends are configured.
func (*Adapter) TraefikListRouters ¶
func (a *Adapter) TraefikListRouters(ctx context.Context) (*capability.ListResult[capability.DevopsRouter], error)
TraefikListRouters lists Traefik HTTP routers.
func (*Adapter) TraefikListServices ¶
func (a *Adapter) TraefikListServices(ctx context.Context) (*capability.ListResult[capability.DevopsService], error)
TraefikListServices lists Traefik HTTP services.
func (*Adapter) TraefikOverview ¶
func (a *Adapter) TraefikOverview(ctx context.Context) (*capability.DevopsTraefikOverview, error)
TraefikOverview returns Traefik overview counts.
func (*Adapter) UptimekumaHealth ¶
UptimekumaHealth checks Uptime Kuma metrics reachability.
func (*Adapter) UptimekumaMetrics ¶
func (a *Adapter) UptimekumaMetrics(ctx context.Context) (*capability.ListResult[capability.DevopsMetricFamily], error)
UptimekumaMetrics returns summarized Prometheus metric families.
func (*Adapter) WakapiListProjects ¶
func (a *Adapter) WakapiListProjects(ctx context.Context) (*capability.ListResult[capability.DevopsWakapiProject], error)
WakapiListProjects lists Wakapi projects.
func (*Adapter) WakapiSummary ¶
func (a *Adapter) WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)
WakapiSummary returns a coding-stats summary.
type Clients ¶
type Clients struct {
Beszel beszelClient
Uptimekuma uptimekumaClient
Traefik traefikClient
Grafana grafanaClient
Wakapi wakapiClient
Dozzle dozzleClient
Netalertx netalertxClient
}
Clients holds optional provider clients for constructing an Adapter in tests.
type GetSystemInput ¶
type GetSystemInput struct {
ID string
}
GetSystemInput holds parameters for fetching a Beszel system.
type GrafanaQueryInput ¶
type GrafanaQueryInput struct {
Backend string
Expr string
DatasourceUID string
From string
To string
MaxLines int
}
GrafanaQueryInput holds parameters for a Grafana observability backend query.
type SearchDashboardsInput ¶
type SearchDashboardsInput struct {
Query string
}
SearchDashboardsInput holds parameters for Grafana dashboard search.
type SearchDevicesInput ¶
type SearchDevicesInput struct {
Query string
}
SearchDevicesInput holds parameters for NetAlertX device search.
type Service ¶
type Service interface {
HealthCheck(ctx context.Context) (bool, error)
Status(ctx context.Context) (*capability.DevopsStatus, error)
BeszelListSystems(ctx context.Context) (*capability.ListResult[capability.DevopsSystem], error)
BeszelGetSystem(ctx context.Context, in GetSystemInput) (*capability.DevopsSystem, error)
UptimekumaHealth(ctx context.Context) error
UptimekumaMetrics(ctx context.Context) (*capability.ListResult[capability.DevopsMetricFamily], error)
TraefikOverview(ctx context.Context) (*capability.DevopsTraefikOverview, error)
TraefikListRouters(ctx context.Context) (*capability.ListResult[capability.DevopsRouter], error)
TraefikListServices(ctx context.Context) (*capability.ListResult[capability.DevopsService], error)
GrafanaHealth(ctx context.Context) (*capability.DevopsGrafanaHealth, error)
GrafanaListDatasources(ctx context.Context) (*capability.ListResult[capability.DevopsDatasource], error)
GrafanaSearchDashboards(ctx context.Context, in SearchDashboardsInput) (*capability.ListResult[capability.DevopsDashboard], error)
GrafanaQuery(ctx context.Context, in GrafanaQueryInput) (*capability.DevopsGrafanaQueryResult, error)
WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)
WakapiListProjects(ctx context.Context) (*capability.ListResult[capability.DevopsWakapiProject], error)
DozzleHealth(ctx context.Context) (*capability.DevopsDozzleInfo, error)
NetalertxHealth(ctx context.Context) error
NetalertxListDevices(ctx context.Context) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
NetalertxTotals(ctx context.Context) (*capability.DevopsNetalertxTotals, error)
NetalertxSearchDevices(ctx context.Context, in SearchDevicesInput) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
}
Service defines the devops aggregator capability contract.
func New ¶
func New() Service
New creates an Adapter from configured providers. Returns nil when no devops provider is configured.
func NewWithClients ¶
NewWithClients creates an Adapter from explicit clients (for tests). Returns nil when every client is nil.
type SummaryInput ¶
type SummaryInput struct {
Interval string
}
SummaryInput holds parameters for Wakapi summary.