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

metricdata

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMetricData added in v0.5.21

func CreateMetricData(client *golangsdk.ServiceClient, items []MetricDataItem) error

Types

type BatchListMetricDataOpts added in v0.5.21

type BatchListMetricDataOpts struct {
	// Specifies the metric data. The maximum length of the array is 10.
	Metrics []Metric `json:"metrics" required:"true"`
	// Specifies the start time of the query.
	// The value is a UNIX timestamp and the unit is ms.
	// Set the value of from to at least one period earlier than the current time.
	// Rollup aggregates the raw data generated within a period to the start time of the period.
	// Therefore, if values of from and to are within a period,
	// the query result will be empty due to the rollup failure.
	// You are advised to set from to be at least one period earlier than the current time.
	// Take the 5-minute period as an example. If it is 10:35 now,
	// the raw data generated between 10:30 and 10:35 will be aggregated to 10:30.
	// Therefore, in this example, if the value of period is 5 minutes,
	// the value of from should be 10:30 or earlier.
	From int64 `json:"from" required:"true"`
	// Specifies the end time of the query.
	// The value is a UNIX timestamp and the unit is ms.
	// The value of parameter from must be earlier than that of parameter to.
	To int64 `json:"to" required:"true"`
	// Specifies how often Cloud Eye aggregates data.
	//
	// Possible values are:
	// 1: Cloud Eye performs no aggregation and displays raw data.
	// 300: Cloud Eye aggregates data every 5 minutes.
	// 1200: Cloud Eye aggregates data every 20 minutes.
	// 3600: Cloud Eye aggregates data every 1 hour.
	// 14400: Cloud Eye aggregates data every 4 hours.
	// 86400: Cloud Eye aggregates data every 24 hours.
	Period string `json:"period" required:"true"`
	// Specifies the data rollup method. The following methods are supported:
	//
	// average: Cloud Eye calculates the average value of metric data within a rollup period.
	// max: Cloud Eye calculates the maximum value of metric data within a rollup period.
	// min: Cloud Eye calculates the minimum value of metric data within a rollup period.
	// sum: Cloud Eye calculates the sum of metric data within a rollup period.
	// variance: Cloud Eye calculates the variance value of metric data within a rollup period.
	// The value of filter does not affect the query result of raw data. (The period is 1.)
	Filter string `json:"filter" required:"true"`
}

type BatchMetricData added in v0.5.21

type BatchMetricData struct {
	// Specifies the metric namespace.
	// The value must be in the service.item format and can contain 3 to 32 characters.
	Namespace string `json:"namespace"`
	// Specifies the metric name. Start with a letter. Enter 1 to 64 characters.
	MetricName string `json:"metric_name"`
	// Specifies the list of metric dimensions.
	Dimensions []MetricsDimension `json:"dimensions"`
	// Specifies the metric data list.
	// Since Cloud Eye rounds up the value of from based on the level of granularity for data query,
	// datapoints may contain more data points than expected.
	Datapoints []DatapointForBatchMetric `json:"datapoints"`
	// Specifies the metric unit.
	Unit string `json:"unit"`
}

func BatchListMetricData added in v0.5.21

func BatchListMetricData(client *golangsdk.ServiceClient, opts BatchListMetricDataOpts) ([]BatchMetricData, error)

type Datapoint

type Datapoint struct {
	// Specifies the maximum value of metric data within a rollup period.
	Max float64 `json:"max,omitempty"`
	// Specifies the minimum value of metric data within a rollup period.
	Min float64 `json:"min,omitempty"`
	// Specifies the average value of metric data within a rollup period.
	Average float64 `json:"average,omitempty"`
	// Specifies the sum of metric data within a rollup period.
	Sum float64 `json:"sum,omitempty"`
	// Specifies the variance of metric data within a rollup period.
	Variance float64 `json:"variance,omitempty"`
	// Specifies when the metric is collected. It is a UNIX timestamp in milliseconds.
	Timestamp int64 `json:"timestamp"`
	// Specifies the metric unit.
	Unit string `json:"unit,omitempty"`
}

type DatapointForBatchMetric added in v0.5.21

type DatapointForBatchMetric struct {
	// Specifies the maximum value of metric data within a rollup period.
	Max float64 `json:"max"`
	// Specifies the minimum value of metric data within a rollup period.
	Min float64 `json:"min"`
	// Specifies the average value of metric data within a rollup period.
	Average float64 `json:"average"`
	// Specifies the sum of metric data within a rollup period.
	Sum float64 `json:"sum"`
	// Specifies the variance of metric data within a rollup period.
	Variance float64 `json:"variance"`
	// Specifies when the metric is collected. It is a UNIX timestamp in milliseconds.
	Timestamp int64 `json:"timestamp"`
}

type EventDataInfo

type EventDataInfo struct {
	// Specifies the event type, for example, instance_host_info.
	Type string `json:"type"`
	// Specifies when the event is reported. It is a UNIX timestamp and the unit is ms.
	Timestamp int64 `json:"timestamp"`
	// Specifies the host configuration information.
	Value string `json:"value"`
}

func ListEventData added in v0.5.21

func ListEventData(client *golangsdk.ServiceClient, opts ShowEventDataOpts) ([]EventDataInfo, error)

type Metric

type Metric struct {
	// Specifies the metric namespace. Its value must be in the service.item format and can contain 3 to 32 characters.
	// service and item each must be a string that starts with a letter and contains only letters, digits, and underscores (_).
	Namespace string `json:"namespace" required:"true"`

	// Specifies the metric name. Start with a letter.
	// Enter 1 to 64 characters. Only letters, digits, and underscores (_) are allowed.
	MetricName string `json:"metric_name" required:"true"`

	// Specifies the list of the metric dimensions.
	Dimensions []MetricsDimension `json:"dimensions" required:"true"`
}

type MetricData

type MetricData struct {
	// Specifies the metric data list. For details, see Table 4.
	// Since Cloud Eye rounds up the value of from based on the level of granularity for data query,
	// datapoints may contain more data points than expected.
	Datapoints []Datapoint `json:"datapoints"`
	// Specifies the metric ID. For example, if the monitoring metric of an ECS is CPU usage, metric_name is cpu_util.
	MetricName string `json:"metric_name"`
}

func ShowMetricData added in v0.5.21

func ShowMetricData(client *golangsdk.ServiceClient, opts ShowMetricDataOpts) (*MetricData, error)

type MetricDataItem added in v0.5.21

type MetricDataItem struct {
	// Specifies the metric data.
	Metric MetricInfo `json:"metric" required:"true"`
	// Specifies the data validity period.
	// The unit is second. The value range is 0–604,800 seconds.
	// If the validity period expires, the data will be automatically deleted.
	Ttl int `json:"ttl" required:"true"`
	// Specifies when the data was collected.
	// The time is UNIX timestamp (ms) format.
	CollectTime int64 `json:"collect_time" required:"true"`
	// Specifies the monitoring metric data to be added.
	// The value can be an integer or a floating point number.
	Value float64 `json:"value" required:"true"`
	// Specifies the data unit.
	// Enter a maximum of 32 characters.
	Unit string `json:"unit,omitempty"`
	// Specifies the enumerated type.
	// Possible values:
	// int
	// float
	Type string `json:"type,omitempty"`
}

type MetricInfo

type MetricInfo struct {
	// Specifies the metric dimension. A maximum of three dimensions are supported.
	Dimensions []MetricsDimension `json:"dimensions" required:"true"`
	// Specifies the metric ID. For example, if the monitoring metric of an ECS is CPU usage, metric_name is cpu_util.
	MetricName string `json:"metric_name" required:"true"`
	// Query the namespace of a service.
	Namespace string `json:"namespace" required:"true"`
}

type MetricsDimension

