usage

package
v5.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListEventsOption

type ListEventsOption func(*ListEventsOptions)

type ListEventsOptions

type ListEventsOptions struct {
	Queries []string
	Total   bool
	// contains filtered or unexported fields
}

func (ListEventsOptions) New

func (options ListEventsOptions) New() *ListEventsOptions

type ListGaugesOption

type ListGaugesOption func(*ListGaugesOptions)

type ListGaugesOptions

type ListGaugesOptions struct {
	Queries []string
	Total   bool
	// contains filtered or unexported fields
}

func (ListGaugesOptions) New

func (options ListGaugesOptions) New() *ListGaugesOptions

type Usage

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

Usage service

func New

func New(clt client.Client) *Usage

func (*Usage) ListEvents

func (srv *Usage) ListEvents(optionalSetters ...ListEventsOption) (*models.UsageEventList, error)

ListEvents query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely.

func (*Usage) ListGauges

func (srv *Usage) ListGauges(optionalSetters ...ListGaugesOption) (*models.UsageGaugeList, error)

ListGauges query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, timestamp, resourceType, and resourceId. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely.

func (*Usage) WithListEventsQueries

func (srv *Usage) WithListEventsQueries(v []string) ListEventsOption

func (*Usage) WithListEventsTotal

func (srv *Usage) WithListEventsTotal(v bool) ListEventsOption

func (*Usage) WithListGaugesQueries

func (srv *Usage) WithListGaugesQueries(v []string) ListGaugesOption

func (*Usage) WithListGaugesTotal

func (srv *Usage) WithListGaugesTotal(v bool) ListGaugesOption

Jump to

Keyboard shortcuts

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