Documentation
¶
Index ¶
- func Hash(value string) string
- func IdentifySend(sw *Service, startup bool)
- type MemoryStatistics
- type Options
- type Service
- func (sw *Service) Close() error
- func (sw *Service) Identify()
- func (sw *Service) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
- func (sw *Service) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func (sw *Service) Track()
- func (sw *Service) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdentifySend ¶ added in v0.0.556
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 ¶ added in v0.0.38
type Options struct {
// Service represents the service name, for example "ory-hydra".
Service string
// DeploymentId represents the cluster id, typically a hash of some unique configuration properties.
DeploymentId string
DBDialect string
// When this instance was started
StartTime time.Time
// 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 ¶ added in v0.0.38
type Service struct {
// contains filtered or unexported fields
}
Service helps with providing context on metrics.
func New ¶ added in v0.0.38
New returns a new metrics service. If one has been instantiated already, no new instance will be created.
func (*Service) Identify ¶ added in v0.0.38
func (sw *Service) Identify()
Identify enables reporting to segment.
func (*Service) ServeHTTP ¶ added in v0.0.38
func (sw *Service) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP is a middleware for sending meta information to segment.
func (*Service) StreamInterceptor ¶ added in v0.0.287
func (sw *Service) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func (*Service) Track ¶ added in v0.0.556
func (sw *Service) Track()
Track commits memory statistics to segment.
func (*Service) UnaryInterceptor ¶ added in v0.0.287
func (sw *Service) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.