firehose-to-syslog: Index | Files

package stats

import ""

Taken from RakutenTech nozzle Thanks to them


Package Files

stats.go stats_easyjson.go stats_server.go


const (
    // DefaultPort is default port to listen
    DefaultPort = "8080"

    // EnvPort is environmental variable to change port to listen
    EnvPort = "PORT"
const (
    EnvCFInstanceIndex = "CF_INSTANCE_INDEX"

type Server Uses

type Server struct {
    Logger *log.Logger
    Stats  *Stats

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

func (*Server) Start Uses

func (s *Server) Start()

Start starts listening.

type Stats Uses

type Stats struct {
    Consume                uint64 `json:"consume"`
    ConsumePerSec          uint64 `json:"consume_per_sec"`
    ConsumeFail            uint64 `json:"consume_fail"`
    ConsumeHttpStartStop   uint64 `json:"consume_http_start_stop"`
    ConsumeValueMetric     uint64 `json:"consume_value_metric"`
    ConsumeCounterEvent    uint64 `json:"consume_counter_event"`
    ConsumeLogMessage      uint64 `json:"consume_log_message"`
    ConsumeError           uint64 `json:"consume_error"`
    ConsumeContainerMetric uint64 `json:"consume_container_metric"`
    ConsumeUnknown         uint64 `json:"consume_unknown"`
    Ignored                uint64 `json:"ignored"`
    Forwarded              uint64 `json:"forwarded"`

    Publish       uint64 `json:"publish"`
    PublishPerSec uint64 `json:"publish_per_sec"`

    // This is same as the number of dropped message
    PublishFail uint64 `json:"publish_fail"`

    SlowConsumerAlert uint64 `json:"slow_consumer_alert"`

    // SubInputBuffer is used to count number of current
    // buffer on subInput.
    SubInputBuffer int64 `json:"subinupt_buffer"`

    // InstanceID is ID for nozzle instance.
    // This is used to identify stats from different instances.
    // By default, it's defaultInstanceID
    InstanceID int `json:"instance_id"`

Stats stores various stats infomation easyjson:json

func NewStats Uses

func NewStats() *Stats

func (*Stats) Dec Uses

func (s *Stats) Dec(statsType StatsType)

func (*Stats) Inc Uses

func (s *Stats) Inc(statsType StatsType)

func (*Stats) Json Uses

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

func (Stats) MarshalEasyJSON Uses

func (v Stats) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Stats) MarshalJSON Uses

func (v Stats) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Stats) PerSec Uses

func (s *Stats) PerSec()

func (*Stats) UnmarshalEasyJSON Uses

func (v *Stats) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Stats) UnmarshalJSON Uses

func (v *Stats) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type StatsType Uses

type StatsType int
const (
    Consume                StatsType = iota // messages received
    ConsumeFail                             // messages failed to be consumed
    ConsumeHttpStartStop                    // HttpStartStop messages received
    ConsumeValueMetric                      // ValueMetric messages received
    ConsumeCounterEvent                     // CounterEvent messages received
    ConsumeLogMessage                       // LogMessage messages received
    ConsumeError                            // Error messages received
    ConsumeContainerMetric                  // ContainerMetric messages received
    ConsumeUnknown                          // unknown type messages received
    Ignored                                 // messages dropped because of no forwarding rule
    Forwarded                               // messages
    Publish                                 // messages
    PublishFail                             // messages
    SlowConsumerAlert                       // slow consumer alerts emitted by noaa?
    SubInputBuffer                          // messages in buffer

Package stats imports 13 packages (graph) and is imported by 3 packages. Updated 2017-11-18. Refresh now. Tools for package owners.