grafana

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Dashboard interface{} `json:"dashboard"`
	Overwrite bool        `json:"overwrite"`
	FolderID  int         `json:"folderId,omitempty"`
}

CreateRequest models parameters required for creating/updating dashboard

func NewCreateRequest

func NewCreateRequest(folderID int) *CreateRequest

NewCreateRequest returns a new create request model

type CreateResponse

type CreateResponse struct {
	ID      int    `json:"id"`
	UID     string `json:"uid"`
	URL     string `json:"url"`
	Status  string `json:"status"`
	Version int    `json:"version"`
}

CreateResponse models response from grafana for creating/updating dashboard

type Item

type Item struct {
	Key        string
	RetryCount int
	ProcessAt  time.Time
}

Item defines a struct that the PriorityQueue consumes

type PriorityQueue

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

PriorityQueue defines a thread safe priority queue

func NewPriorityQueue

func NewPriorityQueue() *PriorityQueue

NewPriorityQueue creates a new priority queue

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() *Item

Pop returns the lowest priority item from the queue

func (*PriorityQueue) PopConditionally

func (pq *PriorityQueue) PopConditionally(f func(*Item) bool) *Item

PopConditionally pods an item if the given condition is met

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(item *Item)

Push pushes a new item to priority queue with a given value and priority

func (*PriorityQueue) Size

func (pq *PriorityQueue) Size() int

Size returns the current size of the priority queue

type Service

type Service interface {
	SetupCleanerJob(ctx context.Context) error
	CreateDashboard(*CreateRequest) (*CreateResponse, error)
	DeleteDashboard(string) error
}

Service exposes methods to handle grafana dashboards

func NewService

func NewService(cfg *config.Config) Service

NewService returns a new service with default implementations for grafana service It also starts the cleaner job if cleaup is enabled in the configuration

Jump to

Keyboard shortcuts

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