shimesaba

package module
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 19 Imported by: 0

README

Latest GitHub release Github Actions test Go Report Card License

shimesaba

For SRE to operate and monitor services using Mackerel.

Description

shimesaba is a tool for tracking SLO/ErrorBudget using Mackerel as an SLI measurement service.

  • shimesaba evaluates window-based SLOs with monitoring data on Mackerel.
  • Post the calculated values (error budget, failure time for SLO violation, uptime etc) by evaluating SLOs . as Mackerel service metric.

Install

binary packages

Releases.

Homebrew tap
$ brew install mashiike/tap/shimesaba

Usage

as CLI command
$ shimesaba -config config.yaml -mackerel-apikey <Mackerel API Key> 
NAME:
   shimesaba - A commandline tool for tracking SLO/ErrorBudget using Mackerel as an SLI measurement service.

USAGE:
   shimesaba -config <config file> [command options]

VERSION:
   v1.0.0

COMMANDS:
   run        run shimesaba. this is main feature (deprecated), use no subcommand
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --backfill value                   generate report before n point (default: 3) [$BACKFILL, $SHIMESABA_BACKFILL]
   --config value, -c value           config file path, can set multiple [$CONFIG, $SHIMESABA_CONFIG]
   --debug                            output debug log (default: false) [$SHIMESABA_DEBUG]
   --dry-run                          report output stdout and not put mackerel (default: false) [$SHIMESABA_DRY_RUN]
   --mackerel-apikey value, -k value  for access mackerel API (default: *********) [$MACKEREL_APIKEY, $SHIMESABA_MACKEREL_APIKEY]
   --help, -h                         show help (default: false)
   --version, -v                      print the version (default: false)
as AWS Lambda function

shimesaba binary also runs as AWS Lambda function. shimesaba implicitly behaves as a run command when run as a bootstrap with a Lambda Function

CLI options can be specified from environment variables. For example, when MACKEREL_APIKEY environment variable is set, the value is set to -mackerel-apikey option.

Example Lambda functions configuration with github.com/fujiwara/lambroll

{
  "FunctionName": "shimesaba",
  "Environment": {
    "Variables": {
      "SHIMESABA_CONFIG": "config.yaml",
      "MACKEREL_APIKEY": "<Mackerel API KEY>"
    }
  },
  "Handler": "shimesaba",
  "MemorySize": 128,
  "Role": "arn:aws:iam::0123456789012:role/lambda-function",
  "Runtime": "provided.al2",
  "Timeout": 300
}
Configuration file

The following are the settings for the latest v0.7.0.

YAML format.

required_version: ">=1.0.0" # which specifies which versions of shimesaba can be used with your configuration.

# This is a common setting item for error budget calculation.
# It is possible to override the same settings in each SLO definition.
destination:
    service_name: prod          # - The name of the service to which you want to submit the service metric for error budgeting.
    metric_prefix: api          # - Specifies the service metric prefix for error budgeting.
rolling_period: 28d             # - Specify the size of the rolling window to calculate the error budget.
calculate_interval: 1h      # - Settings related to the interval for calculating the error budget.
error_budget_size: 0.1%     # - This setting is related to the size of the error budget.
                            #   If % is used, it is a ratio to the size of the rolling window.
                            #   It is also possible to specify a time such as 1h or 40m.

# Describes the settings for each SLO. SLOs are treated as monitoring rules.
# The definition of each SLO is determined by ORing the monitoring rules that match the conditions specified in `objectives`.
# That is, based on the alerts corresponding to the monitoring rules that match the conditions, the existence of any of the alerts will be judged as SLO violation.
slo:
  # In the availability SLO, if an alert occurs for a monitoring rule name that starts with "SLO availability" 
  #  or an external monitoring rule that ends with "api.example.com", it is considered an SLO violation. 
  - id: availability
    alert_based_sli: # This setting uses Mackerel alerts as SLI.
      - monitor_name_prefix: "SLO availability"
      - monitor_name_suffix: "api.example.com"
        monitor_type: "external" 
  # In the latency SLO, we consider it an SLO violation if an alert occurs for a host metric monitoring rule with a name starting with "SLO availability".
  - id: latency
    error_budget_size: 200m
    alert_based_sli:
      - monitor_name_prefix: "SLO latency"
      - monitor_type: "host"
        try_reassessment: true # This setting attempts to reevaluate an alert using the actual metric only if the type of monitor from which the alert originated is service or host.

