promlib

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

README

promlib

Prometheus Library (a.k.a. promlib) is the foundation of the Grafana Prometheus data source backend.

How to tag/version?
  • Checkout the commit you want to tag (git checkout <COMMIT_SHA>)
  • Run git tag pkg/promlib/<VERSION> (For example git tag pkg/promlib/v0.0.12)
    • NOTE: We're using Lightweight Tags, so no other options are required
  • Run git push origin pkg/promlib/<VERSION>
  • Verify that the tag was created successfully here
  • DO NOT RELEASE anything! Tagging is enough.
  • After tagging and waiting 5-10 minutes for go module registry to catch up just bump the promlib version on grafana/grafana
    • Bumping the version on grafana/grafana is not necessary as grafana/grafana is using the local version of it always.
    • But it is a good practice to do it.

Documentation

Index

Constants

View Source
const (
	KindPrometheus = "Prometheus"
	KindMimir      = "Mimir"
)

Variables

View Source
var (
	ErrNoBuildInfo = errors.New("no build info")
)

Functions

func ConvertAPIError

func ConvertAPIError(err error) error

func IsAPIError

func IsAPIError(err error) bool

IsAPIError returns whether err is or wraps a Prometheus error.

Types

type BuildInfoRequest

type BuildInfoRequest struct {
	PluginContext backend.PluginContext
}

type BuildInfoResponse

type BuildInfoResponse struct {
	Status string                `json:"status"`
	Data   BuildInfoResponseData `json:"data"`
}

type BuildInfoResponseData

type BuildInfoResponseData struct {
	Version   string            `json:"version"`
	Revision  string            `json:"revision"`
	Branch    string            `json:"branch"`
	Features  map[string]string `json:"features"`
	BuildUser string            `json:"buildUser"`
	BuildDate string            `json:"buildDate"`
	GoVersion string            `json:"goVersion"`
}

type ExtendOptions

type ExtendOptions func(ctx context.Context, settings backend.DataSourceInstanceSettings, clientOpts *sdkhttpclient.Options) error

type Features

type Features struct {
	RulerApiEnabled bool `json:"rulerApiEnabled"`
}

type Heuristics

type Heuristics struct {
	Application string   `json:"application"`
	Features    Features `json:"features"`
}

type HeuristicsRequest

type HeuristicsRequest struct {
	PluginContext backend.PluginContext
}

type Service

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

func NewService

func NewService(httpClientProvider *sdkhttpclient.Provider, plog log.Logger, extendOptions ExtendOptions) *Service

func (*Service) CallResource

func (*Service) CheckHealth

func (*Service) GetBuildInfo

func (s *Service) GetBuildInfo(ctx context.Context, req BuildInfoRequest) (*BuildInfoResponse, error)

func (*Service) GetHeuristics

func (s *Service) GetHeuristics(ctx context.Context, req HeuristicsRequest) (*Heuristics, error)

func (*Service) QueryData

Directories

Path Synopsis
Package intervalv2 partially copied from https://github.com/grafana/grafana/blob/main/pkg/tsdb/intervalv2/intervalv2.go
Package intervalv2 partially copied from https://github.com/grafana/grafana/blob/main/pkg/tsdb/intervalv2/intervalv2.go

Jump to

Keyboard shortcuts

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