prometheus

package
v0.0.0-...-b075127 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultPrometheusTokenDuration = 1 * time.Hour
)

Variables

This section is empty.

Functions

func GetPrometheusToken

func GetPrometheusToken(ctx context.Context, client *openshift.Client) (string, error)

GetPrometheusToken retrieves a token for the prometheus-k8s service account using TokenRequest API. It uses DefaultPrometheusTokenDuration for the token lifetime. For a custom lifetime, use GetPrometheusTokenWithDuration.

This follows openshift/library-go/test/library/metrics/query.go and is the recommended approach for Kubernetes 1.24+.

func GetPrometheusTokenWithDuration

func GetPrometheusTokenWithDuration(ctx context.Context, client *openshift.Client, duration time.Duration) (string, error)

GetPrometheusTokenWithDuration retrieves a token for the prometheus-k8s service account using TokenRequest API, with the requested token lifetime. duration must be at least one second.

Types

type Client

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

func New

func New(ctx context.Context, client *openshift.Client) (*Client, error)

TODO: should we use thanos querier instead?

func (*Client) GetClient

func (c *Client) GetClient() prometheusv1.API

func (*Client) InstantQuery

func (c *Client) InstantQuery(ctx context.Context, query string) (model.Vector, error)

Jump to

Keyboard shortcuts

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