report

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Description: This file contains the implementation of the SLO interface, translated to "checks" in the OPCT report package. The SLO interface is defined in the report package, and the package implements SLIs to ensure acceptance criteria is met in the data collected from artifacts. Reference: https://github.com/kubernetes/community/blob/master/sig-scalability/slos/slos.md

Index

Constants

View Source
const (
	ReportFileNameIndexJSON = "/opct-report.json"
	// ReportFileNameSummaryJSON is used to API to apply diffs and filters, consumed by API.
	ReportFileNameSummaryJSON = "/opct-report-summary.json"
	ReportTemplateBasePath    = "data/templates/report"
)
View Source
const (
	CheckResultNamePass CheckResultName = "pass"
	CheckResultNameFail CheckResultName = "fail"
	CheckResultNameWarn CheckResultName = "warn"
	CheckResultNameSkip CheckResultName = "skip"

	CheckIdEmptyValue string = "--"

	// SLOs
	CheckID001  string = "OPCT-001"
	CheckID004  string = "OPCT-004"
	CheckID005  string = "OPCT-005"
	CheckID022  string = "OPCT-022"
	CheckID023A string = "OPCT-023A"
	CheckID023B string = "OPCT-023B"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// ID is the unique identifier for the check. It is used
	// to mount the documentation for each check.
	ID string `json:"id"`

	// Name is the unique name for the check to be reported.
	// It must have short and descriptive name identifying the
	// failure item.
	Name string `json:"name"`

	// Description describes shortly the check.
	Description string `json:"description"`

	// Documentation must point to documentation URL to review the
	// item.
	Documentation string `json:"documentation"`

	// DocumentationSpec is the detailed documentation for the check.
	DocumentationSpec CheckDocumentationSpec `json:"documentationSpec"`

	// Accepted must report acceptance criteria, when true
	// the Check is accepted by the tool, otherwise it is
	// failed and must be reviewede.
	Result CheckResult `json:"result"`

	Test func() CheckResult `json:"-"`

	// Priority is the priority to execute the check.
	// 0 is higher.
	Priority uint64
}

type CheckDocumentationSpec

type CheckDocumentationSpec struct {
	Description  string   `json:"description"`
	Expected     string   `json:"expected"`
	Troubleshoot string   `json:"troubleshoot"`
	Action       string   `json:"action"`
	Dependencies []string `json:"dependencies"`
}

CheckDocumentationSpec is the detailed documentation for the check.

type CheckResult

type CheckResult struct {
	Name    CheckResultName `json:"result"`
	Message string          `json:"message"`
	Target  string          `json:"want"`
	Actual  string          `json:"got"`
}

func (*CheckResult) String

func (cr *CheckResult) String() string

type CheckResultName

type CheckResultName string

func AcceptanceCheckFail

func AcceptanceCheckFail() CheckResultName

func ExampleAcceptanceCheckPass

func ExampleAcceptanceCheckPass() CheckResultName

type CheckSummary

type CheckSummary struct {
	Checks []*Check `json:"checks"`
	// contains filtered or unexported fields
}

CheckSummary aggregates the checks.

func NewCheckSummary

func NewCheckSummary(re *ReportData) *CheckSummary

func (*CheckSummary) GetBaseURL

func (csum *CheckSummary) GetBaseURL() string

func (*CheckSummary) GetCheckResults

func (csum *CheckSummary) GetCheckResults() ([]*SLOOutput, []*SLOOutput, []*SLOOutput, []*SLOOutput)

func (*CheckSummary) Run

func (csum *CheckSummary) Run() error

func (*CheckSummary) WriteDocumentation

func (csum *CheckSummary) WriteDocumentation(docPath string) error

WriteDocumentation writes the documentation to the provided path.

type ReportChecks

type ReportChecks struct {
	BaseURL    string       `json:"baseURL"`
	EmptyValue string       `json:"emptyValue"`
	Fail       []*SLOOutput `json:"failures"`
	Pass       []*SLOOutput `json:"successes"`
	Warn       []*SLOOutput `json:"warnings"`
	Skip       []*SLOOutput `json:"skips"`
}

type ReportClusterHealth

