ontology

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ontology provides a generic labeling taxonomy for SLOs.

This package contains core labels that are universally applicable to any SLO implementation. Domain-specific labels are available in the ontologies/domains/ subpackages.

Index

Constants

View Source
const (
	// LabelFramework indicates which monitoring methodology is being used.
	LabelFramework = "framework"

	// LabelLayer indicates the observability layer.
	LabelLayer = "layer"

	// LabelScope indicates the impact scope of the metric.
	LabelScope = "scope"

	// LabelAudience indicates the primary stakeholder for this metric.
	LabelAudience = "audience"

	// LabelCategory indicates the type of metric being measured.
	LabelCategory = "category"

	// LabelSeverity indicates the impact of an SLO breach.
	LabelSeverity = "severity"

	// LabelTier indicates the service tier or priority.
	LabelTier = "tier"

	// LabelMetricType provides additional categorization within a domain.
	LabelMetricType = "metric-type"

	// LabelResourceType specifies the type of resource for USE metrics.
	LabelResourceType = "resource-type"

	// LabelService identifies the service being measured.
	LabelService = "service"

	// LabelTeam identifies the team responsible for the service.
	LabelTeam = "team"

	// LabelEnvironment indicates the deployment environment.
	LabelEnvironment = "environment"
)

Label keys for consistent labeling across SLOs. These are the core, generic labels applicable to any domain.

View Source
const (
	FrameworkRED    = "red"    // Rate, Errors, Duration
	FrameworkUSE    = "use"    // Utilization, Saturation, Errors
	FrameworkCustom = "custom" // Custom business or domain-specific metrics
)

Framework indicates which monitoring methodology is being used.

View Source
const (
	LayerService        = "service"        // Request-driven services (APIs, microservices)
	LayerInfrastructure = "infrastructure" // Hardware and system resources
	LayerBusiness       = "business"       // Business outcomes and metrics
	LayerApplication    = "application"    // Application-level metrics
)

Layer indicates the observability layer.

View Source
const (
	ScopeCustomerFacing  = "customer-facing"  // Metrics affecting end users
	ScopeInternal        = "internal"         // Internal infrastructure metrics
	ScopeBusinessOutcome = "business-outcome" // Business performance metrics
)

Scope indicates the impact scope of the metric.

View Source
const (
	AudienceSRE             = "sre"              // Site Reliability Engineering
	AudienceEngineering     = "engineering"      // Engineering teams
	AudienceProduct         = "product"          // Product management
	AudienceExecutive       = "executive"        // Executive leadership
	AudienceCustomerSuccess = "customer-success" // Customer success teams
)

Audience indicates the primary stakeholder for this metric.

View Source
const (
	CategoryAvailability = "availability" // Service uptime and availability
	CategoryLatency      = "latency"      // Response times and duration
	CategoryThroughput   = "throughput"   // Request rate and volume
	CategoryQuality      = "quality"      // Error rates, accuracy, satisfaction
	CategoryResource     = "resource"     // CPU, memory, disk, network
	CategoryEngagement   = "engagement"   // User engagement metrics
	CategoryConversion   = "conversion"   // Activation, retention, churn
	CategoryCost         = "cost"         // Operational costs
	CategorySecurity     = "security"     // Security metrics
	CategoryCompliance   = "compliance"   // Compliance metrics
)

Category indicates the type of metric being measured.

View Source
const (
	SeverityCritical      = "critical" // Immediate action required
	SeverityHigh          = "high"     // Action required soon
	SeverityMedium        = "medium"   // Should be addressed
	SeverityLow           = "low"      // Nice to fix
	SeverityInformational = "info"     // Informational only, no risk
)

Severity indicates the impact of an SLO breach.

View Source
const (
	TierP0 = "p0" // Highest priority
	TierP1 = "p1" // High priority
	TierP2 = "p2" // Medium priority
	TierP3 = "p3" // Low priority
)

Tier indicates the service tier or priority.

View Source
const (
	// RED metric types
	MetricTypeRate         = "rate"
	MetricTypeErrors       = "errors"
	MetricTypeDuration     = "duration"
	MetricTypeAvailability = "availability" // Derived from rate and errors

	// USE metric types
	MetricTypeUtilization = "utilization"
	MetricTypeSaturation  = "saturation"

	// Business/Product metric types
	MetricTypeSatisfaction = "satisfaction"
	MetricTypeEfficiency   = "efficiency"
)

MetricType provides additional categorization within a domain.

View Source
const (
	ResourceTypeCPU     = "cpu"
	ResourceTypeMemory  = "memory"
	ResourceTypeDisk    = "disk"
	ResourceTypeNetwork = "network"
	ResourceTypeGPU     = "gpu"
)

ResourceType specifies the type of resource for USE metrics.

View Source
const (
	EnvironmentProduction = "production"
	EnvironmentStaging    = "staging"
	EnvironmentDev        = "dev"
)

Environment indicates the deployment environment.

Variables

This section is empty.

Functions

func GetLabelDefinitions

func GetLabelDefinitions() map[string][]string

GetLabelDefinitions returns all possible values for each core label type. Domain-specific label definitions are available in ontologies/domains/ packages.

func Labels

func Labels() []string

Labels returns all core label keys.

func NewLabels

func NewLabels(labels map[string]string) v1.Labels

NewLabels creates a v1.Labels map from a simple key-value map. OpenSLO v1.Labels expects map[string]Label format where Label is []string.

func PrintReports

func PrintReports(w io.Writer, reports map[string]*MetricReport)

PrintReports prints human-readable table format of all reports

func WriteSLOSetReport

func WriteSLOSetReport(w io.Writer, report *MetricReport)

WriteSLOSetReport prints a Markdown-formatted table of a single report

func WriteSLOSetsReport

func WriteSLOSetsReport(w io.Writer, slos map[string][]v1.SLO) error

Types

type LabelDistribution

type LabelDistribution struct {
	LabelName    string               `json:"label_name"`
	Histogram    *histogram.Histogram `json:"histogram"`
	TotalMetrics int                  `json:"total_metrics"`
}

LabelDistribution represents the distribution of values for a specific label

type MetricReport

type MetricReport struct {
	Directory          string                        `json:"directory"`
	TotalSLOs          int                           `json:"total_slos"`
	LabelDistributions map[string]*LabelDistribution `json:"label_distributions"`
}

MetricReport represents the complete label analysis for a directory

func AnalyzeLabels

func AnalyzeLabels(directory string, slos []v1.SLO) *MetricReport

AnalyzeLabels analyzes a slice of SLOs and generates a label distribution report

Jump to

Keyboard shortcuts

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