exporter

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelName              = "name"
	LabelResource          = "resource"
	LabelType              = "type"
	LabelAppID             = "app_id"
	LabelAppInstallationID = "app_installation_id"
)
View Source
const FileCredentialFileName = "credentials.yml"

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Types

type AppCredential

type AppCredential struct {
	ID             int64  `yaml:"appId"`
	InstallationID int64  `yaml:"installationId"`
	Key            string `yaml:"key"`
}

type Collector

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

func NewCollector

func NewCollector(p CollectorParams) *Collector

func (*Collector) Collect added in v0.2.0

func (c *Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Describe added in v0.2.0

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

func (*Collector) Shutdown added in v0.2.0

func (c *Collector) Shutdown()

type CollectorParams

type CollectorParams struct {
	fx.In

	Interval     *Interval
	Credentials  []*Credential
	Instrumenter Instrumenter
	Factory      RateLimitsServiceFactory
	Log          logger.Logger
}

type Credential

type Credential struct {
	Type           Type `yaml:"type"`
	AppName        string
	*AppCredential `yaml:",inline"`
	*PAT           `yaml:",inline"`
}

func (*Credential) Base64PrivateKey

func (c *Credential) Base64PrivateKey() string

func (*Credential) ID

func (c *Credential) ID() int64

func (*Credential) InstallationID

func (c *Credential) InstallationID() int64

func (*Credential) Kind

func (c *Credential) Kind() string

func (*Credential) Name

func (c *Credential) Name() string

func (*Credential) Token

func (c *Credential) Token() string

type CredentialSource

type CredentialSource interface {
	Credentials() []*Credential
}

type FileCredentialSource

type FileCredentialSource struct {
	Data map[string]*Credential
}

func NewFileCredentialSource

func NewFileCredentialSource(fs *afero.Afero) (*FileCredentialSource, error)

func (*FileCredentialSource) Credentials

func (src *FileCredentialSource) Credentials() []*Credential

func (*FileCredentialSource) UnmarshalYAML

func (src *FileCredentialSource) UnmarshalYAML(root *yaml.Node) error

type HttpClientWithAppFactory

type HttpClientWithAppFactory func(github.App) (*http.Client, error)

type HttpClientWithPATFactory

type HttpClientWithPATFactory func(context.Context, github.PAT) *http.Client

type Instrumenter

type Instrumenter interface {
	Instrument(*http.Client)
}

type Interval

type Interval int64

type MetricsHandler

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

func NewMetricsHandler

func NewMetricsHandler(c *Collector, r *prometheus.Registry) *MetricsHandler

func (*MetricsHandler) ServeHTTP

func (h *MetricsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type PAT

type PAT struct {
	Token string `yaml:"token"`
}

type RateLimitsService

type RateLimitsService interface {
	RateLimits(context.Context) ([]*github.RateLimit, error)
}

type RateLimitsServiceFactory

type RateLimitsServiceFactory interface {
	Create(context.Context, *Credential) (RateLimitsService, error)
}

type RateLimitsServiceFactoryParams

type RateLimitsServiceFactoryParams struct {
	fx.In

	Instrumenter             Instrumenter
	HttpClientWithPATFactory HttpClientWithPATFactory
	HttpClientWithAppFactory HttpClientWithAppFactory
}

type Type

type Type string
const (
	GitHubApp Type = "gh-app"
	GitHubPAT Type = "gh-pat"
)

Jump to

Keyboard shortcuts

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