type ReportClusterHealth struct {
	NodeHealthTotal  int                           `json:"nodeHealthTotal,omitempty"`
	NodeHealthy      int                           `json:"nodeHealthy,omitempty"`
	NodeHealthPerc   float64                       `json:"nodeHealthPerc,omitempty"`
	PodHealthTotal   int                           `json:"podHealthTotal,omitempty"`
	PodHealthy       int                           `json:"podHealthy,omitempty"`
	PodHealthPerc    float64                       `json:"podHealthPerc,omitempty"`
	PodHealthDetails []discovery.HealthInfoDetails `json:"podHealthDetails,omitempty"`
}

type ReportClusterOperators

type ReportClusterOperators struct {
	CountAvailable   uint64 `json:"countAvailable,omitempty"`
	CountProgressing uint64 `json:"countProgressing,omitempty"`
	CountDegraded    uint64 `json:"countDegraded,omitempty"`
}

type ReportData

type ReportData struct {
	Summary  *ReportSummary `json:"summary"`
	Raw      string         `json:"-"`
	Provider *ReportResult  `json:"provider"`
	Baseline *ReportResult  `json:"baseline,omitempty"`
	Checks   *ReportChecks  `json:"checks,omitempty"`
	Setup    *ReportSetup   `json:"setup,omitempty"`
}

func NewReportData

func NewReportData(embedFrontend bool) *ReportData

func (*ReportData) DeepCopyInto

func (re *ReportData) DeepCopyInto(newRe *ReportData) error

DeepCopy creates a deep copy of the report data. The function uses the json.Marshal and json.Unmarshal to create a new copy of the data without any reference to the original data.

func (*ReportData) Populate

func (re *ReportData) Populate(cs *summary.ConsolidatedSummary) error

Populate is a entrypoint to initialize, trigger the data source processors, and finalize the report data structure used by frontend (HTML or CLI).

func (*ReportData) SaveResults

func (re *ReportData) SaveResults(path string) error

SaveResults persist the processed data to the result directory.

func (*ReportData) ShowJSON

func (re *ReportData) ShowJSON() (string, error)

ShowJSON print the raw json in stdout.

func (*ReportData) SummaryBuilder

func (re *ReportData) SummaryBuilder() error

type ReportInfra

type ReportInfra struct {
	Name                 string `json:"name"`
	PlatformType         string `json:"platformType"`
	PlatformName         string `json:"platformName"`
	Topology             string `json:"topology,omitempty"`
	ControlPlaneTopology string `json:"controlPlaneTopology,omitempty"`
	APIServerURL         string `json:"apiServerURL,omitempty"`
	APIServerInternalURL string `json:"apiServerInternalURL,omitempty"`
	NetworkType          string `json:"networkType,omitempty"`
}

type ReportPlugin

type ReportPlugin struct {
	ID            string                       `json:"id"`
	Title         string                       `json:"title"`
	Name          string                       `json:"name"`
	Definition    *plugin.PluginDefinition     `json:"definition,omitempty"`
	Stat          *ReportPluginStat            `json:"stat"`
	ErrorCounters *archive.ErrorCounter        `json:"errorCounters,omitempty"`
	Suite         *summary.OpenshiftTestsSuite `json:"suite"`

	Tests map[string]*plugin.TestItem `json:"tests,omitempty"`

	// Filters
	// SuiteOnly
	FailedFilter1 []*ReportTestFailure `json:"failedTestsFilter1"`
	TagsFilter1   string               `json:"tagsFailuresFilter1"`

	// Filter: BaselineArchive
	FailedFilter2 []*ReportTestFailure `json:"failedTestsFilter2"`
	TagsFilter2   string               `json:"tagsFailuresFilter2"`

	// Filter: FlakeAPI
	FailedFilter3 []*ReportTestFailure `json:"failedTestsFilter3"`
	TagsFilter3   string               `json:"tagsFailuresFilter3"`

	// Filter: BaselineAPI
	FailedFilter4 []*ReportTestFailure `json:"failedTestsFilter4"`
	TagsFilter4   string               `json:"tagsFailuresFilter4"`

	// Filter: KnownFailures
	FailedFilter5 []*ReportTestFailure `json:"failedTestsFilter5"`
	TagsFilter5   string               `json:"tagsFailuresFilter5"`

	// Filter: Replay
	FailedFilter6 []*ReportTestFailure `json:"failedTestsFilter6"`
	TagsFilter6   string               `json:"tagsFailuresFilter6"`

	// Final results after filters
	FailedFiltered []*ReportTestFailure `json:"failedFiltered"`
	TagsFiltered   string               `json:"tagsFailuresFiltered"`
}

