cireport

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageReportCLI

func ImageReportCLI(cfg config.ImageReport) (string, error)

func TableReportCli

func TableReportCli(q Querier, queriesFile string) (string, error)

Types

type DashboardScreenshotter

type DashboardScreenshotter interface {
	AllPanels(ctx context.Context, dashboardUID string, from int64, to int64) ([]Panel, error)
}

type FsWriter added in v0.2.0

type FsWriter struct{}

func (*FsWriter) WriteFile added in v0.2.0

func (*FsWriter) WriteFile(dest string, data []byte) (string, error)

type GrafanaScreenshotter

type GrafanaScreenshotter struct {
	GrafanaURL     string
	TimeoutSeconds int
}

func (*GrafanaScreenshotter) AllPanels

func (gs *GrafanaScreenshotter) AllPanels(ctx context.Context, dashboardUID string, from int64, to int64) ([]Panel, error)

AllPanes take a screenshot of all panes in a dashboard

func (*GrafanaScreenshotter) ScreenshotPanel

func (gs *GrafanaScreenshotter) ScreenshotPanel(ctx context.Context, cfg ScreenshotPanelConfig) ([]byte, error)

ScreenshotPanel takes screenshot of a grafana panel

type ImageReporter added in v0.2.0

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

func NewImageReporter

func NewImageReporter(screenshotter GrafanaScreenshotter, uploader Uploader) *ImageReporter

func (*ImageReporter) Report added in v0.2.0

func (r *ImageReporter) Report(ctx context.Context, dashboardUID string, dir string, from int64, to int64) (string, error)

type MetaReport added in v0.2.0

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

func NewMetaReport

func NewMetaReport(allowlist []string) (*MetaReport, error)

NewMetaReport creates a meta report the allowlist parameter refers to which keys are valid

func (*MetaReport) Report added in v0.2.0

func (mr *MetaReport) Report(title string, vars []string) (string, error)

Report generates a markdown report

type Panel

type Panel struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
	Data  []byte
}

type Querier

type Querier interface {
	Instant(query string, t time.Time) (float64, error)
}

type QueriesConfig

type QueriesConfig struct {
	BaseName   string `yaml:"baseName"`
	TargetName string `yaml:"targetName"`

	Queries []Query `yaml:"queries"`
}

type Query

type Query struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description" default:""`

	Base         string `yaml:"base"`
	BaseResult   float64
	Target       string `yaml:"target"`
	TargetResult float64
	// TODO(eh-am): implement a default value
	DiffThreshold float64 `yaml:"diffThresholdPercent"`
	DiffPercent   float64

	BiggerIsBetter bool `yaml:"biggerIsBetter"`
	// contains filtered or unexported fields
}

type Row

type Row struct {
	Panels []Panel `json:"panels"`
}

type S3Writer added in v0.2.0

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

func NewS3Writer

func NewS3Writer(bucketName string) (*S3Writer, error)

NewS3Writer creates a s3 writer it assumes AWS environment variables are setup correctly

func (*S3Writer) WriteFile added in v0.2.0

func (s3Writer *S3Writer) WriteFile(dest string, data []byte) (string, error)

type ScreenshotPanelConfig

type ScreenshotPanelConfig struct {
	DashboardUID string
	PanelID      int
	From         int64
	To           int64
	Width        int
	Height       int
}

type TableReport added in v0.2.0

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

func NewTableReport

func NewTableReport(q Querier) *TableReport

func (*TableReport) Report added in v0.2.0

func (r *TableReport) Report(ctx context.Context, qCfg *QueriesConfig) (string, error)

TableReport reports query results from prometheus in markdown format

type Uploader

type Uploader interface {
	WriteFile(dest string, data []byte) (string, error)
}

Jump to

Keyboard shortcuts

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