slo takes a list of constituent SLI/SLO definitions.
6 Mackerel service metrics will be listed per definition.

For example, if id is latency in the above configuration, the following service metric will be posted.

  • api.error_budget.latency: Current error budget remaining number (unit:minutes)
  • api.error_budget_percentage.latency: percentage of current error budget remaining. If it exceeds 100%, the error budget is used up.
  • api.error_budget_consumption.latency: Error budget newly consumed in this calculation window (unit:minutes)
  • api.error_budget_consumption_percentage.latency: Percentage of newly consumed error budget in this calculation window
  • api.failure_time.latency: Time of SLO violation within the rolling window time frame (unit:minutes)
  • api.uptime.latency: Time that can be treated as normal operation within the time frame of the rolling window (unit:minutes)
Manual correction feature

If you enter downtime:3m or similar in the reason for closing an alert, the alert will be calculated as if the SLO had been violated for 3 minutes from the time it was opened.

The description "3m" can be any time like 1h, 40m, 1h50m, etc. as well as other settings. When combined with other statements, half-width spaces are required before and after the above keywords.

Environment variable SSMWRAP_PATHS, SSMWRAP_NAMES

It incorporates github.com/handlename/ssmwrap for parameter management.
If you specify the path of the Parameter Store of AWS Systems Manager separated by commas, it will be output to the environment variable.
Useful when used as a Lambda function.

For example, if you have a secrets named prod/MACKEREL_APIKEY in your secrets manager, it is useful to set the following environment variable.

SSMWRAP_NAMES=/aws/reference/secretsmanager/prod/MACKEREL_APIKEY

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackfillOption

func BackfillOption(count int) func(*Options)

BackfillOption specifies how many points of data to calculate retroactively from the current time.

func DestinationMetricTypeStrings added in v1.1.0

func DestinationMetricTypeStrings() []string

DestinationMetricTypeStrings returns a slice of all String values of the enum

func DryRunOption

func DryRunOption(dryRun bool) func(*Options)

DryRunOption is an option to output the calculated error budget as standard without posting it to Mackerel.

func DumpReportsOption added in v1.0.0

func DumpReportsOption(dump bool) func(*Options)

Types

type Alert added in v0.6.0

type Alert struct {
	Monitor  *Monitor
	HostID   string
	OpenedAt time.Time
	ClosedAt *time.Time
	Reason   string
	// contains filtered or unexported fields
}

func NewAlert added in v0.6.0

func NewAlert(monitor *Monitor, openedAt time.Time, closedAt *time.Time) *Alert

func NewVirtualAlert added in v1.2.0

func NewVirtualAlert(description string, openedAt time.Time, closedAt time.Time) *Alert

func (*Alert) CorrectionTime added in v0.7.0

func (alert *Alert) CorrectionTime() (time.Duration, bool)

func (*Alert) EvaluateReliabilities added in v0.7.0

func (alert *Alert) EvaluateReliabilities(timeFrame time.Duration, enableReassessment bool) (Reliabilities, error)

func (*Alert) IsVirtual added in v1.2.0

func (alert *Alert) IsVirtual() bool

func (*Alert) String added in v0.6.0

func (alert *Alert) String() string

func (*Alert) WithHostID added in v0.7.0

func (alert *Alert) WithHostID(hostID string) *Alert

func (*Alert) WithReason added in v0.7.0

func (alert *Alert) WithReason(reason string) *Alert

type AlertBasedSLI added in v1.0.0

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

func NewAlertBasedSLI added in v1.0.0

func NewAlertBasedSLI(cfg *AlertBasedSLIConfig) *AlertBasedSLI

func (AlertBasedSLI) EvaluateReliabilities added in v1.0.0

func (o AlertBasedSLI) EvaluateReliabilities(timeFrame time.Duration, alerts Alerts, startAt, endAt time.Time) (Reliabilities, error)

func (AlertBasedSLI) MatchMonitor added in v1.0.0

func (o AlertBasedSLI) MatchMonitor(monitor *Monitor) bool

type AlertBasedSLIConfig added in v1.0.0

