runtimestats

package module
v0.0.0-...-66aa699 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: MIT Imports: 6 Imported by: 0

README

go-runtime-stats

A tiny library to publish Golang runtime stats to Grafana (with or without InfluxDB tags)

FOSSA Status

GitHub license

Build Status

Maintainability

Usage;

package main

import "github.com/tushar2708/go-runtime-stats"

func main(){
	runtimestats.Start("statsd-host:8125", "app_name.app_env", 5, "tag1", "value1", "tag2", "value2")
}

Metrics exported;

Metric Source Description Unit
cgo.calls runtime.NumCgoCall() Number of Cgo Calls calls per second
gc.pauseTimeMs runtime.ReadMemStats Pause time of last GC run MS
gc.pauseTimeNs runtime.ReadMemStats Pause time of last GC run NS
gc.period runtime.ReadMemStats Time between last two GC runs MS
gc.perSecond runtime.ReadMemStats Number of GCs per second runs per second
goroutines.total runtime.NumGoroutine() Number of currently running goroutines total
memory.counters.Frees runtime.ReadMemStats.Frees Number of frees issued to the system frees per second
memory.counters.Mallocs runtime.ReadMemStats.Mallocs Number of Mallocs issued to the system mallocs per second
memory.heap.Idle runtime.ReadMemStats.HeapIdle Memory on the heap not in use bytes
memory.heap.InUse runtime.ReadMemStats.HeapInuse Memory on the heap in use bytes
memory.objects.HeapObjects runtime.ReadMemStats.HeapObjects Total objects on the heap # Objects
memory.summary.Alloc runtime.ReadMemStats.Alloc Total bytes allocated bytes
memory.summary.System runtime.ReadMemStats.HeapSys Total bytes acquired from system bytes

License

FOSSA Status

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuntimeStats

type RuntimeStats struct {
	StatsdHost   string
	StatsDPrefix string

	MetricesToColllect metrices

	PublishInterval time.Duration
	PublishTicker   *time.Ticker
	// contains filtered or unexported fields
}

RuntimeStats stores thefields requied for stats publihing

func Start

func Start(statsdHost string, statsDPrefix string, publishInterval int, tags ...string) (*RuntimeStats, error)

Start creates a new insnce of NewRuntimeStats andarts themonitoring go-routine to pulish changing stats

func (*RuntimeStats) Stop

func (s *RuntimeStats) Stop()

Stop stops the run-time stats monitor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL