]>
Commit | Line | Data |
---|---|---|
863486a6 AG |
1 | // Package csm provides the Client Side Monitoring (CSM) client which enables |
2 | // sending metrics via UDP connection to the CSM agent. This package provides | |
3 | // control options, and configuration for the CSM client. The client can be | |
4 | // controlled manually, or automatically via the SDK's Session configuration. | |
15c0b25d | 5 | // |
863486a6 AG |
6 | // Enabling CSM client via SDK's Session configuration |
7 | // | |
8 | // The CSM client can be enabled automatically via SDK's Session configuration. | |
9 | // The SDK's session configuration enables the CSM client if the AWS_CSM_PORT | |
10 | // environment variable is set to a non-empty value. | |
11 | // | |
12 | // The configuration options for the CSM client via the SDK's session | |
13 | // configuration are: | |
14 | // | |
15 | // * AWS_CSM_PORT=<port number> | |
16 | // The port number the CSM agent will receive metrics on. | |
17 | // | |
18 | // * AWS_CSM_HOST=<hostname or ip> | |
19 | // The hostname, or IP address the CSM agent will receive metrics on. | |
20 | // Without port number. | |
21 | // | |
22 | // Manually enabling the CSM client | |
23 | // | |
24 | // The CSM client can be started, paused, and resumed manually. The Start | |
25 | // function will enable the CSM client to publish metrics to the CSM agent. It | |
26 | // is safe to call Start concurrently, but if Start is called additional times | |
27 | // with different ClientID or address it will panic. | |
15c0b25d | 28 | // |
15c0b25d AP |
29 | // r, err := csm.Start("clientID", ":31000") |
30 | // if err != nil { | |
31 | // panic(fmt.Errorf("failed starting CSM: %v", err)) | |
32 | // } | |
33 | // | |
863486a6 AG |
34 | // When controlling the CSM client manually, you must also inject its request |
35 | // handlers into the SDK's Session configuration for the SDK's API clients to | |
36 | // publish metrics. | |
37 | // | |
15c0b25d AP |
38 | // sess, err := session.NewSession(&aws.Config{}) |
39 | // if err != nil { | |
40 | // panic(fmt.Errorf("failed loading session: %v", err)) | |
41 | // } | |
42 | // | |
863486a6 AG |
43 | // // Add CSM client's metric publishing request handlers to the SDK's |
44 | // // Session Configuration. | |
15c0b25d AP |
45 | // r.InjectHandlers(&sess.Handlers) |
46 | // | |
863486a6 AG |
47 | // Controlling CSM client |
48 | // | |
49 | // Once the CSM client has been enabled the Get function will return a Reporter | |
50 | // value that you can use to pause and resume the metrics published to the CSM | |
51 | // agent. If Get function is called before the reporter is enabled with the | |
52 | // Start function or via SDK's Session configuration nil will be returned. | |
53 | // | |
54 | // The Pause method can be called to stop the CSM client publishing metrics to | |
55 | // the CSM agent. The Continue method will resume metric publishing. | |
56 | // | |
57 | // // Get the CSM client Reporter. | |
58 | // r := csm.Get() | |
15c0b25d AP |
59 | // |
60 | // // Will pause monitoring | |
61 | // r.Pause() | |
62 | // resp, err = client.GetObject(&s3.GetObjectInput{ | |
63 | // Bucket: aws.String("bucket"), | |
64 | // Key: aws.String("key"), | |
65 | // }) | |
66 | // | |
67 | // // Resume monitoring | |
68 | // r.Continue() | |
15c0b25d | 69 | package csm |