type AlertBasedSLIConfig struct {
	MonitorID         string `json:"monitor_id,omitempty" yaml:"monitor_id,omitempty"`
	MonitorName       string `json:"monitor_name,omitempty" yaml:"monitor_name,omitempty"`
	MonitorNamePrefix string `json:"monitor_name_prefix,omitempty" yaml:"monitor_name_prefix,omitempty"`
	MonitorNameSuffix string `json:"monitor_name_suffix,omitempty" yaml:"monitor_name_suffix,omitempty"`
	MonitorType       string `json:"monitor_type,omitempty" yaml:"monitor_type,omitempty"`
	TryReassessment   bool   `json:"try_reassessment,omitempty" yaml:"try_reassessment,omitempty"`
}

func (*AlertBasedSLIConfig) Restrict added in v1.0.0

func (c *AlertBasedSLIConfig) Restrict() error

Restrict restricts a configuration.

type Alerts added in v0.6.0

type Alerts []*Alert

func (Alerts) EndAt added in v0.6.0

func (alerts Alerts) EndAt() time.Time

func (Alerts) StartAt added in v0.6.0

func (alerts Alerts) StartAt() time.Time

type App

type App struct {
	SLODefinitions []*Definition
	// contains filtered or unexported fields
}

App manages life cycle

func New

func New(apikey string, cfg *Config) (*App, error)

New creates an app

func NewWithMackerelClient

func NewWithMackerelClient(client MackerelClient, cfg *Config) (*App, error)

NewWithMackerelClient is there to accept mock clients.

func (*App) Run

func (app *App) Run(ctx context.Context, optFns ...func(*Options)) error

Run performs the calculation of the error bar calculation

type Config

type Config struct {
	RequiredVersion string `yaml:"required_version" json:"required_version"`

	SLOConfig `yaml:"-,inline" json:"-,inline"`
	SLO       []*SLOConfig `yaml:"slo" json:"slo"`
	// contains filtered or unexported fields
}

Config for App

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig creates a default configuration.

func (*Config) Load

func (c *Config) Load(paths ...string) error

Load loads configuration file from file paths.

func (*Config) Restrict

func (c *Config) Restrict() error

Restrict restricts a configuration.

func (*Config) ValidateVersion

func (c *Config) ValidateVersion(version string) error

ValidateVersion validates a version satisfies required_version.

type DataProvider added in v1.0.0

type DataProvider interface {
	FetchAlerts(ctx context.Context, startAt time.Time, endAt time.Time) (Alerts, error)
	FetchVirtualAlerts(ctx context.Context, serviceName string, sloID string, startAt time.Time, endAt time.Time) (Alerts, error)
}

type Definition

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

Definition is SLO Definition

func NewDefinition

func NewDefinition(cfg *SLOConfig) (*Definition, error)

NewDefinition creates Definition from SLOConfig

func (*Definition) AlertBasedSLIs added in v1.0.0

func (d *Definition) AlertBasedSLIs(monitors []*Monitor) []*Monitor

func (*Definition) CreateReports added in v0.5.0

func (d *Definition) CreateReports(ctx context.Context, provider DataProvider, now time.Time, backfill int) ([]*Report, error)

CreateReports returns Report with Metrics

func (*Definition) CreateReportsWithAlertsAndPeriod added in v1.0.0

func (d *Definition) CreateReportsWithAlertsAndPeriod(ctx context.Context, alerts Alerts, startAt, endAt time.Time) ([]*Report, error)

func (*Definition) ID

func (d *Definition) ID() string

ID returns SLOConfig.id

func (*Definition) StartAt added in v1.0.0

func (d *Definition) StartAt(now time.Time, backfill int) time.Time

type Destination added in v0.6.0

type Destination struct {
	ServiceName       string
	MetricPrefix      string
	MetricSuffix      string
	MetricTypeNames   map[DestinationMetricType]string
	MetricTypeEnabled map[DestinationMetricType]bool
}

func NewDestination added in v1.1.0

func NewDestination(cfg *DestinationConfig) *Destination

func (*Destination) MetricEnabled added in v1.1.0

func (d *Destination) MetricEnabled(metricType DestinationMetricType) bool

func (*Destination) MetricName added in v1.1.0

func (d *Destination) MetricName(metricType DestinationMetricType) string

type DestinationConfig added in v1.0.0

