metrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareDB

func PrepareDB(uri string, table string, orgs []string) (*sql.DB, error)

PrepareDB performs the necessary operations to send metrics to a postgres database.

Types

type Collector

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

Collector is an implementation of gitcollector.MetricsCollector

func NewCollector

func NewCollector(opts *CollectorOpts) *Collector

NewCollector builds a new Collector.

func (*Collector) Discover

func (c *Collector) Discover(job gitcollector.Job)

Discover implements the gitcollector.MetricsCollector interface.

func (*Collector) Fail

func (c *Collector) Fail(job gitcollector.Job)

Fail implements the gitcollector.MetricsCollector interface.

func (*Collector) Start

func (c *Collector) Start()

Start implements the gitcollector.MetricsCollector interface.

func (*Collector) Stop

func (c *Collector) Stop(immediate bool)

Stop implements the gitcollector.MetricsCollector interface.

func (*Collector) Success

func (c *Collector) Success(job gitcollector.Job)

Success implements the gitcollector.MetricsCollector interface.

type CollectorByOrg

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

CollectorByOrg plays as a reverse proxy Collector for several organizations.

func NewCollectorByOrg

func NewCollectorByOrg(orgsMetrics map[string]*Collector) *CollectorByOrg

NewCollectorByOrg builds a new CollectorByOrg.

func (*CollectorByOrg) Discover

func (c *CollectorByOrg) Discover(job gitcollector.Job)

Discover implements the gitcollector.MetricsCollector interface.

func (*CollectorByOrg) Fail

func (c *CollectorByOrg) Fail(job gitcollector.Job)

Fail implements the gitcollector.MetricsCollector interface.

func (*CollectorByOrg) Start

func (c *CollectorByOrg) Start()

Start implements the gitcollector.MetricsCollector interface.

func (*CollectorByOrg) Stop

func (c *CollectorByOrg) Stop(immediate bool)

Stop implements the gitcollector.MetricsCollector interface.

func (*CollectorByOrg) Success

func (c *CollectorByOrg) Success(job gitcollector.Job)

Success implements the gitcollector.MetricsCollector interface.

type CollectorOpts

type CollectorOpts struct {
	BatchSize int
	SyncTime  time.Duration
	Log       log.Logger
	Send      SendFn
}

CollectorOpts represenst configuration options for a Collector.

type SendFn

type SendFn func(context.Context, *Collector, *library.Job) error

SendFn is the function a Collector will use to export metrics.

func SendToDB

func SendToDB(db *sql.DB, table, org string) SendFn

SendToDB is a SendFn to persist metrics on a database.

Jump to

Keyboard shortcuts

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