exporter

package
v0.0.0-...-5b17345 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 16 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.

Types

type AccountInfo

type AccountInfo struct {
	DisplayName  string            `json:"displayName"`
	TimeZone     string            `json:"timeZone"`
	AccountId    string            `json:"accountId"`
	AccountType  string            `json:"accountType"`
	Self         string            `json:"self"`
	AvatarURLs   map[string]string `json:"avatarUrls"`
	Active       bool              `json:"active"`
	EmailAddrees string            `json:"emailAddress"`
}

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 {
	Issues []Issue
}

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 Field

type Field struct {
	Summary   string               `json:"summary"`
	Status    Status               `json:"status"`
	Priority  Priority             `json:"priority"`
	IssueType IssueTypeDescription `json:"issuetype"`
	Project   ProjectInfo          `json:"project"`
	Creator   AccountInfo          `json:"creator"`
	Assignee  AccountInfo          `json:"assignee"`
	Reporter  AccountInfo          `json:"reporter"`
}

type Issue

type Issue struct {
	Expand string      `json:"expand"`
	Id     string      `json:id`
	Self   string      `json:"self"`
	Key    string      `json:"key"`
	Fields Field       `json:"fields"`
	Parent interface{} `json:"parent"`
}

type IssueCounter

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

type IssueFilter

type IssueFilter struct {
	IssueType string
}

func (IssueFilter) Filter

func (f IssueFilter) Filter(issues []Issue) (ret []Issue)

type IssueTypeDescription

type IssueTypeDescription struct {
	Self           string `json:"self"`
	Id             string `json:"id"`
	Description    string `json:"description"`
	IconURL        string `json:"iconUrl"`
	Name           string `json:"name"`
	Subtask        bool   `json:"subtask"`
	AvatarId       int    `json:"avatarId"`
	EntityId       string `json:"entityId"`
	HeirarchyLevel int    `json:"hierarchyLevel"`
}

Example

"issuetype": {
  "self": "https://benri.atlassian.net/rest/api/3/issuetype/10007",
  "id": "10007",
  "description": "Subtasks track small pieces of work that are part of a larger task.",
  "iconUrl": "https://benri.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10316?size=medium",
  "name": "Subtask",
  "subtask": true,
  "avatarId": 10316,
  "entityId": "2c4923b2-0754-499c-ab8e-0d1fefa20d99",
  "hierarchyLevel": -1
},

type JQLRequest

type JQLRequest struct {
	JQL          string   `json:"jql"`
	MaxResults   int      `json:"maxResults"`
	FieldsByKeys bool     `json:"fieldsByKeys"`
	Fields       []string `json:"fields"`
	StartAt      int      `json:"startAt"`
}

type PostRequest

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

type Priority

type Priority struct {
	Self    string `json:"self"`
	Name    string `json:"name"`
	Id      string `json:"id"`
	IconURL string `json:"iconUrl"`
}

type Project

type Project struct {
	Name string `json:"name"`
}

type ProjectCategoryInfo

type ProjectCategoryInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Self        string `json:"self"`
	Id          string `json:"id"`
}

type ProjectInfo

type ProjectInfo struct {
	Name            string              `json:"name"`
	Self            string              `json:"self"`
	ProjectTypeKey  string              `json:"projectTypeKey"`
	Simplified      bool                `json:"simplified"`
	Key             string              `json"key`
	AvatarURLs      map[string]string   `json:"avatarUrls"`
	ProjectCategory ProjectCategoryInfo `json:"projectCategory"`
	Id              string              `json:"id"`
}

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 Response

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

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

type SearchResponse

type SearchResponse struct {
	Expand     string  `json:"expand"`
	StartAt    int     `json:"startAt"`
	MaxResults int     `json:"maxResults"`
	Total      int     `json:"total"`
	Issues     []Issue `json:"issues"`
}

type Status

type Status struct {
	Self           string         `json:"self"`
	IconURL        string         `json:"iconUrl"`
	Description    string         `json:"description"`
	Name           string         `json:"name"`
	Id             string         `json:"id"`
	StatusCategory StatusCategory `json:"statusCategory"`
}

type StatusCategory

type StatusCategory struct {
	Self      string `json:"self"`
	Id        int    `json:"id"`
	Key       string `json:"key"`
	ColorName string `json:"colorName"`
	Name      string `json:"name"`
}

Jump to

Keyboard shortcuts

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