Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemoryStatistics ¶
type MemoryStatistics struct { sync.Mutex // Alloc is bytes of allocated heap objects. Alloc uint64 `json:"alloc"` // TotalAlloc is cumulative bytes allocated for heap objects. TotalAlloc uint64 `json:"totalAlloc"` // Sys is the total bytes of memory obtained from the OS. Sys uint64 `json:"sys"` // Lookups is the number of pointer lookups performed by the // runtime. Lookups uint64 `json:"lookups"` // Mallocs is the cumulative count of heap objects allocated. // The number of live objects is Mallocs - Frees. Mallocs uint64 `json:"mallocs"` // Frees is the cumulative count of heap objects freed. Frees uint64 `json:"frees"` // HeapAlloc is bytes of allocated heap objects. HeapAlloc uint64 `json:"heapAlloc"` // HeapSys is bytes of heap memory obtained from the OS. HeapSys uint64 `json:"heapSys"` // HeapIdle is bytes in idle (unused) spans. HeapIdle uint64 `json:"heapIdle"` // HeapInuse is bytes in in-use spans. HeapInuse uint64 `json:"heapInuse"` // HeapReleased is bytes of physical memory returned to the OS. HeapReleased uint64 `json:"heapReleased"` // HeapObjects is the number of allocated heap objects. HeapObjects uint64 `json:"heapObjects"` // NumGC is the number of completed GC cycles. NumGC uint32 `json:"numGC"` }
MemoryStatistics is a JSON-able version of runtime.MemStats
func (*MemoryStatistics) ToMap ¶
func (ms *MemoryStatistics) ToMap() map[string]interface{}
ToMap converts to a map[string]interface{}.
func (*MemoryStatistics) Update ¶
func (ms *MemoryStatistics) Update()
Update takes the most recent stats from runtime.
type Options ¶
type Options struct { // Service represents the service name, for example "ory-hydra". Service string // ClusterID represents the cluster id, typically a hash of some unique configuration properties. ClusterID string // IsDevelopment should be true if we assume that we're in a development environment. IsDevelopment bool // WriteKey is the segment API key. WriteKey string // WhitelistedPaths represents a list of paths that can be transmitted in clear text to segment. WhitelistedPaths []string // BuildVersion represents the build version. BuildVersion string // BuildHash represents the build git hash. BuildHash string // BuildTime represents the build time. BuildTime string // Config overrides the analytics.Config. If nil, sensible defaults will be used. Config *analytics.Config // MemoryInterval sets how often memory statistics should be transmitted. Defaults to every 12 hours. MemoryInterval time.Duration }
Options configures the metrics service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service helps with providing context on metrics.
func New ¶
New returns a new metrics service. If one has been instantiated already, no new instance will be created.
func (*Service) ObserveMemory ¶
func (sw *Service) ObserveMemory()
ObserveMemory commits memory statistics to segment.
func (*Service) ServeHTTP ¶
func (sw *Service) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP is a middleware for sending meta information to segment.
Click to show internal directories.
Click to hide internal directories.