slo

package
v0.84.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MPL-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package slo defines SLO object definitions.

Index

Examples

Constants

View Source
const (
	AzureMonitorDataTypeMetrics = "metrics"
	AzureMonitorDataTypeLogs    = "logs"
)
View Source
const (
	LightstepMetricDataType     = "metric"
	LightstepLatencyDataType    = "latency"
	LightstepErrorRateDataType  = "error_rate"
	LightstepTotalCountDataType = "total"
	LightstepGoodCountDataType  = "good"
)
View Source
const (
	PingdomTypeUptime      = "uptime"
	PingdomTypeTransaction = "transaction"
)
View Source
const (
	ThousandEyesNetLatency              = "net-latency"
	ThousandEyesNetLoss                 = "net-loss"
	ThousandEyesWebPageLoad             = "web-page-load"
	ThousandEyesWebDOMLoad              = "web-dom-load"
	ThousandEyesHTTPResponseTime        = "http-response-time"
	ThousandEyesServerAvailability      = "http-server-availability"
	ThousandEyesServerThroughput        = "http-server-throughput"
	ThousandEyesServerTotalTime         = "http-server-total-time"
	ThousandEyesDNSServerResolutionTime = "dns-server-resolution-time"
	ThousandEyesDNSSECValid             = "dns-dnssec-valid"
)

Variables

View Source
var ErrInvalidWhenDelayed = fmt.Errorf("not a valid WhenDelayed, try [%s]", strings.Join(_WhenDelayedNames, ", "))

Functions

func WhenDelayedNames added in v0.79.0

func WhenDelayedNames() []string

WhenDelayedNames returns a list of possible string values of WhenDelayed.

Types

type AmazonPrometheusMetric

type AmazonPrometheusMetric struct {
	PromQL *string `json:"promql"`
}

AmazonPrometheusMetric represents metric from Amazon Managed Prometheus

type AnomalyConfig

type AnomalyConfig struct {
	NoData *AnomalyConfigNoData `json:"noData"`
}

AnomalyConfig represents relationship between anomaly type and selected notification methods. This will be removed (moved into Anomaly Policy) in PC-8502

type AnomalyConfigAlertMethod

type AnomalyConfigAlertMethod struct {
	Name    string `json:"name"`
	Project string `json:"project,omitempty"`
}

AnomalyConfigAlertMethod represents a single alert method used in AnomalyConfig defined by name and project.

type AnomalyConfigNoData

type AnomalyConfigNoData struct {
	AlertMethods []AnomalyConfigAlertMethod `json:"alertMethods"`
}

AnomalyConfigNoData contains alertMethods used for No Data anomaly type.

type AppDynamicsMetric

type AppDynamicsMetric struct {
	ApplicationName *string `json:"applicationName"`
	MetricPath      *string `json:"metricPath"`
}

AppDynamicsMetric represents metric from AppDynamics

type Attachment

type Attachment struct {
	URL         string  `json:"url"`
	DisplayName *string `json:"displayName,omitempty"`
}

Attachment represents user defined URL attached to SLO.

type AzureMonitorMetric

type AzureMonitorMetric struct {
	DataType        string                                   `json:"dataType"`
	ResourceID      string                                   `json:"resourceId,omitempty"`
	MetricName      string                                   `json:"metricName,omitempty"`
	Aggregation     string                                   `json:"aggregation,omitempty"`
	Dimensions      []AzureMonitorMetricDimension            `json:"dimensions,omitempty"`
	MetricNamespace string                                   `json:"metricNamespace,omitempty"`
	Workspace       *AzureMonitorMetricLogAnalyticsWorkspace `json:"workspace,omitempty"`
	KQLQuery        string                                   `json:"kqlQuery,omitempty"`
}

AzureMonitorMetric represents metric from AzureMonitor

type AzureMonitorMetricDimension

type AzureMonitorMetricDimension struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

AzureMonitorMetricDimension represents name/value pair that is part of the identity of a metric.

type AzureMonitorMetricLogAnalyticsWorkspace added in v0.69.0

type AzureMonitorMetricLogAnalyticsWorkspace struct {
	SubscriptionID string `json:"subscriptionId"`
	ResourceGroup  string `json:"resourceGroup"`
	WorkspaceID    string `json:"workspaceId"`
}

AzureMonitorMetricLogAnalyticsWorkspace represents Azure Log Analytics Workspace

