collector

package
v0.0.0-...-9551499 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 12 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 (
	OrganizationsInfo = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, organizationsSubsystem, "info"),
		"Information about existing organizations",
		[]string{"name", "created_at", "email", "external_id", "owners_team_saml_role_id", "saml_enabled", "two_factor_conformant"}, nil,
	)
)

Metric descriptors.

View Source
var (
	// scrapers lists all possible collection methods.
	Scrapers = []Scraper{}
)
View Source
var (
	WorkspacesInfo = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, workspacesSubsystem, "info"),
		"Information about existing workspaces",
		[]string{"id", "name", "organization", "terraform_version", "created_at", "environment", "locked", "current_run", "current_run_status", "current_run_created_at", "tags", "project", "plan_duration_avg", "run_failures", "run_counts", "resource_count"}, nil,
	)
)

Metric descriptors.

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 ScrapeOrganizations

type ScrapeOrganizations struct{}

ScrapeOrganizations scrapes metrics about the organizations.

func (ScrapeOrganizations) Help

func (ScrapeOrganizations) Help() string

Help describes the role of the Scraper.

func (ScrapeOrganizations) Name

func (ScrapeOrganizations) Name() string

Name of the Scraper. Should be unique.

func (ScrapeOrganizations) Scrape

func (ScrapeOrganizations) 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 (ScrapeOrganizations) Version

func (ScrapeOrganizations) Version() string

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

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