insight

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineFilePaths

func DetermineFilePaths(projectID string, appID string, kind model.InsightMetricsKind, step model.InsightStep, from time.Time, count int) []string

func MakeChunkFilePath

func MakeChunkFilePath(projectID string, metricsKind model.InsightMetricsKind, appID string, month string) string

func MakeYearsFilePath

func MakeYearsFilePath(projectID string, metricsKind model.InsightMetricsKind, appID string) string

insight file paths according to the following format.

insights

├─ project-id
  ├─ deployment-frequency
      ├─ project  # aggregated from all applications
          ├─ years.json
          ├─ 2020-01.json
          ├─ 2020-02.json
          ...
      ├─ app-id
          ├─ years.json
          ├─ 2020-01.json
          ├─ 2020-02.json
          ...

func NormalizeTime

func NormalizeTime(from time.Time, step model.InsightStep) time.Time

Types

type ApplicationCounts

type ApplicationCounts struct {
	Counts    []model.InsightApplicationCount `json:"counts"`
	UpdatedAt int64                           `json:"updated_at"`
}

func MakeApplicationCounts

func MakeApplicationCounts(apps []*model.Application, now time.Time) ApplicationCounts

type ChangeFailureRate

type ChangeFailureRate struct {
	Timestamp    int64   `json:"timestamp"`
	Rate         float32 `json:"rate"`
	SuccessCount int64   `json:"success_count"`
	FailureCount int64   `json:"failure_count"`
}

ChangeFailureRate represents a data point that shows the change failure rate metrics.

func (*ChangeFailureRate) GetTimestamp

func (c *ChangeFailureRate) GetTimestamp() int64

func (*ChangeFailureRate) Merge

func (c *ChangeFailureRate) Merge(point DataPoint) error

func (*ChangeFailureRate) Value

func (c *ChangeFailureRate) Value() float32

type ChangeFailureRateChunk

type ChangeFailureRateChunk struct {
	AccumulatedTo int64                      `json:"accumulated_to"`
	DataPoints    ChangeFailureRateDataPoint `json:"data_points"`
	FilePath      string
}

ChangeFailureRateChunk represents a chunk of ChangeFailureRate data points.

func (*ChangeFailureRateChunk) GetAccumulatedTo

func (c *ChangeFailureRateChunk) GetAccumulatedTo() int64

func (*ChangeFailureRateChunk) GetDataPoints

func (c *ChangeFailureRateChunk) GetDataPoints(step model.InsightStep) ([]DataPoint, error)

func (*ChangeFailureRateChunk) GetFilePath

func (c *ChangeFailureRateChunk) GetFilePath() string

func (*ChangeFailureRateChunk) SetAccumulatedTo

func (c *ChangeFailureRateChunk) SetAccumulatedTo(a int64)

func (*ChangeFailureRateChunk) SetDataPoints

func (c *ChangeFailureRateChunk) SetDataPoints(step model.InsightStep, points []DataPoint) error

func (*ChangeFailureRateChunk) SetFilePath

func (c *ChangeFailureRateChunk) SetFilePath(path string)

type ChangeFailureRateDataPoint

type ChangeFailureRateDataPoint struct {
	Daily   []*ChangeFailureRate `json:"daily"`
	Weekly  []*ChangeFailureRate `json:"weekly"`
	Monthly []*ChangeFailureRate `json:"monthly"`
	Yearly  []*ChangeFailureRate `json:"yearly"`
}

type Chunk

type Chunk interface {
	// GetFilePath gets filepath
	GetFilePath() string
	// SetFilePath sets filepath
	SetFilePath(path string)
	// GetAccumulatedTo gets AccumulatedTo
	GetAccumulatedTo() int64
	// SetAccumulatedTo sets AccumulatedTo
	SetAccumulatedTo(a int64)
	// GetDataPoints gets list of data points of specify step
	GetDataPoints(step model.InsightStep) ([]DataPoint, error)
	// SetDataPoints sets list of data points of specify step
	SetDataPoints(step model.InsightStep, points []DataPoint) error
}

func NewChunk

func NewChunk(projectID string, metricsKind model.InsightMetricsKind, step model.InsightStep, appID string, timestamp time.Time) Chunk

func ToChunk

func ToChunk(i interface{}) (Chunk, error)

convert types to Chunk.

type Chunks

type Chunks []Chunk

func (Chunks) ExtractDataPoints

func (cs Chunks) ExtractDataPoints(step model.InsightStep, from time.Time, count int) ([]*model.InsightDataPoint, error)

type DataPoint

type DataPoint interface {
	// Value gets data for model.InsightDataPoint.
	Value() float32
	// Timestamp gets timestamp.
	GetTimestamp() int64
	// Merge merges other DataPoint.
	Merge(point DataPoint) error
}

func ToDataPoints

func ToDataPoints(i interface{}) ([]DataPoint, error)

ToDataPoints converts a list of concrete points into the list of DataPoints

func UpdateDataPoint

func UpdateDataPoint(dp []DataPoint, point DataPoint, timestamp int64) ([]DataPoint, error)

UpdateDataPoint sets data point

type DeployFrequency

type DeployFrequency struct {
	Timestamp   int64   `json:"timestamp"`
	DeployCount float32 `json:"deploy_count"`
}

DeployFrequency represents a data point that shows the deployment frequency metrics.

func (*DeployFrequency) GetTimestamp

func (d *DeployFrequency) GetTimestamp() int64

func (*DeployFrequency) Merge

func (d *DeployFrequency) Merge(point DataPoint) error

func (*DeployFrequency) Value

func (d *DeployFrequency) Value() float32

type DeployFrequencyChunk

type DeployFrequencyChunk struct {
	AccumulatedTo int64                    `json:"accumulated_to"`
	DataPoints    DeployFrequencyDataPoint `json:"data_points"`
	FilePath      string
}

DeployFrequencyChunk represents a chunk of DeployFrequency data points.

func (*DeployFrequencyChunk) GetAccumulatedTo

func (c *DeployFrequencyChunk) GetAccumulatedTo() int64

func (*DeployFrequencyChunk) GetDataPoints

func (c *DeployFrequencyChunk) GetDataPoints(step model.InsightStep) ([]DataPoint, error)

func (*DeployFrequencyChunk) GetFilePath

func (c *DeployFrequencyChunk) GetFilePath() string

func (*DeployFrequencyChunk) SetAccumulatedTo

func (c *DeployFrequencyChunk) SetAccumulatedTo(a int64)

func (*DeployFrequencyChunk) SetDataPoints

func (c *DeployFrequencyChunk) SetDataPoints(step model.InsightStep, points []DataPoint) error

func (*DeployFrequencyChunk) SetFilePath

func (c *DeployFrequencyChunk) SetFilePath(path string)

type DeployFrequencyDataPoint

type DeployFrequencyDataPoint struct {
	Daily   []*DeployFrequency `json:"daily"`
	Weekly  []*DeployFrequency `json:"weekly"`
	Monthly []*DeployFrequency `json:"monthly"`
	Yearly  []*DeployFrequency `json:"yearly"`
}

type Milestone

type Milestone struct {
	// Mark that our collector has handled all
	// deployment that was created before this value
	DeploymentCreatedAtMilestone int64 `json:"deployment_created_at_milestone"`
	// Mark that our collector has handled all deployment
	// that was completed before this value. This will be
	// used while calculating CHANGE_FAILURE_RATE.
	DeploymentCompletedAtMilestone int64 `json:"deployment_completed_at_milestone"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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