metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager

Get the Metric List

Types

type Dimension

type Dimension struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ListOpts

type ListOpts struct {
	// Specifies the namespace.
	Namespace string `q:"namespace"`

	// The value ranges from 1 to 1000, and is 1000 by default.
	// This parameter is used to limit the number of query results.
	Limit *int `q:"limit"`

	// Specifies the metric name.
	MetricName string `q:"metric_name"`

	// Specifies the metric dimension.
	// A maximum of three dimensions are supported, and the dimensions are numbered from 0 in dim.
	Dim0 string `q:"dim.0"`
	Dim1 string `q:"dim.1"`
	Dim2 string `q:"dim.2"`

	// Specifies the paging start value.
	Start string `q:"start"`

	// Specifies the sorting order of query results.
	Order string `q:"order"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToMetricsListMap

func (opts ListOpts) ToMetricsListMap() (string, error)

ToMetricsListMap formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToMetricsListMap() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type ListResult

type ListResult struct {
	golangsdk.Result
}

type MetaData

type MetaData struct {
	Count  int    `json:"count"`
	Marker string `json:"marker"`
	Total  int    `json:"total"`
}

type Metric

type Metric struct {
	// Specifies the metric namespace.
	Namespace string `json:"namespace"`

	// Specifies the metric name, such as cpu_util.
	MetricName string `json:"metric_name"`

	// Specifies the metric unit.
	Unit string `json:"unit"`

	// Specifies the list of dimensions.
	Dimensions []Dimension `json:"dimensions"`
}

type Metrics

type Metrics struct {
	Metrics  []Metric `json:"metrics"`
	MetaData MetaData `json:"meta_data"`
}

func ExtractAllPagesMetrics

func ExtractAllPagesMetrics(r pagination.Page) (Metrics, error)

Extract is a function that all accepts a result and extracts metrics.

func ExtractMetrics

func ExtractMetrics(r pagination.Page) (Metrics, error)

Extract is a function that accepts a result and extracts metrics.

type MetricsPage

type MetricsPage struct {
	pagination.LinkedPageBase
}

MetricsPage is the page returned by a pager when traversing over a collection of metrics.

func (MetricsPage) IsEmpty

func (r MetricsPage) IsEmpty() (bool, error)

IsEmpty checks whether a NetworkPage struct is empty.

func (MetricsPage) NextPageURL

func (r MetricsPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of metrics has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

func (MetricsPage) WrapNextPageURL

func (r MetricsPage) WrapNextPageURL(start string) (string, error)

ExtractNextURL is an internal function useful for packages of collection resources that are paginated in a certain way.

It attempts to extract the "start" URL from slice of Link structs, or "" if no such URL is present.

Jump to

Keyboard shortcuts

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