koigrid 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to the koigrid CLI are documented here. Format: [Keep a Chan
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.22.0] — 2026-11-29
8
+
9
+ ### Added
10
+
11
+ - `koigrid db metrics <id>` and `koigrid redis metrics <id>` take `--metric cpu_pct,connections`, `--bucket 1m|5m|15m|1h|6h|1d`, `--stat avg|max|min` and `--hours 1..168`: only the series you ask for, one point per bucket (at most 2000 per series), like CloudWatch GetMetricData. Without them, the same raw samples as before. Backed by `GET /databases/:id/metrics` and `GET /redis/:id/metrics`.
12
+
7
13
  ## [0.21.0] — 2026-11-29
8
14
 
9
15
  ### Added
@@ -125,9 +125,15 @@ export async function db(a) {
125
125
  const l = st.members || [];
126
126
  return output(l, false, { rows: l.map((x) => ({ member: x.member, role: x.role + (x.papel === 'dr' ? ' (dr)' : ''), allocated: x.measured ? `${x.allocatedGb} GB` : 'not measured', used: x.measured ? `${x.usedGb} GB` : '', pct: x.measured ? `${x.usedPct}%` : '', ago: x.measured ? `${x.measuredAgoSec}s` : '' })), columns: ['member', 'role', 'allocated', 'used', 'pct', 'ago'] });
127
127
  }
128
- case 'metrics':
128
+ case 'metrics': {
129
+ // ?metric=a,b · ?bucket=5m&stat=max · ?hours (ficha c6f869c8, como CloudWatch GetMetricData)
129
130
  need();
130
- return console.log(JSON.stringify(await api(`/databases/${encodeURIComponent(id)}/metrics`), null, 2));
131
+ const q = new URLSearchParams();
132
+ for (const k of ['hours', 'metric', 'bucket', 'stat'])
133
+ if (a.flags[k] != null)
134
+ q.set(k, String(a.flags[k]));
135
+ return console.log(JSON.stringify(await api(`/databases/${encodeURIComponent(id)}/metrics${q.size ? `?${q}` : ''}`), null, 2));
136
+ }
131
137
  // Lo que le pasó a la base y cuándo (ficha faec5dcd, como «Events» de RDS): cambios de líder, máquina perdida,
132
138
  // mantenimiento, copias. `--type` repetible, `--since/--until` (ISO con zona), `--hours`, `--limit`, `--cursor`.
133
139
  case 'events': {
@@ -48,9 +48,15 @@ export async function redis(a) {
48
48
  const res = spawnSync('redis-cli', ['-u', uri], { stdio: 'inherit' });
49
49
  return process.exit(res.status ?? 0);
50
50
  }
51
- case 'metrics':
51
+ case 'metrics': {
52
+ // ?metric=a,b · ?bucket=5m&stat=max · ?hours (ficha c6f869c8, como CloudWatch GetMetricData)
52
53
  need();
53
- return console.log(JSON.stringify(await api(`/redis/${encodeURIComponent(id)}/metrics`), null, 2));
54
+ const q = new URLSearchParams();
55
+ for (const k of ['hours', 'metric', 'bucket', 'stat'])
56
+ if (a.flags[k] != null)
57
+ q.set(k, String(a.flags[k]));
58
+ return console.log(JSON.stringify(await api(`/redis/${encodeURIComponent(id)}/metrics${q.size ? `?${q}` : ''}`), null, 2));
59
+ }
54
60
  case 'apply-config': {
55
61
  // SEC-REDIS-CUTOVER: recrea los nodos para que dejen de llevar la contraseña en sus Args (docker inspect).
56
62
  need();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koigrid",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "koigrid CLI — deploy apps, databases, redis, storage and more from your terminal (or your AI agent).",
5
5
  "bin": {
6
6
  "koigrid": "dist/index.js"