Documentation ¶
Index ¶
- Variables
- func BoolToBinary(b bool) string
- func DisableDefaultCollectors()
- func FetchHTTP(token string, sslVerify bool, timeout time.Duration, logger log.Logger) func(uri url.URL, subPath string, params url.Values) (io.ReadCloser, error)
- func ReadAndUnmarshal(body io.ReadCloser, object interface{}) error
- type Collector
- func NewAllTimeCollector(in CommonInputs, logger log.Logger) (Collector, error)
- func NewGoalCollector(in CommonInputs, logger log.Logger) (Collector, error)
- func NewLeaderCollector(in CommonInputs, logger log.Logger) (Collector, error)
- func NewSummaryCollector(in CommonInputs, logger log.Logger) (Collector, error)
- type CommonInputs
- type WakaCollector
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
Functions ¶
func DisableDefaultCollectors ¶
func DisableDefaultCollectors()
DisableDefaultCollectors sets the collector state to false for all collectors which have not been explicitly enabled on the command line.
func FetchHTTP ¶
func FetchHTTP(token string, sslVerify bool, timeout time.Duration, logger log.Logger) func(uri url.URL, subPath string, params url.Values) (io.ReadCloser, error)
FetchHTTP is a generic fetch method for Wakatime API endpoints
func ReadAndUnmarshal ¶
func ReadAndUnmarshal(body io.ReadCloser, object interface{}) error
ReadAndUnmarshal reads the JSON response body and unmarshals the response
Types ¶
type Collector ¶
type Collector interface { // Get new metrics and expose them via prometheus registry. Update(ch chan<- prometheus.Metric) error }
Collector is the interface a collector has to implement.
func NewAllTimeCollector ¶
func NewAllTimeCollector(in CommonInputs, logger log.Logger) (Collector, error)
NewAllTimeCollector returns a new Collector exposing all-time stats.
func NewGoalCollector ¶
func NewGoalCollector(in CommonInputs, logger log.Logger) (Collector, error)
NewGoalCollector returns a new Collector exposing all-time stats.
func NewLeaderCollector ¶
func NewLeaderCollector(in CommonInputs, logger log.Logger) (Collector, error)
NewLeaderCollector returns a new Collector exposing all-time stats.
func NewSummaryCollector ¶
func NewSummaryCollector(in CommonInputs, logger log.Logger) (Collector, error)
NewSummaryCollector returns a new Collector exposing all-time stats.
type CommonInputs ¶
type CommonInputs struct { BaseURI url.URL URI url.URL Token string SSLVerify bool Timeout time.Duration }
CommonInputs are the inputs needed to implement any Collector
type WakaCollector ¶
type WakaCollector struct { Collectors map[string]Collector // contains filtered or unexported fields }
WakaCollector implements the prometheus.Collector interface.
func NewWakaCollector ¶
func NewWakaCollector(in CommonInputs, logger log.Logger, filters ...string) (*WakaCollector, error)
NewWakaCollector creates a new Collector.
func (WakaCollector) Collect ¶
func (n WakaCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (WakaCollector) Describe ¶
func (n WakaCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.