collector

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package collector includes all individual collectors to gather and export system metrics.

Index

Constants

This section is empty.

Variables

View Source
var (
	WorkspacesTotal = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, workspacesSubsystem, "total"),
		"Total number of existing workspaces.",
		[]string{}, nil,
	)
	WorkspacesInfo = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, workspacesSubsystem, "info"),
		"Information about existing workspaces",
		[]string{"id", "name", "organization", "terraform_version", "created_at", "environment", "current_run", "current_run_status", "current_run_created_at"}, nil,
	)
)

Metric descriptors.

View Source
var (
	// scrapers lists all possible collection methods.
	Scrapers = []Scraper{}
)

Functions

This section is empty.

Types

type Exporter

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

Exporter collects TF metrics. It implements the prometheus.Collector interface.

func New

func New(ctx context.Context, config *setup.Config, metrics Metrics) *Exporter

New returns a new Terraform API exporter for the provided Config.

func (*Exporter) Collect

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

Collect implements the prometheus.Collector interface.

func (*Exporter) Describe

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

Describe implements the prometheus.Collector interface.

type Metrics

type Metrics struct {
	TotalScrapes prometheus.Counter
	ScrapeErrors *prometheus.CounterVec
	Error        prometheus.Gauge
}

Metrics represents exporter metrics which values can be carried between http requests.

func NewMetrics

func NewMetrics() Metrics

NewMetrics creates new Metrics instance.

type ScrapeWorkspaces

type ScrapeWorkspaces struct{}

ScrapeWorkspaces scrapes metrics about the workspaces.

func (ScrapeWorkspaces) Help

func (ScrapeWorkspaces) Help() string

Help describes the role of the Scraper.

func (ScrapeWorkspaces) Name

func (ScrapeWorkspaces) Name() string

Name of the Scraper. Should be unique.

func (ScrapeWorkspaces) Scrape

func (ScrapeWorkspaces) Scrape(ctx context.Context, config *setup.Config, ch chan<- prometheus.Metric) error

Scrape collects data from Terraform API and sends it over channel as prometheus metric.

func (ScrapeWorkspaces) Version

func (ScrapeWorkspaces) Version() string

Version of Terraform Cloud/Enterprise API from which scraper is available.

type Scraper

type Scraper interface {
	// Name of the Scraper. Should be unique.
	Name() string

	// Help describes the role of the Scraper.
	// Example: "Collect Workspaces"
	Help() string

	// Version of Terraform Cloud/Enterprise API from which scraper is available.
	Version() string

	// Scrape collects data from a particular terraform cloud/enterprise API and sends it over channel as prometheus metric.
	Scrape(ctx context.Context, config *setup.Config, ch chan<- prometheus.Metric) error
}

Scraper is minimal interface that let's you add new prometheus metrics to tf_exporter.

Jump to

Keyboard shortcuts

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