type DestinationConfig struct {
	ServiceName  string                              `json:"service_name" yaml:"service_name"`
	MetricPrefix string                              `json:"metric_prefix" yaml:"metric_prefix"`
	MetricSuffix string                              `json:"metric_suffix" yaml:"metric_suffix"`
	Metrics      map[string]*DestinationMetricConfig `json:"metrics" yaml:"metrics"`
}

DestinationConfig is a configuration for submitting service metrics to Mackerel

func (*DestinationConfig) Merge added in v1.0.0

Merge merges DestinationConfig together

func (*DestinationConfig) Restrict added in v1.0.0

func (c *DestinationConfig) Restrict(sloID string) error

Restrict restricts a definition configuration.

type DestinationMetricConfig added in v1.1.0

type DestinationMetricConfig struct {
	MetricTypeName string `json:"metric_type_name,omitempty" yaml:"metric_type_name,omitempty"`
	Enabled        *bool  `json:"enabled,omitempty" yaml:"enabled,omitempty"`
}

func (*DestinationMetricConfig) Merge added in v1.1.0

Merge merges DestinationMetricConfig together

func (*DestinationMetricConfig) Restrict added in v1.1.0

Restrict restricts a definition configuration.

type DestinationMetricType added in v1.1.0

type DestinationMetricType int
const (
	ErrorBudget DestinationMetricType = iota
	ErrorBudgetRemainingPercentage
	ErrorBudgetPercentage
	ErrorBudgetConsumption
	ErrorBudgetConsumptionPercentage
	UpTime //uptime
	FailureTime
)

func DestinationMetricTypeString added in v1.1.0

func DestinationMetricTypeString(s string) (DestinationMetricType, error)

DestinationMetricTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DestinationMetricTypeValues added in v1.1.0

func DestinationMetricTypeValues() []DestinationMetricType

DestinationMetricTypeValues returns all values of the enum

func (DestinationMetricType) DefaultEnabled added in v1.1.0

func (t DestinationMetricType) DefaultEnabled() bool

func (DestinationMetricType) DefaultTypeName added in v1.1.0

func (t DestinationMetricType) DefaultTypeName() string

func (DestinationMetricType) ID added in v1.1.0

func (DestinationMetricType) IsADestinationMetricType added in v1.1.0

func (i DestinationMetricType) IsADestinationMetricType() bool

IsADestinationMetricType returns "true" if the value is listed in the enum definition. "false" otherwise

func (DestinationMetricType) MarshalYAML added in v1.1.0

func (i DestinationMetricType) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for DestinationMetricType

func (DestinationMetricType) String added in v1.1.0

func (i DestinationMetricType) String() string

func (*DestinationMetricType) UnmarshalYAML added in v1.1.0

