stats_payload.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Unless explicitly stated otherwise all files in this repository are licensed
  2. // under the Apache License Version 2.0.
  3. // This product includes software developed at Datadog (https://www.datadoghq.com/).
  4. // Copyright 2016 Datadog, Inc.
  5. //go:generate msgp -unexported -marshal=false -o=stats_payload_msgp.go -tests=false
  6. package tracer
  7. // statsPayload specifies information about client computed stats and is encoded
  8. // to be sent to the agent.
  9. type statsPayload struct {
  10. // Hostname specifies the hostname of the application.
  11. Hostname string
  12. // Env specifies the env. of the application, as defined by the user.
  13. Env string
  14. // Version specifies the application version.
  15. Version string
  16. // Stats holds all stats buckets computed within this payload.
  17. Stats []statsBucket
  18. }
  19. // statsBucket specifies a set of stats computed over a duration.
  20. type statsBucket struct {
  21. // Start specifies the beginning of this bucket.
  22. Start uint64
  23. // Duration specifies the duration of this bucket.
  24. Duration uint64
  25. // Stats contains a set of statistics computed for the duration of this bucket.
  26. Stats []groupedStats
  27. }
  28. // groupedStats contains a set of statistics grouped under various aggregation keys.
  29. type groupedStats struct {
  30. // These fields indicate the properties under which the stats were aggregated.
  31. Service string `json:"service,omitempty"`
  32. Name string `json:"name,omitempty"`
  33. Resource string `json:"resource,omitempty"`
  34. HTTPStatusCode uint32 `json:"HTTP_status_code,omitempty"`
  35. Type string `json:"type,omitempty"`
  36. DBType string `json:"DB_type,omitempty"`
  37. // These fields specify the stats for the above aggregation.
  38. Hits uint64 `json:"hits,omitempty"`
  39. Errors uint64 `json:"errors,omitempty"`
  40. Duration uint64 `json:"duration,omitempty"`
  41. OkSummary []byte `json:"okSummary,omitempty"`
  42. ErrorSummary []byte `json:"errorSummary,omitempty"`
  43. Synthetics bool `json:"synthetics,omitempty"`
  44. TopLevelHits uint64 `json:"topLevelHits,omitempty"`
  45. }