service

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateStatDashboardConfig

func CreateStatDashboardConfig(args *StatDashboardConfig, logger *zap.SugaredLogger) error

func DeleteStatDashboardConfig

func DeleteStatDashboardConfig(id string, logger *zap.SugaredLogger) error

func GetAllPipelineTask

func GetAllPipelineTask(log *zap.SugaredLogger) error

func GetBuildDailyAverageMeasure

func GetBuildDailyAverageMeasure(startDate int64, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*dailyBuildStat, error)

func GetBuildDailyMeasure

func GetBuildDailyMeasure(startDate int64, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*buildStatDaily, error)

func GetBuildHealthMeasure

func GetBuildHealthMeasure(startDate int64, endDate int64, productNames []string, log *zap.SugaredLogger) (*buildStatTotal, error)

func GetBuildStatByProdutName

func GetBuildStatByProdutName(productName string, startTimestamp int64, log *zap.SugaredLogger) ([]*models.BuildStat, error)

func GetBuildStats

func GetBuildStats(args *models.BuildStatOption, log *zap.SugaredLogger) (*dashboardBuild, error)

func GetBuildTotalAndSuccess

func GetBuildTotalAndSuccess(args *models.BuildStatOption, log *zap.SugaredLogger) (*dashboardBuild, error)

func GetBuildTrendMeasure

func GetBuildTrendMeasure(startDate int64, endDate int64, productNames []string, log *zap.SugaredLogger) (*buildTrend, error)

func GetDeployDailyTotalAndSuccess

func GetDeployDailyTotalAndSuccess(args *models.DeployStatOption, log *zap.SugaredLogger) (*dashboardDeploy, error)

func GetDeployHealthMeasure

func GetDeployHealthMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) (*deployStatTotal, error)

func GetDeployStatByProdutName

func GetDeployStatByProdutName(productName string, startTimestamp int64, log *zap.SugaredLogger) ([]*models.DeployStat, error)

func GetDeployStats

func GetDeployStats(args *models.DeployStatOption, log *zap.SugaredLogger) (*dashboardDeploy, error)

func GetDeployTopFiveFailureMeasure

func GetDeployTopFiveFailureMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*deployFailureHigherStat, error)

func GetDeployTopFiveHigherMeasure

func GetDeployTopFiveHigherMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*deployHigherStat, error)

func GetDeployWeeklyMeasure

func GetDeployWeeklyMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*deployStatWeekly, error)

func GetLatestTenBuildMeasure

func GetLatestTenBuildMeasure(productNames []string, log *zap.SugaredLogger) ([]*buildStatLatestTen, error)

func GetPipelineHealthMeasure

func GetPipelineHealthMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) (*deployStatTotal, error)

func GetRequirementDeliveryLeadTime

func GetRequirementDeliveryLeadTime(startTime, endTime int64, project string) (float64, error)

GetRequirementDeliveryLeadTime get requirement development lead time

func GetRequirementDevelopmentLeadTime

func GetRequirementDevelopmentLeadTime(startTime, endTime int64, project string) (float64, error)

GetRequirementDevelopmentLeadTime get requirement development lead time

func GetTenDurationMeasure

func GetTenDurationMeasure(startDate int64, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*buildStatLatestTen, error)

func GetTestAverageMeasure

func GetTestAverageMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*testStatDailyArg, error)

func GetTestCaseMeasure

func GetTestCaseMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*testCaseStat, error)

func GetTestDashboard

func GetTestDashboard(startTime, endTime int64, productName string, log *zap.SugaredLogger) (*testDashboard, error)

func GetTestDeliveryDeployMeasure

func GetTestDeliveryDeployMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) ([]*testDeployStat, error)

func GetTestHealthMeasure

func GetTestHealthMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) (*testStatTotal, error)

func GetTestStatByProdutName

func GetTestStatByProdutName(productName string, startTimestamp int64, log *zap.SugaredLogger) ([]*models.TestStat, error)

func GetTestTrendMeasure

func GetTestTrendMeasure(startDate, endDate int64, productNames []string, log *zap.SugaredLogger) (*testTrend, error)

func InitDeployStat

func InitDeployStat(log *zap.SugaredLogger) error

func InitTestStat

func InitTestStat(log *zap.SugaredLogger) error

func UpdateStatDashboardConfig

func UpdateStatDashboardConfig(id string, args *StatDashboardConfig, logger *zap.SugaredLogger) error

Types

type APIConfig

