metrics

package
v0.47.5 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoscalerSlotsRecommendation

type AutoscalerSlotsRecommendation struct {
	ProjectID        string    `json:"project_id"`
	RecommendedSlots int       `json:"recommended_slots"`
	UpdatedOn        time.Time `json:"updated_on"`
}

AutoscalerSlotsRecommendation represents a recommendation for the number of slots to use for a project.

type Client

type Client struct {
	RuntimeHost string
	InstanceID  string
	AccessToken string
}

Client can be used for such use cases as autoscaling, health checks, breached quotas, and usage calculations for billing.

func NewClient

func NewClient(runtimeHost, instanceID, accessToken string) *Client

NewClient creates a new metrics project client. It must be re-created after the provided access token expires. TODO: Move minting and refresh of the access token to the client.

func (*Client) AutoscalerSlotsRecommendations

func (c *Client) AutoscalerSlotsRecommendations(ctx context.Context, limit, offset int) ([]AutoscalerSlotsRecommendation, error)

AutoscalerSlotsRecommendations invokes the "autoscaler-slots-recommendations" API endpoint to get a list of recommendations for the number of slots to use for projects.

func (*Client) GetUsageMetrics added in v0.47.0

func (c *Client) GetUsageMetrics(ctx context.Context, startTime, endTime, afterTime time.Time, afterOrgID, afterProjectID, afterEventName, grain string, limit int) ([]*Usage, error)

type Usage added in v0.47.0

type Usage struct {
	OrgID     string    `json:"org_id"`
	ProjectID string    `json:"project_id"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
	EventName string    `json:"event_name"`
	MaxValue  float64   `json:"max_value"`
}

Jump to

Keyboard shortcuts

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