type AzurePrometheusMetric added in v0.83.0

type AzurePrometheusMetric struct {
	PromQL string `json:"promql"`
}

AzurePrometheusMetric represents metric from Azure Monitor managed service for Prometheus

type BigQueryMetric

type BigQueryMetric struct {
	Query     string `json:"query"`
	ProjectID string `json:"projectId"`
	Location  string `json:"location"`
}

BigQueryMetric represents metric from BigQuery

type BudgetingMethod

type BudgetingMethod int

BudgetingMethod indicates algorithm to calculate error budget

const (
	// BudgetingMethodOccurrences method uses ratio of counts of good events and total count of event
	BudgetingMethodOccurrences BudgetingMethod = iota + 1
	// BudgetingMethodTimeslices method uses ratio of good time slices vs. total time slices in a budgeting period
	BudgetingMethodTimeslices
)

func ParseBudgetingMethod

func ParseBudgetingMethod(value string) (BudgetingMethod, error)

func (BudgetingMethod) String

func (m BudgetingMethod) String() string

type Calendar

type Calendar struct {
	StartTime string `json:"startTime"`
	TimeZone  string `json:"timeZone"`
}

Calendar struct represents calendar time window

type CloudWatchMetric

type CloudWatchMetric struct {
	Region     *string                     `json:"region"`
	Namespace  *string                     `json:"namespace,omitempty"`
	MetricName *string                     `json:"metricName,omitempty"`
	Stat       *string                     `json:"stat,omitempty"`
	Dimensions []CloudWatchMetricDimension `json:"dimensions,omitempty"`
	AccountID  *string                     `json:"accountId,omitempty"`
	SQL        *string                     `json:"sql,omitempty"`
	JSON       *string                     `json:"json,omitempty"`
}

CloudWatchMetric represents metric from CloudWatch.

func (CloudWatchMetric) IsJSONConfiguration

func (c CloudWatchMetric) IsJSONConfiguration() bool

IsJSONConfiguration returns true if the struct represents CloudWatch JSON configuration.

func (CloudWatchMetric) IsSQLConfiguration

func (c CloudWatchMetric) IsSQLConfiguration() bool

IsSQLConfiguration returns true if the struct represents CloudWatch SQL configuration.

func (CloudWatchMetric) IsStandardConfiguration

func (c CloudWatchMetric) IsStandardConfiguration() bool

IsStandardConfiguration returns true if the struct represents CloudWatch standard configuration.

type CloudWatchMetricDimension

type CloudWatchMetricDimension struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

CloudWatchMetricDimension represents name/value pair that is part of the identity of a metric.

type Components added in v0.79.0

type Components struct {
	Objectives []CompositeObjective `json:"objectives"`
}

type Composite

type Composite struct {
	BudgetTarget      *float64                    `json:"target"`
	BurnRateCondition *CompositeBurnRateCondition `json:"burnRateCondition,omitempty"`
}

Composite represents configuration for Composite SLO. Deprecated: this implementation of Composite will be removed and replaced with new CompositeSpec

type CompositeBurnRateCondition

type CompositeBurnRateCondition struct {
	Value    float64 `json:"value"`
	Operator string  `json:"op"`
}

CompositeBurnRateCondition represents configuration for Composite SLO with occurrences budgeting method.

type CompositeObjective added in v0.79.0

type CompositeObjective struct {
	Project     string      `json:"project"`
	SLO         string      `json:"slo"`
	Objective   string      `json:"objective"`
	Weight      float64     `json:"weight"`
	WhenDelayed WhenDelayed `json:"whenDelayed"`
}

type CompositeSpec added in v0.79.0

type CompositeSpec struct {
	MaxDelay   string `json:"maxDelay"`
	Components `json:"components"`
}

CompositeSpec represents a composite of SLOs and Composite SLOs.

type CompositeVersion

type CompositeVersion struct {
	Version      int32
	Created      string
	Dependencies []string
}

CompositeVersion represents composite version history stored for restoring process.

type CountMetricsSpec

type CountMetricsSpec struct {
	Incremental *bool       `json:"incremental"`
	GoodMetric  *MetricSpec `json:"good,omitempty"`
	BadMetric   *MetricSpec `json:"bad,omitempty"`
	TotalMetric *MetricSpec `json:"total,omitempty"`
	// Experimental: Splunk only, a single query returning both good and total counts.
	GoodTotalMetric *MetricSpec `json:"goodTotal,omitempty"`
}

