config

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MetricsToolSetName = "metrics"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMode added in v0.1.2

type AuthMode string

AuthMode defines where the bearer token is obtained for authenticating against Prometheus and Alertmanager endpoints.

const (
	// AuthModeHeader reads the bearer token from the request context (authorization header).
	// This is the default.
	AuthModeHeader AuthMode = "header"

	// AuthModeKubeConfig reads the bearer token from the kubeconfig/REST config only.
	AuthModeKubeConfig AuthMode = "kubeconfig"
)

type Config

type Config struct {
	// AuthMode controls where the bearer token is obtained for authenticating
	// against Prometheus and Alertmanager endpoints.
	// Valid values: "header" (default) - read from the request context authorization header,
	//              "kubeconfig" - read from the kubeconfig/REST config.
	AuthMode AuthMode `toml:"auth_mode,omitempty"`
	// PrometheusURL is the URL of the Prometheus/Thanos Querier endpoint.
	// This field is required. Example: "https://thanos-querier-openshift-monitoring.apps.example.com"
	PrometheusURL string `toml:"prometheus_url,omitempty"`

	// AlertmanagerURL is the URL of the Alertmanager endpoint.
	// This field is optional. Example: "https://alertmanager-main-openshift-monitoring.apps.example.com"
	AlertmanagerURL string `toml:"alertmanager_url,omitempty"`

	// Insecure controls whether to skip TLS certificate verification.
	// Default: false (verify certificates)
	Insecure bool `toml:"insecure,omitempty"`

	// Guardrails controls which query safety checks are enabled.
	// Valid values: "all" (default), "none", or comma-separated list of:
	//   - "disallow-explicit-name-label"
	//   - "require-label-matcher"
	//   - "disallow-blanket-regex"
	Guardrails string `toml:"guardrails,omitempty"`

	// MaxMetricCardinality is the maximum allowed series count per metric.
	// Set to 0 to disable this check.
	// Default: 20000
	MaxMetricCardinality uint64 `toml:"max_metric_cardinality,omitempty"`

	// MaxLabelCardinality is the maximum allowed label value count for blanket regex.
	// Only takes effect if disallow-blanket-regex is enabled.
	// Set to 0 to always disallow blanket regex.
	// Default: 500
	MaxLabelCardinality uint64 `toml:"max_label_cardinality,omitempty"`

	// RangeQueryFullResponse controls whether range queries return full data points
	// instead of summary statistics.
	// Default: false (return summary statistics)
	RangeQueryFullResponse bool `toml:"range_query_full_response,omitempty"`
}

Config holds obs-mcp toolset configuration

func (*Config) GetAuthMode added in v0.1.2

func (c *Config) GetAuthMode() AuthMode

GetAuthMode returns the configured token source, defaulting to TokenSourceHeader.

func (*Config) GetGuardrails

func (c *Config) GetGuardrails() (*prometheus.Guardrails, error)

GetGuardrails returns the parsed guardrails configuration with cardinality limits applied.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the configuration values are valid.

Jump to

Keyboard shortcuts

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