exporter

package
v0.0.0-...-830fd5f Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 13 Imported by: 0

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.

func DateEqual

func DateEqual(date1, date2 time.Time) bool

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 Clone

type Clone struct {
	Count     float64 `json:"count"`
	Uniques   float64 `json:"uniques"`
	Timestamp string  `json:"timestamp"`
}

type Clones

type Clones struct {
	Count   float64 `json:"count"`
	Uniques float64 `json:"uniques"`
	Clones  []Clone `json:"clones"`
}

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
	Clones          Clones
	ReferralPaths   []ReferralPath
	ReferralSources []ReferralSource
	PageViews       PageViews
}

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 PageView

type PageView struct {
	Count     float64 `json:"count"`
	Uniques   float64 `json:"uniques"`
	Timestamp string  `json:"timestamp"`
}

type PageViews

type PageViews struct {
	Count   float64 `json:"count"`
	Uniques float64 `json:"uniques"`
	Views   []PageView
}

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 ReferralPath

type ReferralPath struct {
	Count   float64 `json:"count"`
	Uniques float64 `json:"uniques"`
	Path    string  `json:"path"`
	Title   string  `json:"title"`
}

type ReferralSource

type ReferralSource struct {
	Count    float64 `json:"count"`
	Uniques  float64 `json:"uniques"`
	Referrer string  `json:"referrer"`
}

type Release

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

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