CountMetricsSpec represents set of two time series of good and total counts

type DatadogMetric

type DatadogMetric struct {
	Query *string `json:"query"`
}

DatadogMetric represents metric from Datadog

type DynatraceMetric

type DynatraceMetric struct {
	MetricSelector *string `json:"metricSelector"`
}

DynatraceMetric represents metric from Dynatrace.

type ElasticsearchMetric

type ElasticsearchMetric struct {
	Index *string `json:"index"`
	Query *string `json:"query"`
}

ElasticsearchMetric represents metric from Elasticsearch.

type GCMMetric

type GCMMetric struct {
	Query     string `json:"query"`
	ProjectID string `json:"projectId"`
}

GCMMetric represents metric from GCM

type GenericMetric

type GenericMetric struct {
	Query *string `json:"query"`
}

type GrafanaLokiMetric

type GrafanaLokiMetric struct {
	Logql *string `json:"logql"`
}

GrafanaLokiMetric represents metric from GrafanaLokiMetric.

type GraphiteMetric

type GraphiteMetric struct {
	MetricPath *string `json:"metricPath"`
}

GraphiteMetric represents metric from Graphite.

type HoneycombMetric

type HoneycombMetric struct {
	Calculation string `json:"calculation"`
	Attribute   string `json:"attribute,omitempty"`
}

HoneycombMetric represents metric from Honeycomb.

type Indicator

type Indicator struct {
	MetricSource MetricSourceSpec `json:"metricSource"`
	RawMetric    *MetricSpec      `json:"rawMetric,omitempty"`
}

Indicator represents integration with metric source can be. e.g. Prometheus, Datadog, for internal usage

type InfluxDBMetric

type InfluxDBMetric struct {
	Query *string `json:"query"`
}

InfluxDBMetric represents metric from InfluxDB

type InstanaApplicationMetricGroupBy

type InstanaApplicationMetricGroupBy struct {
	Tag               string  `json:"tag"`
	TagEntity         string  `json:"tagEntity"`
	TagSecondLevelKey *string `json:"tagSecondLevelKey,omitempty"`
}

type InstanaApplicationMetricType

type InstanaApplicationMetricType struct {
	MetricID         string                          `json:"metricId"`
	Aggregation      string                          `json:"aggregation"`
	GroupBy          InstanaApplicationMetricGroupBy `json:"groupBy"`
	APIQuery         string                          `json:"apiQuery"`
	IncludeInternal  bool                            `json:"includeInternal,omitempty"`
	IncludeSynthetic bool                            `json:"includeSynthetic,omitempty"`
}

type InstanaInfrastructureMetricType

type InstanaInfrastructureMetricType struct {
	MetricRetrievalMethod string  `json:"metricRetrievalMethod"`
	Query                 *string `json:"query,omitempty"`
	SnapshotID            *string `json:"snapshotId,omitempty"`
	MetricID              string  `json:"metricId"`
	PluginID              string  `json:"pluginId"`
}

type InstanaMetric

type InstanaMetric struct {
	MetricType     string                           `json:"metricType"`
	Infrastructure *InstanaInfrastructureMetricType `json:"infrastructure,omitempty"`
	Application    *InstanaApplicationMetricType    `json:"application,omitempty"`
}

InstanaMetric represents metric from Redshift.

type LightstepMetric

type LightstepMetric struct {
	StreamID   *string  `json:"streamId,omitempty"`
	TypeOfData *string  `json:"typeOfData"`
	Percentile *float64 `json:"percentile,omitempty"`
	UQL        *string  `json:"uql,omitempty"`
}

LightstepMetric represents metric from Lightstep

type LogicMonitorMetric added in v0.82.0

type LogicMonitorMetric struct {
	QueryType                  string `json:"queryType"`
	DeviceDataSourceInstanceID int    `json:"deviceDataSourceInstanceId"`
	GraphID                    int    `json:"graphId"`
	Line                       string `json:"line"`
}

LogicMonitorMetric represents metric from LogicMonitor

type Metadata

type Metadata struct {
	Name        string                      `json:"name"`
	DisplayName string                      `json:"displayName,omitempty"`
	Project     string                      `json:"project,omitempty"`
	Labels      v1alpha.Labels              `json:"labels,omitempty"`
	Annotations v1alpha.MetadataAnnotations `json:"annotations,omitempty"`
}

