Help us shape the future of Go! Take the 2026 Go Developer Survey

stats

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Interval float64
	Count    int64
	Percent  float64
}

type HistogramData

type HistogramData struct {
	Count       int64
	Min         float64
	Max         float64
	Sum         float64
	Avg         float64
	StdDev      float64
	Data        []Bucket
	Percentiles []Percentile
}

type Key

type Key string

type KeyMap

type KeyMap map[Key]SubkeyMap

type Metrics

type Metrics struct {
	Type TraceType

	Status5xx int
	Status4xx int
	Status3xx int
	Status2xx int
	Errors    int
	Errors2   int
	// contains filtered or unexported fields
}

func (*Metrics) Add

func (m *Metrics) Add(rtime int64)

func (*Metrics) Count

func (m *Metrics) Count() int

type MetricsMap

type MetricsMap map[TraceType]map[Key]map[Subkey]*Metrics

type Percentile

type Percentile struct {
	Percentile float64
	Value      float64
}

type Report

type Report struct {
	Id            string
	Requestrate   int
	Concurrency   int
	Duration      string
	StartTime     time.Time
	EndTime       time.Time
	NumWorkers    *int `json:",omitempty"`
	Results       []Result
	DigestToQuery map[string]string `json:",omitempty"`
}

type Result

type Result struct {
	Type            string
	Target          string
	SubTarget       string
	AvgRPS          float64
	Histogram       HistogramData
	Status5xx       *int                   `json:",omitempty"`
	Status4xx       *int                   `json:",omitempty"`
	Status3xx       *int                   `json:",omitempty"`
	Status2xx       *int                   `json:",omitempty"`
	Errors          *int                   `json:",omitempty"`
	Errors2         *int                   `json:",omitempty"`
	LatencySnapshot *hdrhistogram.Snapshot `json:"-"`
}

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

func New

func New(id string, requestrate int, concurrency int, duration time.Duration, server bool) *Stats

func (*Stats) Export

func (s *Stats) Export() *Report

func (*Stats) Import

func (s *Stats) Import(report *Report)

func (*Stats) RecordMetric

func (s *Stats) RecordMetric(t *TraceInfo)

func (*Stats) Report

func (s *Stats) Report() string

func (*Stats) Reset

func (s *Stats) Reset()

func (*Stats) ResetMetrics

func (s *Stats) ResetMetrics()

Only reset metrics

func (*Stats) Start

func (s *Stats) Start()

func (*Stats) Stop

func (s *Stats) Stop()

type Subkey

type Subkey string

type SubkeyMap

type SubkeyMap map[Subkey]*Metrics

type TraceInfo

type TraceInfo struct {
	Type             TraceType
	Key              string
	Subkey           string
	Total            time.Duration
	Status           int
	Error            bool
	DeadlineExceeded bool
}

type TraceType

type TraceType string
const (
	HttpTrace       TraceType = "http"
	GrpcTrace       TraceType = "grpc"
	RedisTrace      TraceType = "redis"
	SqlTrace        TraceType = "sql"
	PGTrace         TraceType = "psql"
	CqlTrace        TraceType = "cql"
	ClickHouseTrace TraceType = "clickhouse"
	SmtpTrace       TraceType = "smtp"
	MongoTrace      TraceType = "mongo"
	CustomTrace     TraceType = "custom"
	RawTrace        TraceType = "raw"
)

Jump to

Keyboard shortcuts

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