type APIConfig struct {
	ExternalSystemId string           `json:"external_system_id"`
	ApiPath          string           `json:"api_path"`
	Queries          []*util.KeyValue `json:"queries"`
}

type BuildAverageDurationCalculator

type BuildAverageDurationCalculator struct {
	Weight   int64
	Function string
}

func (*BuildAverageDurationCalculator) GetFact

func (c *BuildAverageDurationCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*BuildAverageDurationCalculator) GetWeightedScore

func (c *BuildAverageDurationCalculator) GetWeightedScore(fact float64) (float64, error)

type BuildFrequencyCalculator

type BuildFrequencyCalculator struct {
	Weight   int64
	Function string
}

func (*BuildFrequencyCalculator) GetFact

func (c *BuildFrequencyCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*BuildFrequencyCalculator) GetWeightedScore

func (c *BuildFrequencyCalculator) GetWeightedScore(fact float64) (float64, error)

type BuildStat

type BuildStat struct {
	ProjectName string `json:"project_name"`
	Success     int    `json:"success"`
	Failure     int    `json:"failure"`
	Timeout     int    `json:"timeout"`
	Total       int    `json:"total"`
	Duration    int    `json:"duration"`
}

func GetProjectBuildStat

func GetProjectBuildStat(start, end int64, project string) (BuildStat, error)

type BuildStatTotal

type BuildStatTotal struct {
	TotalSuccess int `json:"total_success"`
	TotalFailure int `json:"total_failure"`
}

type BuildSuccessRateCalculator

type BuildSuccessRateCalculator struct {
	Weight   int64
	Function string
}

func (*BuildSuccessRateCalculator) GetFact

func (c *BuildSuccessRateCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*BuildSuccessRateCalculator) GetWeightedScore

func (c *BuildSuccessRateCalculator) GetWeightedScore(fact float64) (float64, error)

type CurrentDay

type CurrentDay struct {
	Success int `json:"success"`
	Failure int `json:"failure"`
	Timeout int `json:"timeout"`
}

type Currently30DayBuildTrend

type Currently30DayBuildTrend struct {
	Name string `json:"name"`
	Data []int  `json:"data"`
}

func GetCurrently30DayBuildTrend

func GetCurrently30DayBuildTrend(startTime, endTime int64, projects []string, logger *zap.SugaredLogger) ([]*Currently30DayBuildTrend, error)

func RebuildCurrently30DayBuildData

func RebuildCurrently30DayBuildData(start, end int64, data []*project30DayBuildData) []*Currently30DayBuildTrend

type DailyBuildStat

type DailyBuildStat struct {
	Date             string `json:"date"`
	Success          int    `json:"success_total"`
	Failure          int    `json:"failure_total"`
	Timeout          int    `json:"timeout_total"`
	AverageBuildTime int    `json:"average_build_time"`
}

type DailyJobInfo

type DailyJobInfo struct {
	Name string `json:"name"`
	Data []int  `json:"data"`
}

func GetProjectsOverview

func GetProjectsOverview(start, end int64, logger *zap.SugaredLogger) ([]*DailyJobInfo, error)

type DailyStat

type DailyStat struct {
	Date         string `json:"date"`
	Total        int64  `json:"total"`
	SuccessCount int64  `json:"success_count"`
	FailCount    int64  `json:"fail_count"`
}

type DailyTestStat

type DailyTestStat struct {
	DayStartTime    string `json:"day_start_time"`
	Success         int    `json:"test_success_total"`
	Failure         int    `json:"test_failure_total"`
	Timeout         int    `json:"test_timeout_total"`
	AverageTestTime int    `json:"average_test_time"`
}

type DeployAverageDurationCalculator

type DeployAverageDurationCalculator struct {
	Weight   int64
	Function string
}

func (*DeployAverageDurationCalculator) GetFact

func (c *DeployAverageDurationCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*DeployAverageDurationCalculator) GetWeightedScore

func (c *DeployAverageDurationCalculator) GetWeightedScore(fact float64) (float64, error)

type DeployFrequencyCalculator

type DeployFrequencyCalculator struct {
	Weight   int64
	Function string
}

func (*DeployFrequencyCalculator) GetFact

func (c *DeployFrequencyCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*DeployFrequencyCalculator) GetWeightedScore

func (c *DeployFrequencyCalculator) GetWeightedScore(fact float64) (float64, error)

type DeployStat