Metadata provides identity information for SLO.

type MetricSourceSpec

type MetricSourceSpec struct {
	Name    string        `json:"name"`
	Project string        `json:"project,omitempty"`
	Kind    manifest.Kind `json:"kind,omitempty"`
}

type MetricSpec

type MetricSpec struct {
	Prometheus          *PrometheusMetric          `json:"prometheus,omitempty"`
	Datadog             *DatadogMetric             `json:"datadog,omitempty"`
	NewRelic            *NewRelicMetric            `json:"newRelic,omitempty"`
	AppDynamics         *AppDynamicsMetric         `json:"appDynamics,omitempty"`
	Splunk              *SplunkMetric              `json:"splunk,omitempty"`
	Lightstep           *LightstepMetric           `json:"lightstep,omitempty"`
	SplunkObservability *SplunkObservabilityMetric `json:"splunkObservability,omitempty"`
	Dynatrace           *DynatraceMetric           `json:"dynatrace,omitempty"`
	Elasticsearch       *ElasticsearchMetric       `json:"elasticsearch,omitempty"`
	ThousandEyes        *ThousandEyesMetric        `json:"thousandEyes,omitempty"`
	Graphite            *GraphiteMetric            `json:"graphite,omitempty"`
	BigQuery            *BigQueryMetric            `json:"bigQuery,omitempty"`
	OpenTSDB            *OpenTSDBMetric            `json:"opentsdb,omitempty"`
	GrafanaLoki         *GrafanaLokiMetric         `json:"grafanaLoki,omitempty"`
	CloudWatch          *CloudWatchMetric          `json:"cloudWatch,omitempty"`
	Pingdom             *PingdomMetric             `json:"pingdom,omitempty"`
	AmazonPrometheus    *AmazonPrometheusMetric    `json:"amazonPrometheus,omitempty"`
	Redshift            *RedshiftMetric            `json:"redshift,omitempty"`
	SumoLogic           *SumoLogicMetric           `json:"sumoLogic,omitempty"`
	Instana             *InstanaMetric             `json:"instana,omitempty"`
	InfluxDB            *InfluxDBMetric            `json:"influxdb,omitempty"`
	GCM                 *GCMMetric                 `json:"gcm,omitempty"`
	AzureMonitor        *AzureMonitorMetric        `json:"azureMonitor,omitempty"`
	Generic             *GenericMetric             `json:"generic,omitempty"`
	Honeycomb           *HoneycombMetric           `json:"honeycomb,omitempty"`
	LogicMonitor        *LogicMonitorMetric        `json:"logicMonitor,omitempty"`
	AzurePrometheus     *AzurePrometheusMetric     `json:"azurePrometheus,omitempty"`
}

MetricSpec defines single time series obtained from data source

func (*MetricSpec) DataSourceType

func (m *MetricSpec) DataSourceType() v1alpha.DataSourceType

DataSourceType returns a type of data source.

func (*MetricSpec) Query

func (m *MetricSpec) Query() interface{}

Query returns interface containing metric query for this MetricSpec.

type NewRelicMetric

type NewRelicMetric struct {
	NRQL *string `json:"nrql"`
}

NewRelicMetric represents metric from NewRelic

type Objective

type Objective struct {
	ObjectiveBase `json:",inline"`
	// <!-- Go struct field and type names renaming budgetTarget to target has been postponed after GA as requested
	// in PC-1240. -->
	BudgetTarget    *float64          `json:"target"`
	TimeSliceTarget *float64          `json:"timeSliceTarget,omitempty"`
	CountMetrics    *CountMetricsSpec `json:"countMetrics,omitempty"`
	RawMetric       *RawMetricSpec    `json:"rawMetric,omitempty"`
	// Composite is not yet supported, applying it will have no effect
	Composite *CompositeSpec `json:"composite,omitempty"`
	Operator  *string        `json:"op,omitempty"`
	// Primary is used to highlight the main (primary) objective of the [SLO].
	Primary *bool `json:"primary,omitempty"`
}

Objective represents single objective for SLO, for internal usage

func (Objective) GetBudgetTarget

func (o Objective) GetBudgetTarget() float64

func (*Objective) HasCountMetrics

func (o *Objective) HasCountMetrics() bool

