collector

package
v0.0.0-...-fab771a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Scrapers = map[Scraper]bool{
		ScrapeRum{}:    true,
		ScrapeStacks{}: true,
	}
)

Functions

func Name

func Name() string

Types

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Exporter

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

func New

func New(opts *PulumiServiceOpts, metrics Metrics, scrapers []Scraper, logger log.Logger) (*Exporter, error)

func (*Exporter) Collect

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

Collect implements prometheus.Collector.

func (*Exporter) Describe

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

type Metrics

type Metrics struct {
	TotalScrapes    prometheus.Counter
	ScrapeErrors    *prometheus.CounterVec
	Error           prometheus.Gauge
	PulumiServiceUp 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 PulumiServiceClient

type PulumiServiceClient struct {
	Client *http.Client
	Opts   *PulumiServiceOpts
}

func (*PulumiServiceClient) Ping

func (h *PulumiServiceClient) Ping() (bool, error)

type PulumiServiceOpts

type PulumiServiceOpts struct {
	Url         string
	AccessToken string
	UA          string
	Timeout     time.Duration
	Insecure    bool
	Org         string
}

func (*PulumiServiceOpts) AddFlag

func (o *PulumiServiceOpts) AddFlag()

use after set Opts

type ScrapeRum

type ScrapeRum struct{}

func (ScrapeRum) Help

func (ScrapeRum) Help() string

Help describes the role of the Scraper.

func (ScrapeRum) Name

func (ScrapeRum) Name() string

Name of the Scraper. Should be unique.

func (ScrapeRum) Scrape

func (ScrapeRum) Scrape(client *PulumiServiceClient, ch chan<- prometheus.Metric) error

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

type ScrapeStacks

type ScrapeStacks struct{}

func (ScrapeStacks) Help

func (ScrapeStacks) Help() string

Help describes the role of the Scraper.

func (ScrapeStacks) Name

func (ScrapeStacks) Name() string

Name of the Scraper. Should be unique.

func (ScrapeStacks) Scrape

func (ScrapeStacks) Scrape(client *PulumiServiceClient, ch chan<- prometheus.Metric) error

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

type Scraper

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

	// Help describes the role of the Scraper.
	// Example: "Resources under management for an org."
	Help() string

	// Scrape collects data from client and sends it over channel as prometheus metric.
	Scrape(client *PulumiServiceClient, ch chan<- prometheus.Metric) error
}

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

type Stack

type Stack struct {
	OrgName       string `json:"orgName"`
	ProjectName   string `json:"projectName"`
	StackName     string `json:"stackName"`
	LastUpdate    int    `json:"lastUpdate"`
	ResourceCount int    `json:"resourceCount"`
}

type Summary

type Summary struct {
	Year      int `json:"year"`
	Month     int `json:"month"`
	Day       int `json:"day"`
	Hour      int `json:"hour"`
	Resources int `json:"resources"`
}

Jump to

Keyboard shortcuts

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