type DeployStat struct {
	ProjectName string `json:"project_name"`
	Success     int    `json:"success"`
	Failure     int    `json:"failure"`
	Timeout     int    `json:"timeout"`
	Total       int    `json:"total"`
	Duration    int    `json:"duration"`
}

func GetProjectDeployStat

func GetProjectDeployStat(start, end int64, project string) (DeployStat, error)

type DeployStatTotal

type DeployStatTotal struct {
	TotalSuccess int `json:"total_success"`
	TotalFailure int `json:"total_failure"`
	TotalTimeout int `json:"total_timeout"`
}

type DeploySuccessRateCalculator

type DeploySuccessRateCalculator struct {
	Weight   int64
	Function string
}

func (*DeploySuccessRateCalculator) GetFact

func (c *DeploySuccessRateCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*DeploySuccessRateCalculator) GetWeightedScore

func (c *DeploySuccessRateCalculator) GetWeightedScore(fact float64) (float64, error)

type DevDelPeriod

type DevDelPeriod struct {
	RequirementDeliveryLeadTime    float64 `json:"requirement_delivery_lead_time"`
	RequirementDevelopmentLeadTime float64 `json:"requirement_development_lead_time"`
}

func GetRequirementDevDelPeriod

func GetRequirementDevDelPeriod(start, end int64, projects []string, logger *zap.SugaredLogger) (*DevDelPeriod, error)

type EfficiencyRadarData

type EfficiencyRadarData struct {
	Name                           string  `json:"name"`
	TestSuccessRate                float64 `json:"test_success_rate"`
	ReleaseFrequency               float64 `json:"release_frequency"`
	BuildFrequency                 float64 `json:"build_frequency"`
	ReleaseSuccessRate             float64 `json:"release_success_rate"`
	RequirementDevelopmentLeadTime float64 `json:"requirement_development_lead_time"`
}

func GetEfficiencyRadar

func GetEfficiencyRadar(startTime, endTime int64, projects []string, logger *zap.SugaredLogger) ([]*EfficiencyRadarData, error)

GetEfficiencyRadar Return test pass rate, release frequency, R&D lead time within the past 30 days (if configured)

type GeneralCalculator

type GeneralCalculator struct {
	Host     string
	Path     string
	Queries  []*util.KeyValue
	Headers  []*util.KeyValue
	Weight   int64
	Function string
}

GeneralCalculator gets the facts from the given API from the APIConfig and calculate the score based on Function and Weight

func (*GeneralCalculator) GetFact

func (c *GeneralCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*GeneralCalculator) GetWeightedScore

func (c *GeneralCalculator) GetWeightedScore(fact float64) (float64, error)

type MonthAttention

type MonthAttention struct {
	ProjectName string                `json:"project_name"`
	Facts       []*MonthAttentionData `json:"facts"`
}

func GetMonthAttention

func GetMonthAttention(startTime, endTime int64, projects []string, logger *zap.SugaredLogger) ([]*MonthAttention, error)

type MonthAttentionData

type MonthAttentionData struct {
	Name         string `json:"name"`
	CurrentMonth string `json:"current_month"`
	LastMonth    string `json:"last_month"`
}

type OpenAPIStatV2

type OpenAPIStatV2 struct {
	Total        int64        `json:"total"`
	SuccessCount int64        `json:"success_count"`
	DailyStat    []*DailyStat `json:"daily_stat"`
}

func CalculateReleaseStatsFromJobList

func CalculateReleaseStatsFromJobList(jobList []*commonmodels.JobInfo) *OpenAPIStatV2

func GetReleaseStatOpenAPI

func GetReleaseStatOpenAPI(startDate, endDate int64, productName string, log *zap.SugaredLogger) (*OpenAPIStatV2, error)

type Overview

type Overview struct {
	ProjectCount  int `json:"project_count"`
	ClusterCount  int `json:"cluster_count"`
	ServiceCount  int `json:"service_count"`
	WorkflowCount int `json:"workflow_count"`
	EnvCount      int `json:"env_count"`
	ArtifactCount int `json:"artifact_count"`
}

func GetOverviewStat

func GetOverviewStat(log *zap.SugaredLogger) (*Overview, error)

type ProjectDailyBuildStat

type ProjectDailyBuildStat struct {
	Project        string            `json:"project_name"`
	DailyBuildStat []*DailyBuildStat `json:"daily_build_stat"`
}

func GetDailyBuildMeasure

func GetDailyBuildMeasure(start, end int64, projects []string) ([]*ProjectDailyBuildStat, error)