HasCountMetrics returns true if Objective has count metrics.

func (*Objective) HasRawMetricQuery

func (o *Objective) HasRawMetricQuery() bool

HasRawMetricQuery returns true if Objective has raw metric with query set.

func (Objective) IsComposite added in v0.79.0

func (o Objective) IsComposite() bool

type ObjectiveBase

type ObjectiveBase struct {
	DisplayName string   `json:"displayName"`
	Value       *float64 `json:"value"`
	Name        string   `json:"name"`
	NameChanged bool     `json:"-"`
}

ObjectiveBase base structure representing an objective.

func (ObjectiveBase) GetValue

func (o ObjectiveBase) GetValue() float64

type OpenTSDBMetric

type OpenTSDBMetric struct {
	Query *string `json:"query"`
}

OpenTSDBMetric represents metric from OpenTSDB.

type Period

type Period struct {
	Begin string `json:"begin"`
	End   string `json:"end"`
}

Period represents period of time

type PingdomMetric

type PingdomMetric struct {
	CheckID   *string `json:"checkId"`
	CheckType *string `json:"checkType"`
	Status    *string `json:"status,omitempty"`
}

PingdomMetric represents metric from Pingdom.

type PrometheusMetric

type PrometheusMetric struct {
	PromQL *string `json:"promql"`
}

PrometheusMetric represents metric from Prometheus

type RawMetricSpec

type RawMetricSpec struct {
	MetricQuery *MetricSpec `json:"query"`
}

RawMetricSpec represents integration with a metric source for a particular objective.

type RedshiftMetric

type RedshiftMetric struct {
	Region       *string `json:"region"`
	ClusterID    *string `json:"clusterId"`
	DatabaseName *string `json:"databaseName"`
	Query        *string `json:"query"`
}

RedshiftMetric represents metric from Redshift.

type ReplayStatus

type ReplayStatus struct {
	Status    string `json:"status"`
	Unit      string `json:"unit"`
	Value     int    `json:"value"`
	StartTime string `json:"startTime,omitempty"`
}

type SLO

type SLO struct {
	APIVersion manifest.Version `json:"apiVersion"`
	Kind       manifest.Kind    `json:"kind"`
	Metadata   Metadata         `json:"metadata"`
	Spec       Spec             `json:"spec"`
	Status     *Status          `json:"status,omitempty"`

	Organization   string `json:"organization,omitempty"`
	ManifestSource string `json:"manifestSrc,omitempty"`
}

SLO struct which mapped one to one with kind: slo yaml definition, external usage

Example
package main

import (
	"context"
	"log"

	"github.com/nobl9/nobl9-go/internal/examples"
	"github.com/nobl9/nobl9-go/manifest"
	"github.com/nobl9/nobl9-go/manifest/v1alpha"
	"github.com/nobl9/nobl9-go/manifest/v1alpha/slo"
)

func main() {
	// Create the object:
	mySLO := slo.New(
		slo.Metadata{
			Name:        "my-slo",
			DisplayName: "My SLO",
			Project:     "default",
			Labels: v1alpha.Labels{
				"team":   []string{"green", "orange"},
				"region": []string{"eu-central-1"},
			},
		},
		slo.Spec{
			Description:   "Example slo",
			AlertPolicies: []string{"my-policy-name"},
			Attachments: []slo.Attachment{
				{
					DisplayName: ptr("Grafana Dashboard"),
					URL:         "https://loki.my-org.dev/grafana/d/dnd48",
				},
			},
			BudgetingMethod: slo.BudgetingMethodOccurrences.String(),
			Service:         "prometheus",
			Indicator: &slo.Indicator{
				MetricSource: slo.MetricSourceSpec{
					Name:    "prometheus",
					Project: "default",
					Kind:    manifest.KindAgent,
				},
			},
			Objectives: []slo.Objective{
				{
					ObjectiveBase: slo.ObjectiveBase{
						DisplayName: "Good",
						Value:       ptr(0.),
						Name:        "good",
					},
					BudgetTarget: ptr(0.9),
					CountMetrics: &slo.CountMetricsSpec{
						Incremental: ptr(false),
						GoodMetric: &slo.MetricSpec{
							Prometheus: &slo.PrometheusMetric{
								PromQL: ptr(`sum(rate(prometheus_http_requests_total{code=~"^2.*"}[1h]))`),
							},
						},
						TotalMetric: &slo.MetricSpec{
							Prometheus: &slo.PrometheusMetric{
								PromQL: ptr(`sum(rate(prometheus_http_requests_total[1h]))`),
							},
						},
					},
				},
			},
			TimeWindows: []slo.TimeWindow{
				{
					Unit:      "Day",
					Count:     1,
					IsRolling: true,
				},
			},
		},
	)
	// Verify the object:
	if err := mySLO.Validate(); err != nil {
		log.Fatal("slo validation failed, err: %w", err)
	}
	// Apply the object:
	client := examples.GetOfflineEchoClient()
	if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{mySLO}); err != nil {
		log.Fatal("failed to apply slo, err: %w", err)
	}
}

