prometheus

package module
v0.0.0-...-4b46047 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

ace-datasource-prometheus

Compile-time Prometheus datasource module for Ace.

Ace keeps the datasource contract and registry in github.com/aceobservability/ace/backend/pkg/datasource. This module implements that Client (plus connection test and PromQL metadata). Ace registers the factory at init and injects its SSRF-safe HTTP client — this module does not import Ace internal/ packages and does not construct an unpolicy'd client.

Contract

Surface Package
Query / result types github.com/aceobservability/ace/backend/pkg/datasource
Registry type key prometheus (Type)
Factory New(url string, httpClient *http.Client)

httpClient is required. Ace passes ssrf.DatasourceClient wrapped with stored datasource credentials.

The low-level Prometheus HTTP API client lives in ./promclient (used by Ace's built-in PROMETHEUS_URL handler as well as this adapter).

Tests

go test ./...

Query and connection tests speak to an httptest fixture. No live Prometheus is required.

Documentation

Index

Constants

View Source
const Type = "prometheus"

Type is the RegisterDatasource key Ace uses for this module.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the Ace Prometheus query datasource.

func New

func New(prometheusURL string, httpClient *http.Client) (*Client, error)

New constructs a Prometheus datasource client. httpClient is required so Ace can inject DatasourceClient (dial/redirect policy + auth).

func (*Client) HTTPClient

func (c *Client) HTTPClient() *http.Client

HTTPClient returns the injected HTTP client. Ace SSRF tests inspect policy wiring.

func (*Client) LabelValues

func (c *Client) LabelValues(ctx context.Context, label, metric string) ([]string, error)

func (*Client) Labels

func (c *Client) Labels(ctx context.Context, metric string) ([]string, error)

func (*Client) MetricNames

func (c *Client) MetricNames(ctx context.Context, search string) ([]string, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, start, end time.Time, step time.Duration, limit int) (*datasource.QueryResult, error)

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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