Help us shape the future of Go! Take the 2026 Go Developer Survey

metrics

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 8 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, afterInstanceID, afterBillingService, 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"`
	ProjectName       string    `json:"project_name"`
	BillingCustomerID *string   `json:"billing_customer_id"`
	StartTime         time.Time `json:"start_time"`
	EndTime           time.Time `json:"end_time"`
	EventName         string    `json:"event_name"`
	MaxValue          float64   `json:"max_value"`
	SumValue          float64   `json:"sum_value"`
	BillingService    string    `json:"billing_service"`
	InstanceID        string    `json:"instance_id"`
}

Jump to

Keyboard shortcuts

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