shared

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Shared definitions (constants & errors) for opni alerting

Index

Constants

View Source
const (
	AlertingV1Alpha      = "v1alpha"
	MonitoringDatasource = "monitoring"
	LoggingDatasource    = "logging"
	SystemDatasource     = "system"
)
View Source
const (
	ConfigMountPath                        = "/etc/config"
	DataMountPath                          = "/var/lib"
	AlertManagerConfigKey                  = "alertmanager.yaml"
	InternalRoutingConfigKey               = "internal-routing.yaml"
	OperatorAlertingControllerServiceName  = "opni-alerting-controller"
	OperatorAlertingClusterNodeServiceName = "opni-alerting"
	AlertingHookReceiverName               = "opni.default.hook"
	AlertingDefaultHookName                = "/opni/hook"
	AlertingDefaultHookPort                = 3000
)
View Source
const (
	// global streams
	AgentClusterHealthStatusStream        = "agent-cluster-health-status"
	AgentClusterHealthStatusSubjects      = "agent-cluster-health-status.*"
	AgentClusterHealthStatusDurableReplay = "agent-cluster-health-status-consumer"

	//streams
	AgentDisconnectStream         = "opni_alerting_agent"
	AgentDisconnectStreamSubjects = "opni_alerting_agent.*"
	AgentHealthStream             = "opni_alerting_health"
	AgentHealthStreamSubjects     = "opni_alerting_health.*"
	CortexStatusStream            = "opni_alerting_cortex_status"
	CortexStatusStreamSubjects    = "opni_alerting_cortex_status.*"
	// buckets
	AlertingConditionBucket            = "opni-alerting-condition-bucket"
	AlertingEndpointBucket             = "opni-alerting-endpoint-bucket"
	AgentDisconnectBucket              = "opni-alerting-agent-bucket"
	AgentStatusBucket                  = "opni-alerting-agent-status-bucket"
	StatusBucketPerCondition           = "opni-alerting-condition-status-bucket"
	StatusBucketPerClusterInternalType = "opni-alerting-cluster-condition-type-status-bucket"
	GeneralIncidentStorage             = "opni-alerting-general-incident-bucket"
	RouterStorage                      = "opni-alerting-router-bucket"
)

Jetstream streams

View Source
const AgentDisconnectStorageType = "agent-disconnect"
View Source
const BackendConditionClusterIdLabel = "clusterId"
View Source
const BackendConditionIdLabel = "conditionId"
View Source
const BackendConditionNameLabel = "opniname"
View Source
const BackendConditionSeverityLabel = "severity"
View Source
const BroadcastIdLabel = "broadcastId"
View Source
const CortexCompactor = "compactor"
View Source
const CortexDistributor = "distributor"
View Source
const CortexIngester = "ingester"
View Source
const CortexPurger = "purger"
View Source
const CortexQuerier = "querier"
View Source
const CortexQueryFrontend = "query-frontend"
View Source
const CortexRuler = "ruler"
View Source
const CortexStoreGateway = "store-gateway"
View Source
const InternalDiscordId = "discord"
View Source
const InternalEmailId = "email"
View Source
const InternalOpsGenieId = "opsgenie"
View Source
const InternalPagerdutyId = "pagerduty"
View Source
const InternalPushoverId = "pushover"
View Source
const InternalSNSId = "sns"
View Source
const InternalSlackId = "slack"
View Source
const InternalTelegramId = "telegram"
View Source
const InternalVictorOpsId = "victorops"
View Source
const InternalWebhookId = "webhook"
View Source
const InternalWechatId = "wechat"
View Source
const OpniAlarmNameAnnotation = "OpniAlarmName"
View Source
const OpniAlertingCortexNamespace = "opni-alerting"
View Source
const OpniBodyAnnotations = "OpniSummary"
View Source
const OpniBodyLabel = "OpniBodyLabel"
View Source
const OpniClusterAnnotation = "OpniCluster"
View Source
const OpniDatasourceLabel = "OpniDatasource"
View Source
const OpniDatasourceMetrics = "metrics"
View Source
const OpniGoldenSignalAnnotation = "OpniGoldenSignal"
View Source
const OpniHeaderAnnotations = "OpniHeader"
View Source
const OpniSeverityLabel = "OpniSeverity"
View Source
const OpniTitleLabel = "OpniTitleLabel"

labels

View Source
const OpniUnbufferedKey = "OpniGroupKey"
View Source
const SingleConfigId = "global"

Variables

View Source
var (
	PublicLabels        = map[string]string{}
	PublicServiceLabels = map[string]string{}
)
View Source
var (
	AlertingErrNotImplemented           = WithUnimplementedError("Not implemented")
	AlertingErrNotImplementedNOOP       = WithUnimplementedError("Alerting NOOP : Not implemented")
	AlertingErrParseBucket              = WithInternalServerError("Failed to parse bucket index")
	AlertingErrBucketIndexInvalid       = WithInternalServerError("Bucket index is invalid")
	AlertingErrInvalidSlackChannel      = validation.Error("Slack channel invalid : must start with '#'")
	AlertingErrK8sRuntime               = WithInternalServerError("K8s Runtime error")
	AlertingErrMismatchedImplementation = validation.Error("Alerting endpoint did not match the given implementation")
)
View Source
var ComparisonOperators = []string{"<", ">", "<=", ">=", "=", "!="}