func (*ReportPlugin) BuildFailedData

func (rp *ReportPlugin) BuildFailedData(filterID string, dataFailures []string)

type ReportPluginStat

type ReportPluginStat struct {
	Completed string `json:"execution"`
	Result    string `json:"result"`
	Status    string `json:"status"`
	Total     int64  `json:"total"`
	Passed    int64  `json:"passed"`
	Failed    int64  `json:"failed"`
	Timeout   int64  `json:"timeout"`
	Skipped   int64  `json:"skipped"`

	// Filters
	// Filter: SuiteOnly
	FilterSuite     int64 `json:"filter1Suite"`
	Filter1Excluded int64 `json:"filter1Excluded"`

	// Filter: BaselineArchive (deprecated soon)
	FilterBaseline  int64 `json:"filter2Baseline"`
	Filter2Excluded int64 `json:"filter2Excluded"`

	// Filter: FlakeCI
	FilterFailedPrio int64 `json:"filter3FailedPriority"`
	Filter3Excluded  int64 `json:"filter3Excluded"`

	// Filter: BaselineAPI
	FilterFailedAPI int64 `json:"filter4FailedAPI"`
	Filter4Excluded int64 `json:"filter4Excluded"`

	// Filter: KnownFailures
	Filter5Failures int64 `json:"filter5Failures"`
	Filter5Excluded int64 `json:"filter5Excluded"`

	// Filter: Replay
	Filter6Failures int64 `json:"filter6Failures"`
	Filter6Excluded int64 `json:"filter6Excluded"`

	FilterFailures int64 `json:"filterFailures"`
}

type ReportResult

type ReportResult struct {
	Version          *ReportVersion           `json:"version"`
	Infra            *ReportInfra             `json:"infra"`
	ClusterOperators *ReportClusterOperators  `json:"clusterOperators"`
	ClusterHealth    *ReportClusterHealth     `json:"clusterHealth"`
	Plugins          map[string]*ReportPlugin `json:"plugins"`
	HasValidBaseline bool                     `json:"hasValidBaseline"`
	MustGatherInfo   *mustgather.MustGather   `json:"mustGatherInfo,omitempty"`
	ErrorCounters    *archive.ErrorCounter    `json:"errorCounters,omitempty"`
	Runtime          *ReportRuntime           `json:"runtime,omitempty"`
	Nodes            []*summary.Node          `json:"nodes,omitempty"`
	InstallInvoker   *string                  `json:"installInvoker,omitempty"`
}

func (*ReportResult) GetPlugins

func (rt *ReportResult) GetPlugins() []string

type ReportRuntime

type ReportRuntime struct {
	ServerLogs   []*archive.RuntimeInfoItem `json:"serverLogs,omitempty"`
	ServerConfig []*archive.RuntimeInfoItem `json:"serverConfig,omitempty"`
	OpctConfig   []*archive.RuntimeInfoItem `json:"opctConfig,omitempty"`
}

type ReportSetup

type ReportSetup struct {
	Frontend *ReportSetupFrontend `json:"frontend,omitempty"`
	API      *ReportSetupAPI      `json:"api,omitempty"`
}

type ReportSetupAPI

type ReportSetupAPI struct {
	SummaryName      string `json:"dataPath,omitempty"`
	SummaryArchive   string `json:"summaryArchive,omitempty"`
	UUID             string `json:"uuid,omitempty"`
	ExecutionDate    string `json:"executionDate,omitempty"`
	OpenShiftVersion string `json:"openshiftVersion,omitempty"`
	OpenShiftRelease string `json:"openshiftRelease,omitempty"`
	PlatformType     string `json:"platformType,omitempty"`
	ProviderName     string `json:"providerName,omitempty"`
	InfraTopology    string `json:"infraTopology,omitempty"`
	Workflow         string `json:"workflow,omitempty"`
}