func ptr[T any](v T) *T { return &v }
Output:

apiVersion: n9/v1alpha
kind: SLO
metadata:
  name: my-slo
  displayName: My SLO
  project: default
  labels:
    region:
    - eu-central-1
    team:
    - green
    - orange
spec:
  description: Example slo
  indicator:
    metricSource:
      name: prometheus
      project: default
      kind: Agent
  budgetingMethod: Occurrences
  objectives:
  - displayName: Good
    value: 0.0
    name: good
    target: 0.9
    countMetrics:
      incremental: false
      good:
        prometheus:
          promql: sum(rate(prometheus_http_requests_total{code=~"^2.*"}[1h]))
      total:
        prometheus:
          promql: sum(rate(prometheus_http_requests_total[1h]))
  service: prometheus
  timeWindows:
  - unit: Day
    count: 1
    isRolling: true
  alertPolicies:
  - my-policy-name
  attachments:
  - url: https://loki.my-org.dev/grafana/d/dnd48
    displayName: Grafana Dashboard

func New

func New(metadata Metadata, spec Spec) SLO

New creates a new SLO based on provided Metadata nad Spec.

func (SLO) GetKind

func (s SLO) GetKind() manifest.Kind

func (SLO) GetManifestSource

func (s SLO) GetManifestSource() string

func (SLO) GetName

func (s SLO) GetName() string

func (SLO) GetOrganization

func (s SLO) GetOrganization() string

func (SLO) GetProject

func (s SLO) GetProject() string

func (SLO) GetValidator added in v0.82.0

func (s SLO) GetValidator() validation.Validator[SLO]

func (SLO) GetVersion

func (s SLO) GetVersion() manifest.Version

func (SLO) SetManifestSource

func (s SLO) SetManifestSource(src string) manifest.Object

func (SLO) SetOrganization

func (s SLO) SetOrganization(org string) manifest.Object

func (SLO) SetProject

func (s SLO) SetProject(project string) manifest.Object

func (SLO) Validate

func (s SLO) Validate() error

type Spec

type Spec struct {
	Description     string       `json:"description"`
	Indicator       *Indicator   `json:"indicator,omitempty"`
	BudgetingMethod string       `json:"budgetingMethod"`
	Objectives      []Objective  `json:"objectives"`
	Service         string       `json:"service"`
	TimeWindows     []TimeWindow `json:"timeWindows"`
	AlertPolicies   []string     `json:"alertPolicies"`
	Attachments     []Attachment `json:"attachments,omitempty"`
	// CreatedAt is the date of the [SLO] creation in RFC3339 format.
	// Read-only field.
	CreatedAt string `json:"createdAt,omitempty"`
	// CreatedBy is the id of the user who first created the SLO.
	// Read-only field.
	CreatedBy string `json:"createdBy,omitempty"`
	// Deprecated: this implementation of Composite wil be removed and replaced with new CompositeSpec
	Composite     *Composite     `json:"composite,omitempty"`
	AnomalyConfig *AnomalyConfig `json:"anomalyConfig,omitempty"`
}

Spec holds detailed information specific to SLO.

func (*Spec) AllMetricSpecs

func (s *Spec) AllMetricSpecs() []*MetricSpec

AllMetricSpecs returns slice of all metrics defined in SLO regardless of their type.

func (*Spec) CountMetricPairs

func (s *Spec) CountMetricPairs() []*CountMetricsSpec

CountMetricPairs returns a slice of all count metrics defined in this SLOSpec's objectives.

func (*Spec) CountMetrics

func (s *Spec) CountMetrics() []*MetricSpec

CountMetrics returns a flat slice of all count metrics defined in this SLOSpec's objectives.

