Blame vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go

Packit 63bb0d
// Package csm provides the Client Side Monitoring (CSM) client which enables
Packit 63bb0d
// sending metrics via UDP connection to the CSM agent. This package provides
Packit 63bb0d
// control options, and configuration for the CSM client. The client can be
Packit 63bb0d
// controlled manually, or automatically via the SDK's Session configuration.
Packit 63bb0d
//
Packit 63bb0d
// Enabling CSM client via SDK's Session configuration
Packit 63bb0d
//
Packit 63bb0d
// The CSM client can be enabled automatically via SDK's Session configuration.
Packit 63bb0d
// The SDK's session configuration enables the CSM client if the AWS_CSM_PORT
Packit 63bb0d
// environment variable is set to a non-empty value.
Packit 63bb0d
//
Packit 63bb0d
// The configuration options for the CSM client via the SDK's session
Packit 63bb0d
// configuration are:
Packit 63bb0d
//
Packit 63bb0d
//	* AWS_CSM_PORT=<port number>
Packit 63bb0d
//	  The port number the CSM agent will receive metrics on.
Packit 63bb0d
//
Packit 63bb0d
//	* AWS_CSM_HOST=<hostname or ip>
Packit 63bb0d
//	  The hostname, or IP address the CSM agent will receive metrics on.
Packit 63bb0d
//	  Without port number.
Packit 63bb0d
//
Packit 63bb0d
// Manually enabling the CSM client
Packit 63bb0d
//
Packit 63bb0d
// The CSM client can be started, paused, and resumed manually. The Start
Packit 63bb0d
// function will enable the CSM client to publish metrics to the CSM agent. It
Packit 63bb0d
// is safe to call Start concurrently, but if Start is called additional times
Packit 63bb0d
// with different ClientID or address it will panic.
Packit 63bb0d
//
Packit 63bb0d
//		r, err := csm.Start("clientID", ":31000")
Packit 63bb0d
//		if err != nil {
Packit 63bb0d
//			panic(fmt.Errorf("failed starting CSM:  %v", err))
Packit 63bb0d
//		}
Packit 63bb0d
//
Packit 63bb0d
// When controlling the CSM client manually, you must also inject its request
Packit 63bb0d
// handlers into the SDK's Session configuration for the SDK's API clients to
Packit 63bb0d
// publish metrics.
Packit 63bb0d
//
Packit 63bb0d
//		sess, err := session.NewSession(&aws.Config{})
Packit 63bb0d
//		if err != nil {
Packit 63bb0d
//			panic(fmt.Errorf("failed loading session: %v", err))
Packit 63bb0d
//		}
Packit 63bb0d
//
Packit 63bb0d
//		// Add CSM client's metric publishing request handlers to the SDK's
Packit 63bb0d
//		// Session Configuration.
Packit 63bb0d
//		r.InjectHandlers(&sess.Handlers)
Packit 63bb0d
//
Packit 63bb0d
// Controlling CSM client
Packit 63bb0d
//
Packit 63bb0d
// Once the CSM client has been enabled the Get function will return a Reporter
Packit 63bb0d
// value that you can use to pause and resume the metrics published to the CSM
Packit 63bb0d
// agent. If Get function is called before the reporter is enabled with the
Packit 63bb0d
// Start function or via SDK's Session configuration nil will be returned.
Packit 63bb0d
//
Packit 63bb0d
// The Pause method can be called to stop the CSM client publishing metrics to
Packit 63bb0d
// the CSM agent. The Continue method will resume metric publishing.
Packit 63bb0d
//
Packit 63bb0d
//		// Get the CSM client Reporter.
Packit 63bb0d
//		r := csm.Get()
Packit 63bb0d
//
Packit 63bb0d
//		// Will pause monitoring
Packit 63bb0d
//		r.Pause()
Packit 63bb0d
//		resp, err = client.GetObject(&s3.GetObjectInput{
Packit 63bb0d
//			Bucket: aws.String("bucket"),
Packit 63bb0d
//			Key: aws.String("key"),
Packit 63bb0d
//		})
Packit 63bb0d
//
Packit 63bb0d
//		// Resume monitoring
Packit 63bb0d
//		r.Continue()
Packit 63bb0d
package csm