Documentation ¶
Index ¶
- Constants
- type EchoHandler
- type Metric
- type MetricModel
- type MetricProvider
- type MetricRange
- type MetricRepository
- type MetricUseCase
- type UseCase
- func (u UseCase) Create(ctx context.Context, workspaceId string, circleId string, circle Metric) (MetricModel, error)
- func (u UseCase) Delete(ctx context.Context, workspaceId string, metricId string) error
- func (u UseCase) FindAll(ctx context.Context, workspaceId string, circleId string, ...) (listoptions.Response, error)
- func (u UseCase) FindById(ctx context.Context, workspaceId string, metricId string) (MetricModel, error)
- func (u UseCase) Query(ctx context.Context, workspaceId string, circleId string, metricId string, ...) (interface{}, error)
- func (u UseCase) Update(ctx context.Context, workspaceId string, circleId string, metricId string, ...) (MetricModel, error)
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 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 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) 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
Click to show internal directories.
Click to hide internal directories.