Several types of statistics are provided by goappmonitor, Counter、Gauge、GaugeFloat64、Meter、Histogram、Timer、Health。The meaning of statistics, see Synonyms atjava-metrics。
A counter is just a gauge for an AtomicLong instance. You can increment or decrement its value.
- Interface: Counter(name string, value int64)
- Parameter: name - counter name; value - initial value
- example:
Counter("counterSize", int64(0))
- Interface: DecCounter(name string, value int64)
- Parameter: name - counter name; value - initial value
- example:
DecCounter("counterSize", int64(1))
- Interface: IncCounter(name string, value int64)
- Parameter: name - counter name; value - initial value
- example:
IncCounter("counterSize", int64(2))
- Interface: GetCounter(name string) int64
- Parameter: name - counter name
- example:
counterSize := GetCounter("counterSize")
A gauge is an instantaneous measurement of a value(int64).
- Interface: Gauge(name string, value int64)
- Parameter: name - gauge name; value - initial value
- example:
Gauge("queueSize", int64(100))
- Interface: SetGauge(name string, value float64)
- Parameter: name - gauge name; value - initial value
- example:
SetGauge("queueSize", float64(18))
- Interface: GetGauge(name string) float64
- Parameter: name - gauge name
- example:
queueSize := GetGauge("queueSize")
A gauge is an instantaneous measurement of a value(float64).
- Interface: Gauge(name string, value float64)
- Parameter: name - gauge name; value - initial value
- example:
GaugeFloat64("queueSize", float64(100.00))
- Interface: SetGauge(name string, value float64)
- Parameter: name - gauge name; value - initial value
- example:
SetGauge("queueSize", float64(18.0))
- Interface: GetGauge(name string) float64
- Parameter: name - gauge name
- example:
queueSize := GetGauge("queueSize")
A meter measures the rate of events over time (e.g., “requests per second”). In addition to the mean rate, meters also track 1-, 5-, and 15-minute moving averages.
- Interface: Meter(name string, value int64)
- Parameter: value - the number of events that occurred
- example:
Meter("pageView", int64(1))
- Interface: SetMeter(name string, value int64)
- Parameter: name - meter name;value - the number of events that occurred
- example:
SetMeter("pageView", int64(1))
- Interface: GetMeter(name string) int64
- Parameter: name - meter name;value - the number of events that occurred
- example:
pvSum := GetMeter("pageView")
- Interface: GetMeterRateStep(name string) float64
- Parameter: name - meter name
- example:
pageRateStep := GetMeterRateStep("pageView")
- Interface: GetMeterRateMean(name string) float64
- Parameter: name - meter name
- example:
pageRateMean := GetMeterRateMean("pageView")
- Interface: GetMeterRate1(name string) float64
- Parameter: name - meter name
- example:
pageRate1 := GetMeterRate1("pageView")
- Interface: GetMeterRate5(name string) float64
- Parameter: name - meter name
- example:
pageRate5 := GetMeterRate5("pageView")
- Interface: GetMeterRate15(name string) float64
- Parameter: name - meter name
- example:
pageRate15 := GetMeterRate15("pageView")
A histogram measures the statistical distribution of values in a stream of data. In addition to minimum, maximum, mean, etc., it also measures median, 75th, 90th, 95th, 98th, 99th, and 99.9th percentiles.
- Interface: Histogram(name string, value int64)
- Parameter: name - histogram name;value - the value of the current sampling point is recorded.
- example:
Histogram("processNum", int64(1))
- Interface: SetHistogram(name string, value int64)
- Parameter: name - histogram name;value - the value of the current sampling point is recorded.
- example:
SetHistogram("processNum", int64(1))
- Interface: GetHistogram(name string) int64
- Parameter: name - histogram name
- example:
processNum := GetHistogram("processNum")
- Interface: GetHistogramMax(name string) float64
- Parameter: name - histogram name
- example:
processNumMax := GetHistogramMax("processNum")
- Interface: GetHistogramMin(name string) float64
- Parameter: name - histogram name
- example:
processNumMin := GetHistogramMin("processNum")
- Interface: GetHistogramSum(name string) float64
- Parameter: name - histogram name
- example:
processNumSum := GetHistogramSum("processNum")
- Interface: GetHistogramMean(name string) float64
- Parameter: name - histogram name
- example:
processNumMean := GetHistogramMean("processNum")
- Interface: GetHistogramStdDev(name string) float64
- Parameter: name - histogram name
- example:
processNumStdDev := GetHistogramStdDev("processNum")
- Interface: GetHistogram50th(name string) float64
- Parameter: name - histogram name
- example:
processNum50th := GetHistogram50th("processNum")
- Interface: GetHistogram75th(name string) float64
- Parameter: name - histogram name
- example:
processNum75th := GetHistogram75th("processNum")
- Interface: GetHistogram95th(name string) float64
- Parameter: name - histogram name
- example:
processNum95th := GetHistogram95th("processNum")
- Interface: GetHistogram99th(name string) float64
- Parameter: name - histogram name
- example:
processNum99th := GetHistogram99th("processNum")
- Interface: GetHistogram999th(name string) float64
- Parameter: name - histogram name
- example:
processNum999th := GetHistogram999th("processNum")