exporter

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	WebConfig     string
	ListenAddress string
	MetricsPath   string

	Logger log.Logger

	model.TimeEntryRepository
	model.ProjectRepository
	// contains filtered or unexported fields
}

Exporter collects Toggl stats from toggl API Response and exports them using the prometheus metrics package.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect fetches the stats from Toggl API Responce and delivers them as Prometheus metrics. It implements prometheus.Collector.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe describes all the metrics ever exported by the toggl exporter. It implements prometheus.Collector.

func (*Exporter) GetProjectDurations

func (e *Exporter) GetProjectDurations(ctx context.Context) ([]ProjectTimeDuration, error)

GetProjectDurations get time entries and calculate sum of time grouped by the project.

func (*Exporter) ListenAndServe

func (e *Exporter) ListenAndServe() error

ListenAndServe listens on the TCP network address congured address and then calls Serve to handle requests on incoming connections.

type ProjectTimeDuration

type ProjectTimeDuration struct {
	Pid         int
	ProjectName string
	Duration    time.Duration
	Year        string
	Month       string
}

ProjectTimeDuration is sum of time entry grouped by the project.

Jump to

Keyboard shortcuts

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