func (*Spec) CountMetricsCount

func (s *Spec) CountMetricsCount() int

CountMetricsCount returns total number of all count metrics defined in this SLOSpec's objectives.

func (*Spec) GoodTotalCountMetrics

func (s *Spec) GoodTotalCountMetrics() (good, total []*MetricSpec)

func (*Spec) HasCompositeObjectives added in v0.79.0

func (s *Spec) HasCompositeObjectives() bool

HasCompositeObjectives returns true if any SLOSpec Objective is of composite type.

func (*Spec) HasCountMetrics

func (s *Spec) HasCountMetrics() bool

HasCountMetrics returns true if SLOSpec has count metrics.

func (*Spec) HasRawMetric

func (s *Spec) HasRawMetric() bool

HasRawMetric returns true if SLOSpec has raw metric.

func (*Spec) IsComposite

func (s *Spec) IsComposite() bool

IsComposite returns true if SLOSpec contains composite type. Deprecated: this implementation of Composite will be removed and replaced with new CompositeSpec use HasCompositeObjectives instead for new implementation

func (*Spec) ObjectivesRawMetricsCount

func (s *Spec) ObjectivesRawMetricsCount() int

ObjectivesRawMetricsCount returns total number of all raw metrics defined in this SLO Spec's objectives.

func (*Spec) RawMetrics

func (s *Spec) RawMetrics() []*MetricSpec

RawMetrics returns raw metric spec.

type SplunkMetric

type SplunkMetric struct {
	Query *string `json:"query"`
}

SplunkMetric represents metric from Splunk

type SplunkObservabilityMetric

type SplunkObservabilityMetric struct {
	Program *string `json:"program"`
}

SplunkObservabilityMetric represents metric from SplunkObservability

type Status

type Status struct {
	UpdatedAt    string        `json:"updatedAt,omitempty"`
	ReplayStatus *ReplayStatus `json:"timeTravel,omitempty"`
}

Status holds dynamic fields returned when the Service is fetched from Nobl9 platform. Status is not part of the static object definition.

type SumoLogicMetric

type SumoLogicMetric struct {
	Type         *string `json:"type"`
	Query        *string `json:"query"`
	Quantization *string `json:"quantization,omitempty"`
	Rollup       *string `json:"rollup,omitempty"`
}

SumoLogicMetric represents metric from Sumo Logic.

type ThousandEyesMetric

type ThousandEyesMetric struct {
	TestID   *int64  `json:"testID"`
	TestType *string `json:"testType"`
}

ThousandEyesMetric represents metric from ThousandEyes

type TimeWindow

type TimeWindow struct {
	Unit      string    `json:"unit"`
	Count     int       `json:"count"`
	IsRolling bool      `json:"isRolling"`
	Calendar  *Calendar `json:"calendar,omitempty"`

	// Period is only returned in `/get/slo` requests it is ignored for `/apply`
	Period *Period `json:"period,omitempty"`
}

TimeWindow represents content of time window

func (TimeWindow) GetType

func (tw TimeWindow) GetType() twindow.TimeWindowTypeEnum

GetType returns value of twindow.TimeWindowTypeEnum for given time window>

type WhenDelayed added in v0.79.0

type WhenDelayed string

WhenDelayed represents enum for behavior of Composite SLO objectives

ENUM(

CountAsGood CountAsBad Ignore )

const (
	// WhenDelayedCountAsGood is a WhenDelayed of type CountAsGood.
	WhenDelayedCountAsGood WhenDelayed = "CountAsGood"
	// WhenDelayedCountAsBad is a WhenDelayed of type CountAsBad.
	WhenDelayedCountAsBad WhenDelayed = "CountAsBad"
	// WhenDelayedIgnore is a WhenDelayed of type Ignore.
	WhenDelayedIgnore WhenDelayed = "Ignore"
)

func ParseWhenDelayed added in v0.79.0

func ParseWhenDelayed(name string) (WhenDelayed, error)

ParseWhenDelayed attempts to convert a string to a WhenDelayed.

func WhenDelayedValues added in v0.79.0

func WhenDelayedValues() []WhenDelayed

WhenDelayedValues returns a list of the values for WhenDelayed

func (WhenDelayed) IsValid added in v0.79.0

func (x WhenDelayed) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (WhenDelayed) String added in v0.79.0

func (x WhenDelayed) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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