debug

package
v0.0.0-...-d8c2abc Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvCFInstanceIndex = "CF_INSTANCE_INDEX"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigServer

type ConfigServer struct {
	Port string `default:"8080" desc:"port of http server"` // CFMR_SERVER_PORT
}

type Server

type Server struct {
	Port   string
	Logger *log.Logger
	Stats  *Stats
}

Server is used for various debugging. It opens runtime stats, pprof and appliclation stats.

func NewServer

func NewServer(cs *ConfigServer, stats *Stats, logger *log.Logger) (*Server, error)

Start starts listening.

func (*Server) Start

func (s *Server) Start() *http.Server

type Stats

type Stats struct {
	Consume            uint64    `json:"consume"`
	ConsumePerSec      uint64    `json:"consume_per_sec"`
	Enrich             uint64    `json:"enrich"`
	EnrichPerSec       uint64    `json:"enrich_per_sec"`
	EnrichFail         uint64    `json:"enrichfail"`
	EnrichFailPerSec   uint64    `json:"enrichfail_per_sec"`
	WriteAsync         uint64    `json:"writeasync"`
	WriteAsyncPerSec   uint64    `json:"writeasync_per_sec"`
	Write              uint64    `json:"write"`
	WritePerSec        uint64    `json:"write_per_sec"`
	CFFail             uint64    `json:"cffail"`
	CFFailPerSec       uint64    `json:"cffail_per_sec"`
	LastConsumeTime    time.Time `json:"last_consume_time"`
	LastEnrichTime     time.Time `json:"last_enrich_time"`
	LastEnrichFailTime time.Time `json:"last_enrich_fail_time"`
	LastWriteAsyncTime time.Time `json:"last_writeasync_time"`
	LastWriteTime      time.Time `json:"last_write_time"`
	LastCFFailTime     time.Time `json:"last_cffail_time"`
	// InstanceIndex is the index for cf-metrics-refinery instance.
	// This is used to identify stats from different instances.
	// By default, it's defaultInstanceIndex
	InstanceIndex int `json:"instance_index"`
	// contains filtered or unexported fields
}

Stats stores various stats infomation

func NewStats

func NewStats() *Stats

func (*Stats) Inc

func (s *Stats) Inc(statsType StatsType, value int)

func (*Stats) Json

func (s *Stats) Json() ([]byte, error)

func (*Stats) PerSec

func (s *Stats) PerSec()

type StatsType

type StatsType int
const (
	Consume    StatsType = iota // messages received
	Enrich                      // messages enriched
	EnrichFail                  // messages failed to be enriched
	WriteAsync                  // points added to Influxdb batch
	Write                       // points written to Influxdb
	CFFail                      // CF API lookup failure
)

Jump to

Keyboard shortcuts

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