Skip to content

Commit 01e47bc

Browse files
authored
Merge pull request #15 from schubergphilis/feat/list-slo-downtime
Feat/list slo downtime
2 parents a39bd27 + fc7fa50 commit 01e47bc

6 files changed

Lines changed: 804 additions & 23 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,7 @@ cython_debug/
220220

221221
## Complexipy cache
222222
.complexipy_cache/
223+
224+
# oh-my-claudecode operational state (keep project skills committable)
225+
.omc/
226+
!.omc/skills/

.security-overrides

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
# GHSA-xxxx-yyyy-zzzz
2424
# PYSEC-2025-0001
2525

26-
# pip 26.1.1 -> fixed in 26.1.2, but selection is blocked by [tool.uv] exclude-newer.
27-
# Expires so the audit re-checks once 26.1.2 is selectable via `uv lock --upgrade-package pip`.
28-
PYSEC-2026-196::2026-06-19
26+
# Both fixes exist on PyPI but are held back by [tool.uv] exclude-newer = "1 week"
27+
# (a release isn't selectable until it ages past the window). Time-boxed so the audit
28+
# re-checks once they're selectable via `uv lock --upgrade-package <pkg>`.
29+
#
30+
# pip 26.1.1 -> fixed in 26.1.2 (the installer; not shipped in the wheel).
31+
PYSEC-2026-196::2026-08-17
32+
# msgpack 1.1.2 (transitive via niquests) -> fixed in 1.2.1.
33+
GHSA-6v7p-g79w-8964::2026-08-17

README.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ Check the installed version with `datadog-slo-overrides --version`.
4545

4646
| Command | What it does |
4747
|---------|--------------|
48-
| `run` | Preview (default) or `--apply` corrections to every SLO matching the tags. |
48+
| `set` | Preview (default) or `--apply` corrections (overrides) to every SLO matching the tags. |
49+
| `list` | List SLOs matching the tags and their monitor downtime in a window, excluding downtime already covered by an override. |
4950
| `init-config` | Write a starter config of non-secret defaults. |
5051
| `init-envrc` | Write a starter `.envrc` for optional, direnv-managed credential loading. |
52+
| `commands list` | Print a tree of every command this CLI provides. |
5153

5254
### Credentials
5355

@@ -79,7 +81,7 @@ actionable hint instead of failing silently. The config dir honours `XDG_CONFIG_
7981

8082
### Idempotency strategies
8183

82-
`run` is idempotent: re-running the same command never creates duplicate corrections.
84+
`set` is idempotent: re-running the same command never creates duplicate corrections.
8385
`--strategy` controls when an existing correction counts as already covering your window:
8486

8587
| `--strategy` | Skips (creates nothing) when… |
@@ -93,14 +95,14 @@ actionable hint instead of failing silently. The config dir honours `XDG_CONFIG_
9395
Preview which SLOs would be corrected (dry run — nothing is written):
9496

9597
```sh
96-
datadog-slo-overrides run --tag app:gitlab --tag customer:sbp \
98+
datadog-slo-overrides set --tag app:gitlab --tag customer:sbp \
9799
--start 2026-06-10T22:00 --end 2026-06-11T00:00
98100
```
99101

100102
Apply a 2-hour scheduled-maintenance correction:
101103

102104
```sh
103-
datadog-slo-overrides run --tag app:gitlab --tag customer:sbp \
105+
datadog-slo-overrides set --tag app:gitlab --tag customer:sbp \
104106
--start 2026-06-10T22:00 --end 2026-06-11T00:00 \
105107
--category "Scheduled Maintenance" --description "DB maintenance" \
106108
--apply
@@ -125,7 +127,45 @@ the built-in defaults. Credentials are **never** read from this file.
125127
datadog-slo-overrides init-config
126128
```
127129

128-
Run `datadog-slo-overrides run --help` for the full list of options.
130+
Run `datadog-slo-overrides set --help` for the full list of options.
131+
132+
### Listing downtime
133+
134+
`list` shows each matching SLO's **monitor downtime** (from Datadog's Downtimes API) within a
135+
window, and **excludes any downtime already covered by an SLO correction (override)** — so what
136+
remains is the downtime that is *not* yet accounted for. The window defaults to the start of the
137+
current month through now; set `--start`/`--end` to change it. Tag selection is optional (omit both
138+
`--tag` and `--tags-query` to list every SLO).
139+
140+
```sh
141+
# Uncovered downtime this month, for SLOs tagged app:gitlab:
142+
datadog-slo-overrides list --tag app:gitlab
143+
144+
# A specific window:
145+
datadog-slo-overrides list --tag app:gitlab --start 2026-07-01 --end 2026-07-15
146+
```
147+
148+
```text
149+
Tags query : app:gitlab
150+
Window : 2026-07-01 00:00 → 2026-07-17 14:30 UTC
151+
Matched : 2 SLO(s)
152+
153+
SBP - SLO monitor for the sbp gitlab Website (fbb8a2c3…)
154+
monitors: 12345
155+
• 2026-07-09 10:00 → 2026-07-09 11:00 (monitor 12345) "deploy mute"
156+
```
157+
158+
Only `type: monitor` SLOs link to monitors (via `monitor_ids`), so metric and time-slice SLOs show
159+
no monitor downtime. Downtimes targeted by monitor **tags/scope** (rather than a specific monitor
160+
id) can't be mapped to an SLO from the list alone, and are reported as a note at the end.
161+
162+
### Command tree
163+
164+
```sh
165+
datadog-slo-overrides commands list
166+
```
167+
168+
Prints a tree of every command the CLI provides.
129169
<!-- usage-end -->
130170

131171
## Developing further

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ extra-paths = ["_CI/lib/vendor"]
213213
[tool.pylint.MASTER]
214214
init-hook = "import sys; sys.path.append('src/'); sys.path.append('_CI/lib/vendor/')"
215215

216+
[tool.pylint.FORMAT]
217+
# The CLI is intentionally a single flat module (module name == package name);
218+
# it holds the full command surface plus thorough Google docstrings on every
219+
# helper, so allow more than the 1000-line default.
220+
max-module-lines = 2000
221+
216222
[tool.pylint."MESSAGES CONTROL"]
217223
max-line-length = 120
218224
disable = [

0 commit comments

Comments
 (0)