type ProjectsBuildStatTotal

type ProjectsBuildStatTotal struct {
	ProjectName    string          `json:"project_name"`
	BuildStatTotal *BuildStatTotal `json:"build_stat_total"`
}

func GetBuildHealthMeasureV2

func GetBuildHealthMeasureV2(start, end int64, projects []string) ([]*ProjectsBuildStatTotal, error)

type ProjectsDailyTestStat

type ProjectsDailyTestStat struct {
	Project       string           `json:"project"`
	DailyTestStat []*DailyTestStat `json:"daily_test_stat"`
}

func GetDailyTestStatus

func GetDailyTestStatus(start, end int64, projects []string) ([]*ProjectsDailyTestStat, error)

type ProjectsDeployStatTotal

type ProjectsDeployStatTotal struct {
	ProjectName     string           `json:"project_name"`
	DeployStatTotal *DeployStatTotal `json:"deploy_stat_total"`
}

func GetDeployHealth

func GetDeployHealth(start, end int64, projects []string) ([]*ProjectsDeployStatTotal, error)

type ProjectsTestStatTotal

type ProjectsTestStatTotal struct {
	ProjectName   string         `json:"project_name"`
	TestStatTotal *TestStatTotal `json:"test_stat_total"`
}

func GetTestHealth

func GetTestHealth(start, end int64, projects []string) ([]*ProjectsTestStatTotal, error)

type ProjectsWeeklyDeployStat

type ProjectsWeeklyDeployStat struct {
	Project          string              `json:"project_name"`
	WeeklyDeployStat []*WeeklyDeployStat `json:"weekly_deploy_stat_data"`
}

func GetProjectsWeeklyDeployStat

func GetProjectsWeeklyDeployStat(start, end int64, projects []string) ([]*ProjectsWeeklyDeployStat, error)

type ProjectsWeeklyTestStat

type ProjectsWeeklyTestStat struct {
	Project        string            `json:"project"`
	WeeklyTestStat []*WeeklyTestStat `json:"weekly_test_stat"`
}

func GetWeeklyTestStatus

func GetWeeklyTestStatus(start, end int64, projects []string) ([]*ProjectsWeeklyTestStat, error)

type ReleaseAverageDurationCalculator

type ReleaseAverageDurationCalculator struct {
	Weight   int64
	Function string
}

func (*ReleaseAverageDurationCalculator) GetFact

func (c *ReleaseAverageDurationCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*ReleaseAverageDurationCalculator) GetWeightedScore

func (c *ReleaseAverageDurationCalculator) GetWeightedScore(fact float64) (float64, error)

type ReleaseFrequencyCalculator

type ReleaseFrequencyCalculator struct {
	Weight   int64
	Function string
}

func (*ReleaseFrequencyCalculator) GetFact

func (c *ReleaseFrequencyCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*ReleaseFrequencyCalculator) GetWeightedScore

func (c *ReleaseFrequencyCalculator) GetWeightedScore(fact float64) (float64, error)

type ReleaseStat

type ReleaseStat struct {
	ProjectName string `json:"project_name"`
	Success     int    `json:"success"`
	Failure     int    `json:"failure"`
	Timeout     int    `json:"timeout"`
	Total       int    `json:"total"`
	Duration    int    `json:"duration"`
}

func GetProjectReleaseStat

func GetProjectReleaseStat(start, end int64, project string) (ReleaseStat, error)

type ReleaseSuccessRateCalculator

type ReleaseSuccessRateCalculator struct {
	Weight   int64
	Function string
}

func (*ReleaseSuccessRateCalculator) GetFact

func (c *ReleaseSuccessRateCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*ReleaseSuccessRateCalculator) GetWeightedScore

func (c *ReleaseSuccessRateCalculator) GetWeightedScore(fact float64) (float64, error)

type StatCalculator

type StatCalculator interface {
	GetWeightedScore(score float64) (float64, error)
	// GetFact returns the fact value of the calculator, and a boolean value indicating whether the fact exists
	GetFact(startTime int64, endTime int64, projectKey string) (float64, bool, error)
}

func CreateCalculatorFromConfig

func CreateCalculatorFromConfig(cfg *StatDashboardConfig) (StatCalculator, error)

type StatDashboardBasicData

