sloctl replay
You can replay SLOs using sloctl
commands.
With sloctl
, you can replay SLOs in bulk and remove queued Replays from the queue.
We recommend updating sloctl
to these versions or higher for the following functionality:
- Version
0.6.0
: replaying SLOs from other SLOs (experimental) - Version
0.8.0
: Replay queue management - Version
0.13.0
: Replay cancellation
Subcommandsβ
The available sloctl replay
subcommands are as follows:
Subcommand | Description | Available flags |
---|---|---|
cancel | Cancel an ongoing Replay Works only during data import | -p , --project : cancel Replays from a specified project |
delete | Remove the Replay from the queue | --all : delete all queued Replays-p , --project : delete Replays from a specified project |
list | Get the list of all Replays in an organization | Global flags only |
Usageβ
sloctl
executes commands in the %UserProfile%\.config\nobl9\
directory on Windows and ~/.config/nobl9/
on other operating systems.
Provide the path to your SLO definition when it's located in a different directory.
To replay an SLO, run:
sloctl replay -p [project-name] --from=[YYYY-MM-DDThh:mm:ssZ] [slo-name]
Provide the following:
Parameter | Description | Default / alternative |
---|---|---|
[project-name] | The name identifier of your required SLO's parent project | Your context's default project |
[YYYY-MM-DDThh:mm:ssZ] | The start time of the required period for historical data retrieval in the RFC 3339 format | Specify the historical data retrieval start in the YAML definition you're |
[slo-name] | The name identifier of your required SLO | N/A |
You can replay SLOs providing YAML definitions. For this, run one of the following commands:
Command | Description |
---|---|
sloctl replay -f [my-slo.yaml] | Replay an SLO providing its YAML definition |
sloctl replay <./[my-slo.yaml] | Replay an SLO using its definition YAML from stdin |
To replay several SLOs in bulk, add as many SLOs to the YAML definition as you need.
In this case, the first two Replays start immediately, provided all Replay slots are free.
For further Replays, sloctl
reports if they are queued successfully.
Failures can occur because of the following:
Reason | Troubleshooting |
---|---|
A given SLO is currently being replayed or queued | Wait until Replay is complete, or remove Replay from the queue |
Not enough permissions to replay SLOs | To replay SLOs, you role must be Project owner, Project editor, or Organization admin |
No access to parent projects of the involved SLOs | Ask the required project owner for access |
Replay period for an SLO exceeds the maxDuration period set for the connected data source | Narrow down Replay period. Find maximum period for historical data retrieval allowed by your data source |
List Replaysβ
To list Replays, run:
sloctl replay list
sloctl
returns the list of all ongoing and queued Replays in your organization.
Field | Description | Notes |
---|---|---|
slo | The name identifier of an SLO being replayed | Requires access to SLO's parent project |
project | The name identifier of the replayed SLO's parent project | Indicates the project holding a replayed or queued SLO |
elapsedTime | How long Replay is running | Requires access to SLO's parent project |
retrievedScope | The replayed timeframe | Requires access to SLO's parent project |
retrievedFrom | The timeframe start time | Requires access to SLO's parent project |
status | Replay status | in progres : the SLO is being replayedqueued : Replay is in queue |
cancellation | The possibility to cancel data import | possible : data is being imported, you can cancel Replayrequested : Replay cancellation requested, waiting for the response from the backenddenied : data import is over, cancellation request cannot be completedblocked : data is being imported, you cannot cancel Replay |
When no Replays are queued or in progress at the moment when you run sloctl replay list
, the command returns Replay not found
.
Remove from queueβ
You can also clear the queue in your organization. For this, remove Replays one by one.
When you remove a Replay from the queue, Replay proceeds with the next SLO in the queue.
To remove a Replay from the queue, run one of the following commands:
Command | Description |
---|---|
sloctl replay delete [slo-name] -p [project_name] | Removes an individual Replay from the queue |
sloctl replay delete -all | Removes all Replays from the queue |
Cancel Replayβ
You can cancel Replay at the data import step. For this, run
sloctl replay cancel <slo-name> [flags]
Available flags:
Flag | Shorthand | Description |
---|---|---|
--project | -p | The name identifier of a project holding your required SLO |
Applying SLOs with --replayβ
You can apply SLOs and replay them immediately.
For this, apply the required SLO YAML definitions followed by --replay
:
sloctl apply -f [SLO YAML definition] --replay --from=[time in the RFC 3339 format]
This way, you apply the YAML and replay your SLO at the same time.
Replaying SLOs from other SLOsβ
This is an experimental feature currently under development. It is available only with sloctl
version 0.6.0
or higher.
You can also replay SLOs using other SLOs as the historical data source.
For this, run sloctl replay
providing a configuration file.
In the configuration file, provide your required source SLO name with the sourceSLO
field.
When no source SLO is provided, Replay re-imports historical data from the SLO's original data source.
To replay an SLO using historical data of another SLO, do the following:
- Prepare the configuration YAML.
You can provide more than one target SLO in this configuration. All target SLOs provided in such configuration will be replayed using a source SLO.
For example,Sample YAML configuration# Specifies the SLO to replay
- slo: target-slo-1
# The project where the target SLO is located
project: target-project-1
# The timestamp indicating when to begin the replay
from: 2023-02-02T15:02:05Z
# Defines the SLO to be used as the data source for the replay
sourceSLO:
slo: source-slo-1
project: source-project-1
# The objectivesMap field defines how objectives from the source SLO map to those of the target SLO
objectivesMap:
# A list of mappings, where each mapping defines a source objective from sourceSLO to a target objective in the target SLO
# All objectives in the target SLO must be mapped to a source objective
# The same source objective can be mapped to multiple target objectives
# Not all source objectives must be used
- source: objective-1
target: objective-1
- source: objective-2
target: objective-2
- source: objective-3
target: objective-3
# DISCLAIMER: The sourceSLO configurations do not affect the target SLO
# Only the SLI is copied, and no changes are made to the configuration of the target SLO
# Specifies the second SLO to replay
- slo: target-slo-2
project: target-project-2
from: 2023-02-02T15:02:05+02:00
sourceSLO:
slo: source-slo-2
project: source-project-2
objectivesMap:
- source: objective-1
target: objective-1 - Run:
sloctl replay -f ./your-configuration.yaml
A single configuration file can contain settings for replaying from bothβthe original data source and another SLO.
Functional requirementsβ
- If
sourceSLO
is omitted, Replay uses the original data source of the target SLO. sourceSLO
and its objectives must exist before replaying.slo
andsourceSLO
must use the same metric type (threshold or ratio). For ratio metrics, both SLOs must have the same numerator type (good or bad).slo
andsourceSLO
must use the same subtype of ratio metric (incremental or non-incremental) to avoid incorrect results or overwriting replayed SLOs with invalid data.slo
andsourceSLO
can belong to different projects and use different data sources, time windows, queries, budgeting methods, targets, and values.- You can provide the same SLO as
slo
andsourceSLO
. This replays your SLO using its own existing SLI data. This way, no new data is imported from the data source.
Constraintsβ
- You cannot replay an SLO while it's used as a
sourceSLO
. - You can modify or delete a
sourceSLO
while it's in use. Any changes made after Replay has started won't affect the ongoing Replay process. - RBAC: to trigger Replay, you must have at least view permission for the project holding the source SLO.
- Both the target SLO's data source and the
sourceSLO
's data source must support Replay.
Key takeawaysβ
Replaying SLOs is a permanent action and cannot be rolled back.
Learn more about Replay impact on connected resources.
- Replay can fail in the following cases:
- Your data source is unsupported
- The maximum period for historical data retrieval for your data source is set to
0
- A given SLO is currently being replayed
- Replay for a given SLO is queued
- When your SLO has alert policies attached, alerting is suspended for the entire Replay duration. It resumes once the Replay process is complete.
- If the project is not set, it is inferred from Nobl9
config.toml
for the current context. - If
from
is not provided in the config file, you must specify it with--from=[time]
flag. - Setting the
--project
or--from=[]
flags don't override the configuration values.
Minimum configuration with parameters can be set globally with flags:
cat <<EOF | sloctl replay -p my-project --from 2024-10-20T15:00:00Z
- slo: my-slo
- slo: my-another-slo
EOF