metric

package
v0.0.0-...-3794c23 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BasicMetricCategory  = "BASIC"
	CustomMetricCategory = "CUSTOM"
)
View Source
const (
	FiveMinutes   = "5m"
	ThirdyMinutes = "30m"
	OneHour       = "1h"
	ThreeHours    = "3h"
	OneDay        = "1d"
	ThreeDays     = "3d"
	OneWeek       = "1w"
	FourWeeks     = "4w"
)
View Source
const (
	PrometheusMetricProvider = "PROMETHEUS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoHandler

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

func NewEchohandler

func NewEchohandler(e *echo.Echo, logger *zap.Logger, metricUseCase MetricUseCase) EchoHandler

func (EchoHandler) FindAll

func (h EchoHandler) FindAll(c echo.Context) error

func (EchoHandler) Query

func (h EchoHandler) Query(c echo.Context) error

type Metric

type Metric struct {
	charlescdiov1alpha1.MetricSpec
	Name     string `json:"name,omitempty"`
	Category string `json:"category,omitempty"`
	Provider string `json:"provider,omitempty"`
}

type MetricModel

type MetricModel struct {
	ID        string `json:"id"`
	CreatedAt string `json:"createdAt"`
	Metric
}

type MetricProvider

type MetricProvider interface {
	Query(ctx context.Context, circleModel circle.CircleModel, metricModel MetricModel, metricRange MetricRange) (interface{}, error)
}

func NewPrometheusProvider

func NewPrometheusProvider(prometheusClient api.Client) MetricProvider

type MetricRange

type MetricRange struct {
	Start time.Time
	End   time.Time
	Step  time.Duration
}

type MetricRepository

type MetricRepository interface {
	FindAll(ctx context.Context, namespace string, circleModel circle.CircleModel, listoptions listoptions.Request) (listoptions.Response, error)
	FindById(ctx context.Context, namespace string, metricId string) (MetricModel, error)
	Create(ctx context.Context, namespace string, circleModel circle.CircleModel, circle Metric) (MetricModel, error)
	Update(ctx context.Context, namespace string, circleModel circle.CircleModel, metricId string, circle Metric) (MetricModel, error)
	Delete(ctx context.Context, namespace string, metricId string) error
}

func NewK8sRepository

func NewK8sRepository(clientset client.Client) MetricRepository

type MetricUseCase

type MetricUseCase interface {
	FindAll(ctx context.Context, workspaceId string, circleId string, listoptions listoptions.Request) (listoptions.Response, error)
	FindById(ctx context.Context, workspaceId string, metricId string) (MetricModel, error)
	Create(ctx context.Context, workspaceId string, circleId string, circle Metric) (MetricModel, error)
	Update(ctx context.Context, workspaceId string, circleId string, metricId string, circle Metric) (MetricModel, error)
	Delete(ctx context.Context, workspaceId string, metricId string) error
	Query(ctx context.Context, workspaceId string, circleId string, metricId string, rangeTime string) (interface{}, error)
}

func NewUseCase

func NewUseCase(workspaceUseCase workspace.WorkspaceUseCase, circleUseCase circle.CircleUseCase, metricProvider MetricProvider, metricRepository MetricRepository) MetricUseCase

type UseCase

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

func (UseCase) Create

func (u UseCase) Create(ctx context.Context, workspaceId string, circleId string, circle Metric) (MetricModel, error)

Create implements MetricUseCase

func (UseCase) Delete

func (u UseCase) Delete(ctx context.Context, workspaceId string, metricId string) error

Delete implements MetricUseCase

func (UseCase) FindAll

func (u UseCase) FindAll(ctx context.Context, workspaceId string, circleId string, options listoptions.Request) (listoptions.Response, error)

FindAll implements MetricUseCase

func (UseCase) FindById

func (u UseCase) FindById(ctx context.Context, workspaceId string, metricId string) (MetricModel, error)

FindByName implements MetricUseCase

func (UseCase) Query

func (u UseCase) Query(ctx context.Context, workspaceId string, circleId string, metricId string, rangeTime string) (interface{}, error)

func (UseCase) Update

func (u UseCase) Update(ctx context.Context, workspaceId string, circleId string, metricId string, circle Metric) (MetricModel, error)

Update implements MetricUseCase

Jump to

Keyboard shortcuts

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