func (i *DestinationMetricType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for DestinationMetricType

type DryRunMackerelClient added in v0.6.1

type DryRunMackerelClient struct {
	MackerelClient
}

func (DryRunMackerelClient) PostServiceMetricValues added in v0.6.1

func (c DryRunMackerelClient) PostServiceMetricValues(serviceName string, metricValues []*mackerel.MetricValue) error

type IsNoViolationCollection added in v0.6.0

type IsNoViolationCollection map[time.Time]bool

func (IsNoViolationCollection) IsUp added in v0.6.0

func (IsNoViolationCollection) NewReliabilities added in v0.7.0

func (c IsNoViolationCollection) NewReliabilities(timeFrame time.Duration, startAt, endAt time.Time) (Reliabilities, error)

type MackerelClient

type MackerelClient interface {
	GetOrg() (*mackerel.Org, error)
	FindHosts(param *mackerel.FindHostsParam) ([]*mackerel.Host, error)
	FetchHostMetricValues(hostID string, metricName string, from int64, to int64) ([]mackerel.MetricValue, error)
	FetchServiceMetricValues(serviceName string, metricName string, from int64, to int64) ([]mackerel.MetricValue, error)
	PostServiceMetricValues(serviceName string, metricValues []*mackerel.MetricValue) error

	FindWithClosedAlerts() (*mackerel.AlertsResp, error)
	FindWithClosedAlertsByNextID(nextID string) (*mackerel.AlertsResp, error)
	GetMonitor(monitorID string) (mackerel.Monitor, error)
	FindMonitors() ([]mackerel.Monitor, error)

	FindGraphAnnotations(service string, from int64, to int64) ([]*mackerel.GraphAnnotation, error)
}

MackerelClient is an abstraction interface for mackerel-client-go.Client

type Monitor added in v0.6.0

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

func NewMonitor added in v0.7.0

func NewMonitor(id, name, monitorType string) *Monitor

func (*Monitor) EvaluateReliabilities added in v0.7.0

func (m *Monitor) EvaluateReliabilities(hostID string, timeFrame time.Duration, startAt, endAt time.Time) (Reliabilities, bool)

func (*Monitor) ID added in v0.6.0

func (m *Monitor) ID() string

func (*Monitor) Name added in v0.6.0

func (m *Monitor) Name() string

func (*Monitor) String added in v0.6.0

func (m *Monitor) String() string

func (*Monitor) Type added in v0.6.0

func (m *Monitor) Type() string

func (*Monitor) WithEvaluator added in v0.7.0

func (m *Monitor) WithEvaluator(evaluator func(hostID string, timeFrame time.Duration, startAt, endAt time.Time) (Reliabilities, bool)) *Monitor

type Options added in v0.3.0

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

type Reliabilities added in v0.7.0

type Reliabilities []*Reliability

Reliabilities is sortable

func NewReliabilities added in v0.7.0

func NewReliabilities(s []*Reliability) (Reliabilities, error)

func (Reliabilities) CalcTime added in v0.7.0

func (c Reliabilities) CalcTime(cursor, n int) (upTime, failureTime, deltaFailureTime time.Duration)

func (Reliabilities) Clone added in v0.7.0

func (c Reliabilities) Clone() Reliabilities

func (Reliabilities) CursorAt added in v0.7.0

func (c Reliabilities) CursorAt(i int) time.Time

CursorAt is a representative value of the time shown by the tumbling window

func (Reliabilities) Len added in v0.7.0

func (c Reliabilities) Len() int

func (Reliabilities) Less added in v0.7.0

func (c Reliabilities) Less(i, j int) bool

func (Reliabilities) Merge added in v0.7.0

func (c Reliabilities) Merge(other Reliabilities) (Reliabilities, error)

Merge two collection

func (Reliabilities) MergeInRange added in v0.7.0

func (c Reliabilities) MergeInRange(other Reliabilities, startAt, endAt time.Time) (Reliabilities, error)

func (Reliabilities) Swap added in v0.7.0

func (c Reliabilities) Swap(i, j int)

func (Reliabilities) TimeFrame added in v0.7.0

func (c Reliabilities) TimeFrame() time.Duration

TimeFrame is the size of the tumbling window

type Reliability added in v0.6.0

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

Reliability represents a group of values related to reliability per tumbling window.

func NewReliability added in v0.6.0

func NewReliability(cursorAt time.Time, timeFrame time.Duration, isNoViolation IsNoViolationCollection) *Reliability

func (*Reliability) Clone added in v0.6.0

func (r *Reliability) Clone() *Reliability

func (*Reliability) CursorAt added in v0.6.0

func (r *Reliability) CursorAt() time.Time

CursorAt is a representative value of the time shown by the tumbling window

func (*Reliability) FailureTime added in v0.6.0

func (r *Reliability) FailureTime() time.Duration

FailureTime is the time when reliability could not be ensured, i.e. SLO was violated

func (*Reliability) Merge added in v0.6.0

func (r *Reliability) Merge(other *Reliability) (*Reliability, error)

Merge must be the same tumbling window

func (*Reliability) TimeFrame added in v0.6.0

func (r *Reliability) TimeFrame() time.Duration

TimeFrame is the size of the tumbling window

func (*Reliability) TimeFrameEndAt added in v0.6.0

func (r *Reliability) TimeFrameEndAt() time.Time

TimeFrameEndAt is the end time of the tumbling window

func (*Reliability) TimeFrameStartAt added in v0.6.0

func (r *Reliability) TimeFrameStartAt() time.Time

TimeFrameStartAt is the start time of the tumbling window

func (*Reliability) UpTime added in v0.6.0

func (r *Reliability) UpTime() time.Duration

UpTime is the uptime that can guarantee reliability.

type Report

type Report struct {
	DefinitionID           string
	Destination            *Destination
	DataPoint              time.Time
	TimeFrameStartAt       time.Time
	TimeFrameEndAt         time.Time
	UpTime                 time.Duration
	FailureTime            time.Duration
	ErrorBudgetSize        time.Duration
	ErrorBudget            time.Duration
	ErrorBudgetConsumption time.Duration
}

Report has SLI/SLO/ErrorBudget numbers in one rolling window

func NewReport added in v0.6.0

func NewReport(definitionID string, destination *Destination, cursorAt time.Time, timeFrame time.Duration, errorBudgetSize float64) *Report

func NewReports added in v0.6.0

func NewReports(definitionID string, destination *Destination, errorBudgetSize float64, timeFrame time.Duration, reliability Reliabilities) []*Report

func (*Report) ErrorBudgetConsumptionRate

func (r *Report) ErrorBudgetConsumptionRate() float64

ErrorBudgetConsumptionRate returns ErrorBudgetConsumption/ErrorBudgetSize

func (*Report) ErrorBudgetUsageRate

func (r *Report) ErrorBudgetUsageRate() float64

ErrorBudgetUsageRate returns (1.0 - ErrorBudget/ErrorBudgetSize)

func (*Report) GetDestinationMetricValue added in v1.1.0

func (r *Report) GetDestinationMetricValue(metricType DestinationMetricType) float64

func (*Report) MarshalJSON

func (r *Report) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Report) SetTime added in v0.6.0

