internal

package
v0.0.0-...-f6dd12c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLevel

func ParseLevel(s string) slog.Level

func SetUpSlog

func SetUpSlog(wr io.Writer, level slog.Level)

Types

type Board

type Board struct {
	ID     uint     `mapstructure:"id,omitempty"`
	UID    string   `mapstructure:"uid,omitempty"`
	Title  string   `mapstructure:"title"`
	Tags   []string `mapstructure:"tags"`
	Panels []*Panel `mapstructure:"panels"`
}

Board represents Grafana dashboard.

type DashboardsExportConfig

type DashboardsExportConfig struct {
	*ExportConfig
	SvcToken string
}

type DashboardsExporter

type DashboardsExporter struct {
	// contains filtered or unexported fields
}

func NewDashboardsExporter

func NewDashboardsExporter(cfg *DashboardsExportConfig) (*DashboardsExporter, error)

func (*DashboardsExporter) Export

func (dex *DashboardsExporter) Export(ctx context.Context) error

type DashboardsIdler

type DashboardsIdler struct {
	// contains filtered or unexported fields
}

func NewDashboardsIdler

func NewDashboardsIdler(cfg *IdlerConfig) *DashboardsIdler

func (*DashboardsIdler) List

type Datasource

type Datasource struct {
	Type string `mapstructure:"type"`
	UID  string `mapstructure:"UID"`
}

type ExportConfig

type ExportConfig struct {
	Addr   string
	Output string
}

type GrafanaConfig

type GrafanaConfig struct {
	URL    string
	Scheme string
	APIKey string
}

type IdleDashboard

type IdleDashboard struct {
	Board    Board
	Missings map[MetricName]struct{}
}

type IdleDashboardsResult

type IdleDashboardsResult struct {
	IdleDashboards []IdleDashboard
	ParseErrs      []error
}

type IdleMetricsResult

type IdleMetricsResult struct {
	IdleMetrics []MetricName
	ParseErrs   []error
}

type IdlerConfig

type IdlerConfig struct {
	RulesFile, MetricsFile, DashboardsFile string
	Limit                                  uint64
}

type MetricName

type MetricName string

type MetricNames

type MetricNames []MetricName

type MetricUsageInBoard

type MetricUsageInBoard struct {
	Metric MetricName
	Used   uint32
}

type MetricsExporter

type MetricsExporter struct {
	// contains filtered or unexported fields
}

func NewMetricsExporter

func NewMetricsExporter(cfg *MetricsExporterConfig) (*MetricsExporter, error)

func (*MetricsExporter) Export

func (mex *MetricsExporter) Export(ctx context.Context) error

type MetricsExporterConfig

type MetricsExporterConfig struct {
	*ExportConfig
	Since string
}

type MetricsIdler

type MetricsIdler struct {
	// contains filtered or unexported fields
}

func NewMetricsIdler

func NewMetricsIdler(cfg *IdlerConfig) *MetricsIdler

func (*MetricsIdler) List

type Panel

type Panel struct {
	ID      uint      `mapstructure:"id"`
	OfType  panelType `mapstructure:"-"`     // it required for defining type of the panel
	Title   string    `mapstructure:"title"` // general
	Type    string    `mapstructure:"type"`
	Targets []Target  `mapstructure:"targets,omitempty"`
}

type PromRulesIdler

type PromRulesIdler struct {
	// contains filtered or unexported fields
}

func NewPromRulesIdler

func NewPromRulesIdler(cfg *IdlerConfig) *PromRulesIdler

func (*PromRulesIdler) List

type PromRulesSlowest

type PromRulesSlowest struct {
	// contains filtered or unexported fields
}

func NewPromRulesSlowest

func NewPromRulesSlowest(cfg *SlowestConfig) *PromRulesSlowest

func (*PromRulesSlowest) Get

type Rule

type Rule struct {
	Group, Type, Name, Query, Labels string
	EvalDuration                     float64
}

type RuleMissingMetrics

type RuleMissingMetrics struct {
	Rule    Rule
	Metrics MetricNames
}

type RuleName

type RuleName string

type RulesExporter

type RulesExporter struct {
	// contains filtered or unexported fields
}

func NewRulesExporter

func NewRulesExporter(cfg *ExportConfig) (*RulesExporter, error)

func (*RulesExporter) Export

func (re *RulesExporter) Export(ctx context.Context) error

type SlowRule

type SlowRule struct {
	Rule     Rule
	EvalTime time.Duration
}

type SlowestConfig

type SlowestConfig struct {
	RulesFile string
	Limit     uint64
}

type SlowestRulesResult

type SlowestRulesResult struct {
	Rules     []SlowRule
	ParseErrs []error
}

type Target

type Target struct {
	Expr string `mapstructure:"expr,omitempty"`
}

type TopListerConfig

type TopListerConfig struct {
	DashboardsFile string
	Limit          uint64
}

type TopUsedListerInGrafana

type TopUsedListerInGrafana struct {
	// contains filtered or unexported fields
}

func NewTopUsedListerInGrafana

func NewTopUsedListerInGrafana(cfg *TopListerConfig) *TopUsedListerInGrafana

func (*TopUsedListerInGrafana) List

type TopUsedResult

type TopUsedResult struct {
	Usages    []MetricUsageInBoard
	ParseErrs []error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL