pi

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package pi provides the client and types for making API requests to AWS PI.

AWS Performance Insights enables you to monitor and explore different dimensions of database load based on data captured from a running RDS instance. The guide provides detailed information about Performance Insights data types, parameters and errors. For more information about Performance Insights capabilities see Using Amazon RDS Performance Insights (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) in the Amazon RDS User Guide.

The AWS Performance Insights API provides visibility into the performance of your RDS instance, when Performance Insights is enabled for supported engine types. While Amazon CloudWatch provides the authoritative source for AWS service vended monitoring metrics, AWS Performance Insights offers a domain-specific view of database load measured as Average Active Sessions and provided to API consumers as a 2-dimensional time-series dataset. The time dimension of the data provides DB load data for each time point in the queried time range, and each time point decomposes overall load in relation to the requested dimensions, such as SQL, Wait-event, User or Host, measured at that time point.

See https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27 for more information on this service.

See pi package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/pi/

Using the Client

To use AWS PI with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the AWS PI client for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/pi/#New

Index

Constants

View Source
const (
	ServiceName = "AWS PI" // Service's name
	ServiceID   = "PI"     // Service's identifier
	EndpointsID = "pi"     // Service's Endpoint identifier
)
View Source
const (

	// ErrCodeInternalServiceError for service response error code
	// "InternalServiceError".
	//
	// The request failed due to an unknown error.
	ErrCodeInternalServiceError = "InternalServiceError"

	// ErrCodeInvalidArgumentException for service response error code
	// "InvalidArgumentException".
	//
	// One of the arguments provided is invalid for this request.
	ErrCodeInvalidArgumentException = "InvalidArgumentException"

	// ErrCodeNotAuthorizedException for service response error code
	// "NotAuthorizedException".
	//
	// The user is not authorized to perform this request.
	ErrCodeNotAuthorizedException = "NotAuthorizedException"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.9.0

type Client struct {
	*aws.Client
}

Client provides the API operation methods for making requests to AWS PI. See this package's package overview docs for details on the service.

The client's methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

func New(config aws.Config) *Client

New creates a new instance of the client from the provided Config.

Example:

// Create a client from just a config.
svc := pi.New(myConfig)

func (*Client) DescribeDimensionKeysRequest added in v0.9.0

func (c *Client) DescribeDimensionKeysRequest(input *DescribeDimensionKeysInput) DescribeDimensionKeysRequest

DescribeDimensionKeysRequest returns a request value for making API operation for AWS Performance Insights.

For a specific time period, retrieve the top N dimension keys for a metric.

// Example sending a request using DescribeDimensionKeysRequest.
req := client.DescribeDimensionKeysRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/DescribeDimensionKeys

func (*Client) GetResourceMetricsRequest added in v0.9.0

func (c *Client) GetResourceMetricsRequest(input *GetResourceMetricsInput) GetResourceMetricsRequest

GetResourceMetricsRequest returns a request value for making API operation for AWS Performance Insights.

Retrieve Performance Insights metrics for a set of data sources, over a time period. You can provide specific dimension groups and dimensions, and provide aggregation and filtering criteria for each group.

// Example sending a request using GetResourceMetricsRequest.
req := client.GetResourceMetricsRequest(params)
resp, err := req.Send(context.TODO())
if err == nil {
    fmt.Println(resp)
}

Please also see https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/GetResourceMetrics

type DataPoint

type DataPoint struct {

	// The time, in epoch format, associated with a particular Value.
	//
	// Timestamp is a required field
	Timestamp *time.Time `type:"timestamp" required:"true"`

	// The actual value associated with a particular Timestamp.
	//
	// Value is a required field
	Value *float64 `type:"double" required:"true"`
	// contains filtered or unexported fields
}

A timestamp, and a single numerical value, which together represent a measurement at a particular point in time.

func (DataPoint) String

func (s DataPoint) String() string

String returns the string representation

type DescribeDimensionKeysInput

type DescribeDimensionKeysInput struct {

	// The date and time specifying the end of the requested time series data. The
	// value specified is exclusive - data points less than (but not equal to) EndTime
	// will be returned.
	//
	// The value for EndTime must be later than the value for StartTime.
	//
	// EndTime is a required field
	EndTime *time.Time `type:"timestamp" required:"true"`

	// One or more filters to apply in the request. Restrictions:
	//
	//    * Any number of filters by the same dimension, as specified in the GroupBy
	//    or Partition parameters.
	//
	//    * A single filter for any other dimension in this dimension group.
	Filter map[string]string `type:"map"`

	// A specification for how to aggregate the data points from a query result.
	// You must specify a valid dimension group. Performance Insights will return
	// all of the dimensions within that group, unless you provide the names of
	// specific dimensions within that group. You can also request that Performance
	// Insights return a limited number of values for a dimension.
	//
	// GroupBy is a required field
	GroupBy *DimensionGroup `type:"structure" required:"true"`

	// An immutable, AWS Region-unique identifier for a data source. Performance
	// Insights gathers metrics from this data source.
	//
	// To use an Amazon RDS instance as a data source, you specify its DbiResourceId
	// value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
	//
	// Identifier is a required field
	Identifier *string `type:"string" required:"true"`

	// The maximum number of items to return in the response. If more items exist
	// than the specified MaxRecords value, a pagination token is included in the
	// response so that the remaining results can be retrieved.
	MaxResults *int64 `type:"integer"`

	// The name of a Performance Insights metric to be measured.
	//
	// Valid values for Metric are:
	//
	//    * db.load.avg - a scaled representation of the number of active sessions
	//    for the database engine.
	//
	//    * db.sampledload.avg - the raw number of active sessions for the database
	//    engine.
	//
	// Metric is a required field
	Metric *string `type:"string" required:"true"`

	// An optional pagination token provided by a previous request. If this parameter
	// is specified, the response includes only records beyond the token, up to
	// the value specified by MaxRecords.
	NextToken *string `type:"string"`

	// For each dimension specified in GroupBy, specify a secondary dimension to
	// further subdivide the partition keys in the response.
	PartitionBy *DimensionGroup `type:"structure"`

	// The granularity, in seconds, of the data points returned from Performance
	// Insights. A period can be as short as one second, or as long as one day (86400
	// seconds). Valid values are:
	//
	//    * 1 (one second)
	//
	//    * 60 (one minute)
	//
	//    * 300 (five minutes)
	//
	//    * 3600 (one hour)
	//
	//    * 86400 (twenty-four hours)
	//
	// If you don't specify PeriodInSeconds, then Performance Insights will choose
	// a value for you, with a goal of returning roughly 100-200 data points in
	// the response.
	PeriodInSeconds *int64 `type:"integer"`

	// The AWS service for which Performance Insights will return metrics. The only
	// valid value for ServiceType is: RDS
	//
	// ServiceType is a required field
	ServiceType ServiceType `type:"string" required:"true" enum:"true"`

	// The date and time specifying the beginning of the requested time series data.
	// You can't specify a StartTime that's earlier than 7 days ago. The value specified
	// is inclusive - data points equal to or greater than StartTime will be returned.
	//
	// The value for StartTime must be earlier than the value for EndTime.
	//
	// StartTime is a required field
	StartTime *time.Time `type:"timestamp" required:"true"`
	// contains filtered or unexported fields
}

func (DescribeDimensionKeysInput) String

String returns the string representation

func (*DescribeDimensionKeysInput) Validate

func (s *DescribeDimensionKeysInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DescribeDimensionKeysOutput

type DescribeDimensionKeysOutput struct {

	// The end time for the returned dimension keys, after alignment to a granular
	// boundary (as specified by PeriodInSeconds). AlignedEndTime will be greater
	// than or equal to the value of the user-specified Endtime.
	AlignedEndTime *time.Time `type:"timestamp"`

	// The start time for the returned dimension keys, after alignment to a granular
	// boundary (as specified by PeriodInSeconds). AlignedStartTime will be less
	// than or equal to the value of the user-specified StartTime.
	AlignedStartTime *time.Time `type:"timestamp"`

	// The dimension keys that were requested.
	Keys []DimensionKeyDescription `type:"list"`

	// An optional pagination token provided by a previous request. If this parameter
	// is specified, the response includes only records beyond the token, up to
	// the value specified by MaxRecords.
	NextToken *string `type:"string"`

	// If PartitionBy was present in the request, PartitionKeys contains the breakdown
	// of dimension keys by the specified partitions.
	PartitionKeys []ResponsePartitionKey `type:"list"`
	// contains filtered or unexported fields
}

func (DescribeDimensionKeysOutput) String

String returns the string representation

type DescribeDimensionKeysRequest

type DescribeDimensionKeysRequest struct {
	*aws.Request
	Input *DescribeDimensionKeysInput
	Copy  func(*DescribeDimensionKeysInput) DescribeDimensionKeysRequest
}

DescribeDimensionKeysRequest is the request type for the DescribeDimensionKeys API operation.

func (DescribeDimensionKeysRequest) Send

Send marshals and sends the DescribeDimensionKeys API request.

type DescribeDimensionKeysResponse added in v0.9.0

type DescribeDimensionKeysResponse struct {
	*DescribeDimensionKeysOutput
	// contains filtered or unexported fields
}

DescribeDimensionKeysResponse is the response type for the DescribeDimensionKeys API operation.

func (*DescribeDimensionKeysResponse) SDKResponseMetdata added in v0.9.0

func (r *DescribeDimensionKeysResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the DescribeDimensionKeys request.

type DimensionGroup

type DimensionGroup struct {

	// A list of specific dimensions from a dimension group. If this parameter is
	// not present, then it signifies that all of the dimensions in the group were
	// requested, or are present in the response.
	//
	// Valid values for elements in the Dimensions array are:
	//
	//    * db.user.id
	//
	//    * db.user.name
	//
	//    * db.host.id
	//
	//    * db.host.name
	//
	//    * db.sql.id
	//
	//    * db.sql.db_id
	//
	//    * db.sql.statement
	//
	//    * db.sql.tokenized_id
	//
	//    * db.sql_tokenized.id
	//
	//    * db.sql_tokenized.db_id
	//
	//    * db.sql_tokenized.statement
	//
	//    * db.wait_event.name
	//
	//    * db.wait_event.type
	//
	//    * db.wait_event_type.name
	Dimensions []string `min:"1" type:"list"`

	// The name of the dimension group. Valid values are:
	//
	//    * db.user
	//
	//    * db.host
	//
	//    * db.sql
	//
	//    * db.sql_tokenized
	//
	//    * db.wait_event
	//
	//    * db.wait_event_type
	//
	// Group is a required field
	Group *string `type:"string" required:"true"`

	// The maximum number of items to fetch for this dimension group.
	Limit *int64 `min:"1" type:"integer"`
	// contains filtered or unexported fields
}

A logical grouping of Performance Insights metrics for a related subject area. For example, the db.sql dimension group consists of the following dimensions: db.sql.id, db.sql.db_id, db.sql.statement, and db.sql.tokenized_id.

func (DimensionGroup) String

func (s DimensionGroup) String() string

String returns the string representation

func (*DimensionGroup) Validate

func (s *DimensionGroup) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DimensionKeyDescription

type DimensionKeyDescription struct {

	// A map of name-value pairs for the dimensions in the group.
	Dimensions map[string]string `type:"map"`

	// If PartitionBy was specified, PartitionKeys contains the dimensions that
	// were.
	Partitions []float64 `type:"list"`

	// The aggregated metric value for the dimension(s), over the requested time
	// range.
	Total *float64 `type:"double"`
	// contains filtered or unexported fields
}

An array of descriptions and aggregated values for each dimension within a dimension group.

func (DimensionKeyDescription) String

func (s DimensionKeyDescription) String() string

String returns the string representation

type GetResourceMetricsInput

type GetResourceMetricsInput struct {

	// The date and time specifiying the end of the requested time series data.
	// The value specified is exclusive - data points less than (but not equal to)
	// EndTime will be returned.
	//
	// The value for EndTime must be later than the value for StartTime.
	//
	// EndTime is a required field
	EndTime *time.Time `type:"timestamp" required:"true"`

	// An immutable, AWS Region-unique identifier for a data source. Performance
	// Insights gathers metrics from this data source.
	//
	// To use an Amazon RDS instance as a data source, you specify its DbiResourceId
	// value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
	//
	// Identifier is a required field
	Identifier *string `type:"string" required:"true"`

	// The maximum number of items to return in the response. If more items exist
	// than the specified MaxRecords value, a pagination token is included in the
	// response so that the remaining results can be retrieved.
	MaxResults *int64 `type:"integer"`

	// An array of one or more queries to perform. Each query must specify a Performance
	// Insights metric, and can optionally specify aggregation and filtering criteria.
	//
	// MetricQueries is a required field
	MetricQueries []MetricQuery `min:"1" type:"list" required:"true"`

	// An optional pagination token provided by a previous request. If this parameter
	// is specified, the response includes only records beyond the token, up to
	// the value specified by MaxRecords.
	NextToken *string `type:"string"`

	// The granularity, in seconds, of the data points returned from Performance
	// Insights. A period can be as short as one second, or as long as one day (86400
	// seconds). Valid values are:
	//
	//    * 1 (one second)
	//
	//    * 60 (one minute)
	//
	//    * 300 (five minutes)
	//
	//    * 3600 (one hour)
	//
	//    * 86400 (twenty-four hours)
	//
	// If you don't specify PeriodInSeconds, then Performance Insights will choose
	// a value for you, with a goal of returning roughly 100-200 data points in
	// the response.
	PeriodInSeconds *int64 `type:"integer"`

	// The AWS service for which Performance Insights will return metrics. The only
	// valid value for ServiceType is: RDS
	//
	// ServiceType is a required field
	ServiceType ServiceType `type:"string" required:"true" enum:"true"`

	// The date and time specifying the beginning of the requested time series data.
	// You can't specify a StartTime that's earlier than 7 days ago. The value specified
	// is inclusive - data points equal to or greater than StartTime will be returned.
	//
	// The value for StartTime must be earlier than the value for EndTime.
	//
	// StartTime is a required field
	StartTime *time.Time `type:"timestamp" required:"true"`
	// contains filtered or unexported fields
}

func (GetResourceMetricsInput) String

func (s GetResourceMetricsInput) String() string

String returns the string representation

func (*GetResourceMetricsInput) Validate

func (s *GetResourceMetricsInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetResourceMetricsOutput

type GetResourceMetricsOutput struct {

	// The end time for the returned metrics, after alignment to a granular boundary
	// (as specified by PeriodInSeconds). AlignedEndTime will be greater than or
	// equal to the value of the user-specified Endtime.
	AlignedEndTime *time.Time `type:"timestamp"`

	// The start time for the returned metrics, after alignment to a granular boundary
	// (as specified by PeriodInSeconds). AlignedStartTime will be less than or
	// equal to the value of the user-specified StartTime.
	AlignedStartTime *time.Time `type:"timestamp"`

	// An immutable, AWS Region-unique identifier for a data source. Performance
	// Insights gathers metrics from this data source.
	//
	// To use an Amazon RDS instance as a data source, you specify its DbiResourceId
	// value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
	Identifier *string `type:"string"`

	// An array of metric results,, where each array element contains all of the
	// data points for a particular dimension.
	MetricList []MetricKeyDataPoints `type:"list"`

	// An optional pagination token provided by a previous request. If this parameter
	// is specified, the response includes only records beyond the token, up to
	// the value specified by MaxRecords.
	NextToken *string `type:"string"`
	// contains filtered or unexported fields
}

func (GetResourceMetricsOutput) String

func (s GetResourceMetricsOutput) String() string

String returns the string representation

type GetResourceMetricsRequest

type GetResourceMetricsRequest struct {
	*aws.Request
	Input *GetResourceMetricsInput
	Copy  func(*GetResourceMetricsInput) GetResourceMetricsRequest
}

GetResourceMetricsRequest is the request type for the GetResourceMetrics API operation.

func (GetResourceMetricsRequest) Send

Send marshals and sends the GetResourceMetrics API request.

type GetResourceMetricsResponse added in v0.9.0

type GetResourceMetricsResponse struct {
	*GetResourceMetricsOutput
	// contains filtered or unexported fields
}

GetResourceMetricsResponse is the response type for the GetResourceMetrics API operation.

func (*GetResourceMetricsResponse) SDKResponseMetdata added in v0.9.0

func (r *GetResourceMetricsResponse) SDKResponseMetdata() *aws.Response

SDKResponseMetdata returns the response metadata for the GetResourceMetrics request.

type MetricKeyDataPoints

type MetricKeyDataPoints struct {

	// An array of timestamp-value pairs, representing measurements over a period
	// of time.
	DataPoints []DataPoint `type:"list"`

	// The dimension(s) to which the data points apply.
	Key *ResponseResourceMetricKey `type:"structure"`
	// contains filtered or unexported fields
}

A time-ordered series of data points, correpsonding to a dimension of a Performance Insights metric.

func (MetricKeyDataPoints) String

func (s MetricKeyDataPoints) String() string

String returns the string representation

type MetricQuery

type MetricQuery struct {

	// One or more filters to apply in the request. Restrictions:
	//
	//    * Any number of filters by the same dimension, as specified in the GroupBy
	//    parameter.
	//
	//    * A single filter for any other dimension in this dimension group.
	Filter map[string]string `type:"map"`

	// A specification for how to aggregate the data points from a query result.
	// You must specify a valid dimension group. Performance Insights will return
	// all of the dimensions within that group, unless you provide the names of
	// specific dimensions within that group. You can also request that Performance
	// Insights return a limited number of values for a dimension.
	GroupBy *DimensionGroup `type:"structure"`

	// The name of a Performance Insights metric to be measured.
	//
	// Valid values for Metric are:
	//
	//    * db.load.avg - a scaled representation of the number of active sessions
	//    for the database engine.
	//
	//    * db.sampledload.avg - the raw number of active sessions for the database
	//    engine.
	//
	// Metric is a required field
	Metric *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

A single query to be processed. You must provide the metric to query. If no other parameters are specified, Performance Insights returns all of the data points for that metric. You can optionally request that the data points be aggregated by dimension group ( GroupBy), and return only those data points that match your criteria (Filter).

func (MetricQuery) String

func (s MetricQuery) String() string

String returns the string representation

func (*MetricQuery) Validate

func (s *MetricQuery) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type ResponsePartitionKey

type ResponsePartitionKey struct {

	// A dimension map that contains the dimension(s) for this partition.
	//
	// Dimensions is a required field
	Dimensions map[string]string `type:"map" required:"true"`
	// contains filtered or unexported fields
}

If PartitionBy was specified in a DescribeDimensionKeys request, the dimensions are returned in an array. Each element in the array specifies one dimension.

func (ResponsePartitionKey) String

func (s ResponsePartitionKey) String() string

String returns the string representation

type ResponseResourceMetricKey

type ResponseResourceMetricKey struct {

	// The valid dimensions for the metric.
	Dimensions map[string]string `type:"map"`

	// The name of a Performance Insights metric to be measured.
	//
	// Valid values for Metric are:
	//
	//    * db.load.avg - a scaled representation of the number of active sessions
	//    for the database engine.
	//
	//    * db.sampledload.avg - the raw number of active sessions for the database
	//    engine.
	//
	// Metric is a required field
	Metric *string `type:"string" required:"true"`
	// contains filtered or unexported fields
}

An object describing a Performance Insights metric and one or more dimensions for that metric.

func (ResponseResourceMetricKey) String

func (s ResponseResourceMetricKey) String() string

String returns the string representation

type ServiceType

type ServiceType string
const (
	ServiceTypeRds ServiceType = "RDS"
)

Enum values for ServiceType

func (ServiceType) MarshalValue

func (enum ServiceType) MarshalValue() (string, error)

func (ServiceType) MarshalValueBuf

func (enum ServiceType) MarshalValueBuf(b []byte) ([]byte, error)

Directories

Path Synopsis
Package piiface provides an interface to enable mocking the AWS Performance Insights service client for testing your code.
Package piiface provides an interface to enable mocking the AWS Performance Insights service client for testing your code.

Jump to

Keyboard shortcuts

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