type StatDashboardBasicData struct {
	BuildTotal    int64 `json:"build_total"`
	BuildSuccess  int64 `json:"build_success"`
	TestTotal     int64 `json:"test_total"`
	TestSuccess   int64 `json:"test_success"`
	DeployTotal   int64 `json:"deploy_total"`
	DeploySuccess int64 `json:"deploy_success"`
}

func GetStatsDashboardGeneralData

func GetStatsDashboardGeneralData(startTime, endTime int64, logger *zap.SugaredLogger) (*StatDashboardBasicData, error)

type StatDashboardByProject

type StatDashboardByProject struct {
	ProjectKey  string               `json:"project_key"`
	ProjectName string               `json:"project_name"`
	Score       float64              `json:"score"`
	Facts       []*StatDashboardItem `json:"facts"`
}

func GetStatsDashboard

func GetStatsDashboard(startTime, endTime int64, projectList []string, logger *zap.SugaredLogger) ([]*StatDashboardByProject, error)

type StatDashboardConfig

type StatDashboardConfig struct {
	Type      string     `json:"type"`
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Source    string     `json:"source"`
	APIConfig *APIConfig `json:"api_config,omitempty"`
	Function  string     `json:"function"`
	Weight    int64      `json:"weight"`
}

func ListDashboardConfigs

func ListDashboardConfigs(logger *zap.SugaredLogger) ([]*StatDashboardConfig, error)

type StatDashboardItem

type StatDashboardItem struct {
	Type     string      `json:"type"`
	ID       string      `json:"id"`
	Data     interface{} `json:"data"`
	Score    float64     `json:"score"`
	Error    string      `json:"error,omitempty"`
	HasValue bool        `json:"has_value"`
}

type TaskPreview

type TaskPreview struct {
	Project     string
	Duration    int64
	Status      string
	TaskCreator string
	CreateTime  int64
}

type TestAverageDurationCalculator

type TestAverageDurationCalculator struct {
	Weight   int64
	Function string
}

func (*TestAverageDurationCalculator) GetFact

func (c *TestAverageDurationCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*TestAverageDurationCalculator) GetWeightedScore

func (c *TestAverageDurationCalculator) GetWeightedScore(fact float64) (float64, error)

type TestPassRateCalculator

type TestPassRateCalculator struct {
	Weight   int64
	Function string
}

TestPassRateCalculator is used when the data ID is "test_pass_rate" and the data source is "zadig"

func (*TestPassRateCalculator) GetFact

func (c *TestPassRateCalculator) GetFact(startTime, endTime int64, project string) (float64, bool, error)

func (*TestPassRateCalculator) GetWeightedScore

func (c *TestPassRateCalculator) GetWeightedScore(fact float64) (float64, error)

type TestStat

type TestStat struct {
	ProjectName string `json:"project_name"`
	Success     int    `json:"success"`
	Failure     int    `json:"failure"`
	Timeout     int    `json:"timeout"`
	Total       int    `json:"total"`
	Duration    int    `json:"duration"`
}

func GetProjectTestStat

func GetProjectTestStat(start, end int64, project string) (TestStat, error)

type TestStatTotal

type TestStatTotal struct {
	TotalSuccess int `json:"total_success"`
	TotalFailure int `json:"total_failure"`
	TotalTimeout int `json:"total_timeout"`
}

type WeeklyBuildStat

type WeeklyBuildStat struct {
	Project         string        `json:"project"`
	WeeklyBuildStat []*WeeklyStat `json:"weekly_build_stat"`
}

func GetWeeklyBuildStat

func GetWeeklyBuildStat(start, end int64, projects []string) ([]*WeeklyBuildStat, error)

type WeeklyDeployStat

type WeeklyDeployStat struct {
	WeekStartDate     string `json:"week_start_date"`
	Success           int    `json:"success_total"`
	Failure           int    `json:"failure_total"`
	Timeout           int    `json:"timeout_total"`
	AverageDeployTime int    `json:"average_deploy_time"`
}

type WeeklyStat

type WeeklyStat struct {
	WeekStartDate    string `json:"week_start_date"`
	Success          int    `json:"build_success_total"`
	Failure          int    `json:"build_failure_total"`
	Timeout          int    `json:"build_timeout_total"`
	AverageBuildTime int    `json:"build_average_time"`
}

type WeeklyTestStat

type WeeklyTestStat struct {
	WeekStartDay    string `json:"week_start_day"`
	Success         int    `json:"success_total"`
	Failure         int    `json:"failure_total"`
	Timeout         int    `json:"timeout_total"`
	AverageTestTime int    `json:"average_test_time"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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