insight

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("data point not found")
)

Functions

func NormalizeTime

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

func PutChunksToCache

func PutChunksToCache(cache cache.Cache, chunks Chunks) error

Types

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 LoadChunksFromCache

func LoadChunksFromCache(cache cache.Cache, projectID, appID string, kind model.InsightMetricsKind, step model.InsightStep, from time.Time, count int) (Chunks, error)

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"`
}

type Store

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

func NewStore

func NewStore(fs filestore.Store) Store

func (*Store) LoadChunks

func (s *Store) LoadChunks(
	ctx context.Context,
	projectID, appID string,
	kind model.InsightMetricsKind,
	step model.InsightStep,
	from time.Time,
	count int,
) (Chunks, error)

LoadChunks returns all needed chunks for the specified kind and time range.

func (*Store) LoadMilestone

func (s *Store) LoadMilestone(ctx context.Context) (*Milestone, error)

func (*Store) PutChunk

func (s *Store) PutChunk(ctx context.Context, chunk Chunk) error

PutChunk create or update chunk.

Jump to

Keyboard shortcuts

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