observatorium

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterStateUnknown State      = "unknown"
	ClusterStateReady   State      = "ready"
	RangeQuery          ResultType = "query_range"
	Query               ResultType = "query"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIObservatoriumService

type APIObservatoriumService interface {
	GetKafkaState(name string, namespaceName string) (KafkaState, error)
	GetMetrics(csMetrics *KafkaMetrics, resourceNamespace string, rq *MetricsReqParams) error
}

type Client

type Client struct {
	// Configuration
	Config *ClientConfiguration

	Service APIObservatoriumService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Configuration) (*Client, error)

func NewClientMock

func NewClientMock(config *Configuration) (*Client, error)

func NewObservatoriumClient

func NewObservatoriumClient(c *ObservabilityConfiguration) (client *Client, err error)

func (*Client) MockAPI

func (c *Client) MockAPI() pV1.API

func (*Client) Query

func (c *Client) Query(queryTemplate string, label string) Metric

Query sends a metrics request to server and returns unmashalled Vector response. The VectorResult(s) inside will contain either .Value for queries resulting in instant vector, or .Values for queries resulting in a range vector.

queryTemplate must contain one %s for labels, e.g. `some_metric{%s}` or `count(some_metric{state="up",%s})`. (Undocumented PromQL: empty labels some_metric{} are OK - https://github.com/prometheus/prometheus/issues/3697) labels 0 or more constraints separated by comma e.g. “ or `foo="bar",quux="baz"`.

func (*Client) QueryRange

func (c *Client) QueryRange(queryTemplate string, label string, bounds pV1.Range) Metric

func (*Client) QueryRaw

func (c *Client) QueryRaw(query string) Metric

func (*Client) QueryRawRange

func (c *Client) QueryRawRange(query string, bounds pV1.Range) Metric

type ClientConfiguration

type ClientConfiguration struct {
	BaseURL    string
	Timeout    time.Duration
	EnableMock bool
	Insecure   bool
}

type Configuration

type Configuration struct {
	BaseURL  string
	Timeout  time.Duration
	Insecure bool
}

type DataPlaneObservabilityConfig

type DataPlaneObservabilityConfig struct {
	Enabled bool

	RemoteWriteConfiguration DataPlaneObservabilityRemoteWriteConfiguration `yaml:"remote_write_configuration" validate:"dive"`
	GithubResourcesAuthToken string
	// contains filtered or unexported fields
}

func (*DataPlaneObservabilityConfig) HasAutogeneratedOIDCConfiguration

func (c *DataPlaneObservabilityConfig) HasAutogeneratedOIDCConfiguration() bool

func (*DataPlaneObservabilityConfig) HasStaticOIDCConfiguration

func (c *DataPlaneObservabilityConfig) HasStaticOIDCConfiguration() bool

type DataPlaneObservabilityOIDCAutogenerated

type DataPlaneObservabilityOIDCAutogenerated struct{}

type DataPlaneObservabilityOIDCCredentials

type DataPlaneObservabilityOIDCCredentials struct {
	ClientID     string `yaml:"client_id" validate:"required"`
	ClientSecret string `yaml:"client_secret" validate:"required"`
}

type DataPlaneObservabilityOIDCStatic

type DataPlaneObservabilityOIDCStatic struct {
	AuthorizationServer string                                `yaml:"authorization_server" validate:"required"`
	Realm               string                                `yaml:"realm" validate:"required"`
	Credentials         DataPlaneObservabilityOIDCCredentials `yaml:"credentials" validate:"dive"`
}

type DataPlaneObservabilityRemoteWriteAuthTypeOIDC

type DataPlaneObservabilityRemoteWriteAuthTypeOIDC struct {
	Autogenerated *DataPlaneObservabilityOIDCAutogenerated `yaml:"autogenerated_configuration" validate:"omitempty"`
	Static        *DataPlaneObservabilityOIDCStatic        `yaml:"static_configuration" validate:"omitempty,dive"`
}

type DataPlaneObservabilityRemoteWriteAuthentication

type DataPlaneObservabilityRemoteWriteAuthentication struct {
	OIDC *DataPlaneObservabilityRemoteWriteAuthTypeOIDC `yaml:"oidc" validate:"omitempty,dive"`
}

type DataPlaneObservabilityRemoteWriteConfiguration

type DataPlaneObservabilityRemoteWriteConfiguration struct {
	RemoteWriteURL string                                          `yaml:"remote_write_url" validate:"required"`
	Authentication DataPlaneObservabilityRemoteWriteAuthentication `yaml:"authentication" validate:"required,dive"`
}

type KafkaMetrics

type KafkaMetrics []Metric

type KafkaState

type KafkaState struct {
	State State `json:",omitempty"`
}

type Metric

type Metric struct {
	Matrix pModel.Matrix `json:"matrix"`
	Vector pModel.Vector `json:"vector"`
	Err    error         `json:"-"`
}

Metric holds the Prometheus Matrix or Vector model, which contains instant vector or range vector with time series (depending on result type)

type MetricsReqParams

type MetricsReqParams struct {
	Filters    []string
	ResultType ResultType
	prom_v1.Range
}

MetricsReqParams holds common parameters for all kinds of range queries and instant quries

func (*MetricsReqParams) FillDefaults

func (q *MetricsReqParams) FillDefaults()

FillDefaults fills the struct with default parameters

type ObservabilityCloudWatchLoggingConfig

type ObservabilityCloudWatchLoggingConfig struct {
	Credentials                   ObservabilityCloudwatchLoggingConfigCredentials             `yaml:"aws_iam_credentials" validate:"dive"`
	EnterpriseCredentials         []ObservabilityEnterpriseCloudwatchLoggingConfigCredentials `yaml:"aws_iam_credentials_enterprise" validate:"dive"`
	K8sCredentialsSecretName      string                                                      `yaml:"k8s_credentials_secret_name" validate:"omitempty,oneof=clo-cloudwatchlogs-creds"`
	K8sCredentialsSecretNamespace string                                                      `yaml:"k8s_credentials_secret_namespace" validate:"omitempty,oneof=openshift-logging"`
	CloudwatchLoggingEnabled      bool                                                        `validate:"-"`
	// contains filtered or unexported fields
}

func (*ObservabilityCloudWatchLoggingConfig) GetEnterpriseCredentials

type ObservabilityCloudwatchLoggingConfigCredentials

type ObservabilityCloudwatchLoggingConfigCredentials struct {
	AccessKey       string `yaml:"aws_access_key" validate:"required"`
	SecretAccessKey string `yaml:"aws_secret_access_key" validate:"required"`
}

type ObservabilityConfiguration

type ObservabilityConfiguration struct {
	// Red Hat SSO configuration
	//// RedHatSsoTenant is used to specify the Observatorium tenant for
	//// the Data Plane Remote Write configuration. It is not used for
	//// the control plane connection against Observatorium
	RedHatSsoTenant string `json:"redhat_sso_tenant" yaml:"redhat_sso_tenant"`
	//// RedHatSsoTokenRefresherUrl is the Token Refresher URL that will be used
	//// to connect indirectly to Observatorium from the Control Plane. It is not
	//// used for the  data plane connection against observatorium
	RedHatSsoTokenRefresherUrl string `json:"redhat_sso_token_refresher_url" yaml:"redhat_sso_token_refresher_url"`

	// Observatorium configuration
	Timeout    time.Duration `json:"timeout"`
	Insecure   bool          `json:"insecure"`
	EnableMock bool          `json:"enable_mock"`

	// Configuration repo for the Observability operator
	ObservabilityConfigTag     string `json:"observability_config_tag"`
	ObservabilityConfigRepo    string `json:"observability_config_repo"`
	ObservabilityConfigChannel string `json:"observability_config_channel"`

	// Configuration of AWS CloudWatch Logging for Observability
	ObservabilityCloudWatchLoggingConfig ObservabilityCloudWatchLoggingConfig
	DataPlaneObservabilityConfig         DataPlaneObservabilityConfig
}

func NewObservabilityConfigurationConfig

func NewObservabilityConfigurationConfig() *ObservabilityConfiguration

func (*ObservabilityConfiguration) AddFlags

func (c *ObservabilityConfiguration) AddFlags(fs *pflag.FlagSet)

func (*ObservabilityConfiguration) ReadFiles

func (c *ObservabilityConfiguration) ReadFiles() error

func (*ObservabilityConfiguration) Validate

type ObservabilityEnterpriseCloudwatchLoggingConfigCredentials

type ObservabilityEnterpriseCloudwatchLoggingConfigCredentials struct {
	Credentials ObservabilityCloudwatchLoggingConfigCredentials `yaml:"credentials" validate:"dive"`
	OrgID       string                                          `yaml:"org_id" validate:"required"`
}

type ResultType

type ResultType string

type ServiceObservatorium

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

func (*ServiceObservatorium) GetKafkaState

func (obs *ServiceObservatorium) GetKafkaState(name string, resourceNamespace string) (KafkaState, error)

func (*ServiceObservatorium) GetMetrics

func (obs *ServiceObservatorium) GetMetrics(metrics *KafkaMetrics, namespace string, rq *MetricsReqParams) error

type State

type State string

Jump to

Keyboard shortcuts

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