exporter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const RateLimitExceededStatus = "403 rate limit exceeded"

RateLimitExceededStatus is the status response from github when the rate limit is exceeded.

Variables

This section is empty.

Functions

func AddMetrics

func AddMetrics() map[string]*prometheus.Desc

AddMetrics - Add's all of the metrics to a map of strings, returns the map.

Types

type Asset

type Asset struct {
	Name      string `json:"name"`
	Size      int64  `json:"size"`
	Downloads int32  `json:"download_count"`
	CreatedAt string `json:"created_at"`
}

type Data

type Data []Datum

Data is used to store an array of Datums. This is useful for the JSON array detection

type Datum

type Datum struct {
	Name  string `json:"name"`
	Owner struct {
		Login string `json:"login"`
	} `json:"owner"`
	License struct {
		Key string `json:"key"`
	} `json:"license"`
	Language   string  `json:"language"`
	Archived   bool    `json:"archived"`
	Private    bool    `json:"private"`
	Fork       bool    `json:"fork"`
	Forks      float64 `json:"forks"`
	Stars      float64 `json:"stargazers_count"`
	OpenIssues float64 `json:"open_issues"`
	Watchers   float64 `json:"subscribers_count"`
	Size       float64 `json:"size"`
	Releases   []Release
	Pulls      []Pull
}

Datum is used to store data from all the relevant endpoints in the API

type Exporter

type Exporter struct {
	APIMetrics map[string]*prometheus.Desc
	config.Config
}

Exporter is used to store Metrics data and embeds the config struct. This is done so that the relevant functions have easy access to the user defined runtime configuration when the Collect method is called.

func (*Exporter) Collect

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

Collect function, called on by Prometheus Client library This function is called when a scrape is peformed on the /metrics page

func (*Exporter) Describe

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

Describe - loops through the API metrics and passes them to prometheus.Describe

type Pull

type Pull struct {
	Url  string `json:"url"`
	User struct {
		Login string `json:"login"`
	} `json:"user"`
}

type RateLimits

type RateLimits struct {
	Limit     float64
	Remaining float64
	Reset     float64
}

RateLimits is used to store rate limit data into a struct This data is later represented as a metric, captured at the end of a scrape

type Release

type Release struct {
	Name   string  `json:"name"`
	Assets []Asset `json:"assets"`
	Tag    string  `json:"tag_name"`
}

type Response

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

Response struct is used to store http.Response and associated data

Jump to

Keyboard shortcuts

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