doc.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Package csm provides Client Side Monitoring (CSM) which enables sending metrics
  2. // via UDP connection. Using the Start function will enable the reporting of
  3. // metrics on a given port. If Start is called, with different parameters, again,
  4. // a panic will occur.
  5. //
  6. // Pause can be called to pause any metrics publishing on a given port. Sessions
  7. // that have had their handlers modified via InjectHandlers may still be used.
  8. // However, the handlers will act as a no-op meaning no metrics will be published.
  9. //
  10. // Example:
  11. // r, err := csm.Start("clientID", ":31000")
  12. // if err != nil {
  13. // panic(fmt.Errorf("failed starting CSM: %v", err))
  14. // }
  15. //
  16. // sess, err := session.NewSession(&aws.Config{})
  17. // if err != nil {
  18. // panic(fmt.Errorf("failed loading session: %v", err))
  19. // }
  20. //
  21. // r.InjectHandlers(&sess.Handlers)
  22. //
  23. // client := s3.New(sess)
  24. // resp, err := client.GetObject(&s3.GetObjectInput{
  25. // Bucket: aws.String("bucket"),
  26. // Key: aws.String("key"),
  27. // })
  28. //
  29. // // Will pause monitoring
  30. // r.Pause()
  31. // resp, err = client.GetObject(&s3.GetObjectInput{
  32. // Bucket: aws.String("bucket"),
  33. // Key: aws.String("key"),
  34. // })
  35. //
  36. // // Resume monitoring
  37. // r.Continue()
  38. //
  39. // Start returns a Reporter that is used to enable or disable monitoring. If
  40. // access to the Reporter is required later, calling Get will return the Reporter
  41. // singleton.
  42. //
  43. // Example:
  44. // r := csm.Get()
  45. // r.Continue()
  46. package csm