type ReportSetupFrontend

type ReportSetupFrontend struct {
	EmbedData bool
}

type ReportSummary

type ReportSummary struct {
	Tests    *ReportSummaryTests   `json:"tests"`
	Alerts   *ReportSummaryAlerts  `json:"alerts"`
	Runtime  *ReportSummaryRuntime `json:"runtime,omitempty"`
	Headline string                `json:"headline"`
	Features ReportSummaryFeatures `json:"features,omitempty"`
}

type ReportSummaryAlerts

type ReportSummaryAlerts struct {
	PluginK8S             string `json:"pluginK8S,omitempty"`
	PluginK8SMessage      string `json:"pluginK8SMessage,omitempty"`
	PluginOCP             string `json:"pluginOCP,omitempty"`
	PluginOCPMessage      string `json:"pluginOCPMessage,omitempty"`
	SuiteErrors           string `json:"suiteErrors,omitempty"`
	SuiteErrorsMessage    string `json:"suiteErrorsMessage,omitempty"`
	WorkloadErrors        string `json:"workloadErrors,omitempty"`
	WorkloadErrorsMessage string `json:"workloadErrorsMessage,omitempty"`
	Checks                string `json:"checks,omitempty"`
	ChecksMessage         string `json:"checksMessage,omitempty"`
}

type ReportSummaryFeatures

type ReportSummaryFeatures struct {
	HasCAMGI         bool `json:"hasCAMGI,omitempty"`
	HasMetricsData   bool `json:"hasMetricsData,omitempty"`
	HasInstallConfig bool `json:"hasInstallConfig,omitempty"`
}

type ReportSummaryRuntime

type ReportSummaryRuntime struct {
	Timers        *metrics.Timers   `json:"timers,omitempty"`
	Plugins       map[string]string `json:"plugins,omitempty"`
	ExecutionTime string            `json:"executionTime,omitempty"`
}

type ReportSummaryTests

type ReportSummaryTests struct {
	Archive     string `json:"archive"`
	ArchiveDiff string `json:"archiveDiff,omitempty"`
}

type ReportTestFailure

type ReportTestFailure struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	Documentation string  `json:"documentation"`
	FlakePerc     float64 `json:"flakePerc"`
	FlakeCount    int64   `json:"flakeCount"`
	ErrorsCount   int64   `json:"errorsTotal"`
}

type ReportVersion

type ReportVersion struct {
	// OpenShift versions
	OpenShift *summary.SummaryClusterVersionOutput `json:"openshift"`

	// Kubernetes Version
	Kubernetes string `json:"kubernetes"`

	// OPCT Version
	OPCTServer string `json:"opctServer,omitempty"`
	OPCTClient string `json:"opctClient,omitempty"`
}

type SLOOutput

type SLOOutput struct {
	ID  string `json:"id"`
	SLO string `json:"slo"`

	// SLOResult is the target value
	SLOResult string `json:"sloResult"`

	// SLITarget is the target value
	SLITarget string `json:"sliTarget"`

	// SLICurrent is the indicator result. Allowed values: pass|fail|skip
	SLIActual string `json:"sliCurrent"`

	Message string `json:"message"`

	Documentation string `json:"documentation"`
}

type SortedListTestFailure

type SortedListTestFailure []SortedTestFailure

SortedList stores the list of key/value map, implementing interfaces to sort/rank a map strings with integers as values.

func (SortedListTestFailure) Len

func (p SortedListTestFailure) Len() int

func (SortedListTestFailure) Less

func (p SortedListTestFailure) Less(i, j int) bool

func (SortedListTestFailure) Swap

func (p SortedListTestFailure) Swap(i, j int)

type SortedTestFailure

type SortedTestFailure struct {
	Key   *ReportTestFailure
	Value int
}

SortedTestFailure stores the key/value to rank by Key.

Directories

Path Synopsis
Package baseline holds the baseline report summary data and the functions to interact with the results service, backed by CloudFront and S3 storage bucket, serving summarized results from CI.
Package baseline holds the baseline report summary data and the functions to interact with the results service, backed by CloudFront and S3 storage bucket, serving summarized results from CI.

Jump to

Keyboard shortcuts

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