type MetricsDimension struct {
	// Specifies the dimension. For example, the ECS dimension is instance_id.
	// For details about the dimension of each service, see the key column in Services Interconnected with Cloud Eye.
	// Start with a letter. Enter 1 to 32 characters.
	// Only letters, digits, underscores (_), and hyphens (-) are allowed.
	Name string `json:"name,omitempty"`
	// Specifies the dimension value, for example, an ECS ID.
	// Start with a letter or a digit. Enter 1 to 256 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.
	Value string `json:"value,omitempty"`
}

type ShowEventDataOpts added in v0.5.21

type ShowEventDataOpts struct {
	// Query the namespace of a service.
	Namespace string `q:"namespace"`
	// Specifies the dimension. For example, the ECS dimension is instance_id.
	// For details about the dimensions corresponding to the monitoring metrics of each service,
	// see the monitoring metrics description of the corresponding service in Services Interconnected with Cloud Eye.
	//
	// Specifies the dimension. A maximum of three dimensions are supported,
	// and the dimensions are numbered from 0 in dim.{i}=key,value format.
	// The key cannot exceed 32 characters and the value cannot exceed 256 characters.
	Dim0 string `q:"dim.0"`
	Dim1 string `q:"dim.1"`
	Dim2 string `q:"dim.2"`
	// Specifies the event type.
	Type string `q:"type"`
	// Specifies the start time of the query.
	From string `q:"from"`
	// Specifies the end time of the query.
	To string `q:"to"`
}

type ShowMetricDataOpts added in v0.5.21

type ShowMetricDataOpts struct {
	// Specifies the namespace of a service.
	Namespace string `q:"namespace"`
	// Specifies the metric name.
	MetricName string `q:"metric_name"`
	// Currently, a maximum of three metric dimensions are supported,
	// and the dimensions are numbered from 0 in the dim.{i}=key,value format.
	// The key cannot exceed 32 characters and the value cannot exceed 256 characters.
	// The following dimensions are only examples.
	// For details about whether multiple dimensions are supported,
	// see the dimension description in the monitoring indicator description of each service.
	// Single dimension: dim.0=instance_id,i-12345
	// Multiple dimensions: dim.0=instance_id,i-12345&dim.1=instance_name,i-1234
	Dim0 string `q:"dim.0"`
	Dim1 string `q:"dim.1"`
	Dim2 string `q:"dim.2"`
	// Specifies the data rollup method. The following methods are supported:
	//
	// average: Cloud Eye calculates the average value of metric data within a rollup period.
	// max: Cloud Eye calculates the maximum value of metric data within a rollup period.
	// min: Cloud Eye calculates the minimum value of metric data within a rollup period.
	// sum: Cloud Eye calculates the sum of metric data within a rollup period.
	// variance: Cloud Eye calculates the variance value of metric data within a rollup period.
	Filter string `q:"filter"`
	// Specifies how often Cloud Eye aggregates data.
	//
	// Possible values are:
	// 1: Cloud Eye performs no aggregation and displays raw data.
	// 300: Cloud Eye aggregates data every 5 minutes.
	// 1200: Cloud Eye aggregates data every 20 minutes.
	// 3600: Cloud Eye aggregates data every 1 hour.
	// 14400: Cloud Eye aggregates data every 4 hours.
	// 86400: Cloud Eye aggregates data every 24 hours.
	Period int `q:"period"`
	// Specifies the start time of the query.
	// The value is a UNIX timestamp and the unit is ms.
	// Set the value of from to at least one period earlier than the current time.
	// Rollup aggregates the raw data generated within a period to the start time of the period.
	// Therefore, if values of from and to are within a period,
	// the query result will be empty due to the rollup failure.
	// Take the 5-minute period as an example. If it is 10:35 now,
	// the raw data generated between 10:30 and 10:35 will be aggregated to 10:30.
	// Therefore, in this example, if the value of period is 5 minutes,
	// the value of from should be 10:30 or earlier.
	From string `q:"from"`
	// Specifies the end time of the query.
	To string `q:"to"`
}

Jump to

Keyboard shortcuts

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