Condition constants

View Source
var DefaultAlertManager = template.Must(template.New("DefaultManagementHook").Parse(strings.Join([]string{
	strings.TrimSpace(route),
	receivers,
	strings.TrimSpace(inihibit_rules),
}, "\n")))
View Source
var KubeStates = []string{"Pending", "Running", "Succeeded", "Failed", "Unknown"}
View Source
var OpniGroupByClause = []model.LabelName{
	"alertname",
}
View Source
var OpniMetricsSubRoutingTreeMatcher *labels.Matcher = &labels.Matcher{
	Type:  labels.MatchEqual,
	Name:  OpniDatasourceLabel,
	Value: OpniDatasourceMetrics,
}
View Source
var OpniSeverityTreeMatcher *labels.Matcher = &labels.Matcher{
	Type:  labels.MatchEqual,
	Name:  OpniSeverityLabel,
	Value: "true",
}
View Source
var OpniSubRoutingTreeMatcher *labels.Matcher = &labels.Matcher{
	Type:  labels.MatchEqual,
	Name:  OpniDatasourceLabel,
	Value: "",
}

Functions

func AlertManagerLabelsToAnnotations added in v0.8.2

func AlertManagerLabelsToAnnotations(m *labels.Matcher) (map[string]string, error)

func DefaultAlertManagerConfig added in v0.6.1

func DefaultAlertManagerConfig(managementUrl string) (bytes.Buffer, error)

func LabelWithAlert added in v0.6.0

func LabelWithAlert(label map[string]string) map[string]string

func NewAlertingRefId added in v0.8.2

func NewAlertingRefId(prefixes ...string) string

func NewOpniReceiverName added in v0.8.2

func NewOpniReceiverName(id OpniReceiverId) string

func WithFailedPreconditionError added in v0.7.0

func WithFailedPreconditionError(msg string) error

func WithFailedPreconditionErrorf added in v0.7.0

func WithFailedPreconditionErrorf(format string, args ...interface{}) error

func WithInternalServerError added in v0.6.0

func WithInternalServerError(msg string) error

func WithInternalServerErrorf added in v0.6.0

func WithInternalServerErrorf(format string, args ...interface{}) error

func WithNotFoundError added in v0.6.0

func WithNotFoundError(msg string) error

func WithNotFoundErrorf added in v0.6.0

func WithNotFoundErrorf(format string, args ...interface{}) error

func WithUnimplementedError

func WithUnimplementedError(msg string) error

func WithUnimplementedErrorf

func WithUnimplementedErrorf(format string, args ...interface{}) error

Types

type AlertingClusterNotification added in v0.8.2

type AlertingClusterNotification lo.Tuple2[bool, *AlertingClusterOptions]

type AlertingClusterOptions added in v0.8.2

type AlertingClusterOptions struct {
	Namespace             string
	WorkerNodesService    string
	WorkerNodePort        int
	WorkerStatefulSet     string
	ControllerNodeService string
	ControllerNodePort    int
	ControllerClusterPort int
	ControllerStatefulSet string
	ConfigMap             string
	ManagementHookHandler string
}

func (*AlertingClusterOptions) GetControllerEndpoint added in v0.8.2

func (a *AlertingClusterOptions) GetControllerEndpoint() string

func (*AlertingClusterOptions) GetInternalControllerOpniEndpoint added in v0.8.2

func (a *AlertingClusterOptions) GetInternalControllerOpniEndpoint() string

func (*AlertingClusterOptions) GetInternalWorkerOpniEndpoint added in v0.8.2

func (a *AlertingClusterOptions) GetInternalWorkerOpniEndpoint() string

func (*AlertingClusterOptions) GetWorkerEndpoint added in v0.8.2

func (a *AlertingClusterOptions) GetWorkerEndpoint() string

type DefaultAlertManagerInfo added in v0.6.0

type DefaultAlertManagerInfo struct {
	CortexHandlerName string
	CortexHandlerURL  string
}

type FailedPreconditionError added in v0.7.0

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

func (*FailedPreconditionError) Error added in v0.7.0

func (e *FailedPreconditionError) Error() string

func (*FailedPreconditionError) GRPCStatus added in v0.7.0

func (e *FailedPreconditionError) GRPCStatus() *status.Status

type InternalServerError added in v0.6.0

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

func (*InternalServerError) Error added in v0.6.0

func (e *InternalServerError) Error() string

func (*InternalServerError) GRPCStatus added in v0.6.0

func (e *InternalServerError) GRPCStatus() *status.Status

type NotFoundError added in v0.6.0

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

func (*NotFoundError) Error added in v0.6.0

func (e *NotFoundError) Error() string

func (*NotFoundError) GRPCStatus added in v0.6.0

func (e *NotFoundError) GRPCStatus() *status.Status

type OpniReceiverId added in v0.8.2

type OpniReceiverId struct {
	Namespace  string
	ReceiverId string
}

func ExtractReceiverId added in v0.8.2

func ExtractReceiverId(receiverName string) (*OpniReceiverId, error)

type UnimplementedError

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

func (*UnimplementedError) Error

func (e *UnimplementedError) Error() string

func (*UnimplementedError) GRPCStatus

func (e *UnimplementedError) GRPCStatus() *status.Status

Jump to

Keyboard shortcuts

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