utilization

package
v0.0.0-...-e64e0cb Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewLoaderContext

func NewLoaderContext(ctx context.Context, client ResourceUsageClient) context.Context

func WorkloadResourceRequest

func WorkloadResourceRequest(ctx context.Context, env string, teamSlug slug.Slug, workloadName string, resourceType UtilizationResourceType) (float64, error)

func WorkloadResourceUsage

func WorkloadResourceUsage(ctx context.Context, env string, teamSlug slug.Slug, workloadName string, resourceType UtilizationResourceType) (float64, error)

Types

type Client

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

func NewClient

func NewClient(clusters []string, tenant string, log logrus.FieldLogger) (*Client, error)

type FakeClient

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

func NewFakeClient

func NewFakeClient(environments []string, random *rand.Rand, nowFunc func() prom.Time) *FakeClient

type ResourceUsageClient

type ResourceUsageClient interface {
	// contains filtered or unexported methods
}

type TeamServiceUtilization

type TeamServiceUtilization struct {
	TeamSlug slug.Slug `json:"-"`
}

type TeamUtilization

type TeamUtilization struct {
	TeamSlug slug.Slug `json:"-"`
}

type TeamUtilizationData

type TeamUtilizationData struct {
	Requested       float64   `json:"requested"`
	Used            float64   `json:"used"`
	EnvironmentName string    `json:"-"`
	TeamSlug        slug.Slug `json:"-"`
}

func ForTeams

func ForTeams(ctx context.Context, resourceType UtilizationResourceType) ([]*TeamUtilizationData, error)

type TeamUtilizationEnvironmentDataPoint

type TeamUtilizationEnvironmentDataPoint struct {
	Value           float64   `json:"value"`
	WorkloadName    string    `json:"-"`
	TeamSlug        slug.Slug `json:"-"`
	EnvironmentName string    `json:"-"`
}

type UtilizationDataPoint

type UtilizationDataPoint struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

func WorkloadResourceUsageRange

func WorkloadResourceUsageRange(ctx context.Context, env string, teamSlug slug.Slug, workloadName string, resourceType UtilizationResourceType, start time.Time, end time.Time, step int) ([]*UtilizationDataPoint, error)

type UtilizationResourceType

type UtilizationResourceType string

Resource type.

const (
	UtilizationResourceTypeCPU    UtilizationResourceType = "CPU"
	UtilizationResourceTypeMemory UtilizationResourceType = "MEMORY"
)

func (UtilizationResourceType) IsValid

func (e UtilizationResourceType) IsValid() bool

func (UtilizationResourceType) MarshalGQL

func (e UtilizationResourceType) MarshalGQL(w io.Writer)

func (UtilizationResourceType) String

func (e UtilizationResourceType) String() string

func (*UtilizationResourceType) UnmarshalGQL

func (e *UtilizationResourceType) UnmarshalGQL(v interface{}) error

type WorkloadType

type WorkloadType int
const (
	WorkloadTypeApplication WorkloadType = iota
	WorkloadTypeJob
)

type WorkloadUtilization

type WorkloadUtilization struct {
	EnvironmentName string       `json:"-"`
	WorkloadName    string       `json:"-"`
	TeamSlug        slug.Slug    `json:"-"`
	WorkloadType    WorkloadType `json:"-"`
}

type WorkloadUtilizationData

type WorkloadUtilizationData struct {
	Requested float64 `json:"requested"`
	Used      float64 `json:"used"`

	TeamSlug        slug.Slug `json:"-"`
	EnvironmentName string    `json:"-"`
	WorkloadName    string    `json:"-"`
}

func ForTeam

func ForTeam(ctx context.Context, teamSlug slug.Slug, resourceType UtilizationResourceType) ([]*WorkloadUtilizationData, error)

type WorkloadUtilizationSeriesInput

type WorkloadUtilizationSeriesInput struct {
	Start        time.Time               `json:"start"`
	End          time.Time               `json:"end"`
	ResourceType UtilizationResourceType `json:"resourceType"`
}

func (*WorkloadUtilizationSeriesInput) Step

Jump to

Keyboard shortcuts

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