func (r *Report) SetTime(upTime time.Duration, failureTime time.Duration, deltaFailureTime time.Duration)

func (*Report) String

func (r *Report) String() string

String implements fmt.Stringer

type Repository

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

Repository handles reading and writing data

func NewRepository

func NewRepository(client MackerelClient) *Repository

NewRepository creates Repository

func (*Repository) FetchAlerts added in v0.6.0

func (repo *Repository) FetchAlerts(ctx context.Context, startAt time.Time, endAt time.Time) (Alerts, error)

FetchAlerts retrieves alerts for a specified period of time

func (*Repository) FetchVirtualAlerts added in v1.2.0

func (repo *Repository) FetchVirtualAlerts(ctx context.Context, serviceName string, sloID string, startAt time.Time, endAt time.Time) (Alerts, error)

FetchVirtualAlerts retrieves graph annotations for a specified time period and returns them as virtual alerts.

func (*Repository) FindMonitors added in v0.6.0

func (repo *Repository) FindMonitors() ([]*Monitor, error)

func (*Repository) GetOrgName added in v0.7.0

func (repo *Repository) GetOrgName(ctx context.Context) (string, error)

func (*Repository) SaveReports

func (repo *Repository) SaveReports(ctx context.Context, reports []*Report) error

SaveReports posts Reports to Mackerel

func (*Repository) WithDryRun added in v0.6.1

func (repo *Repository) WithDryRun() *Repository

type SLOConfig added in v1.0.0

type SLOConfig struct {
	ID                string                 `json:"id" yaml:"id"`
	RollingPeriod     string                 `yaml:"rolling_period" json:"rolling_period"`
	Destination       *DestinationConfig     `yaml:"destination" json:"destination"`
	ErrorBudgetSize   interface{}            `yaml:"error_budget_size" json:"error_budget_size"`
	AlertBasedSLI     []*AlertBasedSLIConfig `json:"alert_based_sli" yaml:"alert_based_sli"`
	CalculateInterval string                 `yaml:"calculate_interval" json:"calculate_interval"`
	// contains filtered or unexported fields
}

SLOConfig is a setting related to SLI/SLO

func (*SLOConfig) DurationCalculate added in v1.0.0

func (c *SLOConfig) DurationCalculate() time.Duration

DurationCalculate converts CalculateInterval as time.Duration

func (*SLOConfig) DurationRollingPeriod added in v1.0.0

func (c *SLOConfig) DurationRollingPeriod() time.Duration

DurationRollingPeriod converts RollingPeriod as time.Duration

func (*SLOConfig) ErrorBudgetSizePercentage added in v1.1.0

func (c *SLOConfig) ErrorBudgetSizePercentage() float64

func (*SLOConfig) Merge added in v1.0.0

func (c *SLOConfig) Merge(o *SLOConfig) *SLOConfig

Merge merges SLOConfig together

func (*SLOConfig) Restrict added in v1.0.0

func (c *SLOConfig) Restrict() error

Restrict restricts a definition configuration.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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