@tsuga/cli 1.37.0 → 1.39.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/README.md +49 -33
- package/dist/cli.js +287 -171
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -30,10 +30,10 @@ For `bash` and `zsh`, add the matching line to your shell startup file:
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# ~/.bashrc
|
|
33
|
-
eval "$(tsuga
|
|
33
|
+
eval "$(tsuga --completions bash)"
|
|
34
34
|
|
|
35
35
|
# ~/.zshrc
|
|
36
|
-
eval "$(tsuga
|
|
36
|
+
eval "$(tsuga --completions zsh)"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Then open a new shell (or `source` the file).
|
|
@@ -41,7 +41,7 @@ Then open a new shell (or `source` the file).
|
|
|
41
41
|
For `fish`, write the script to your completions directory:
|
|
42
42
|
|
|
43
43
|
```fish
|
|
44
|
-
tsuga
|
|
44
|
+
tsuga --completions fish > ~/.config/fish/completions/tsuga.fish
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Fish loads it automatically in new shells.
|
|
@@ -80,7 +80,7 @@ tsuga auth logout
|
|
|
80
80
|
|
|
81
81
|
After `tsuga auth login`, commands work without an Operation API key.
|
|
82
82
|
|
|
83
|
-
Sessions renew themselves: the login also saves a refresh token, and the CLI exchanges it for a new access token when the current one is within five minutes of expiry. You log in again when the refresh token expires, when it is revoked, or when the session
|
|
83
|
+
Sessions renew themselves: the login also saves a refresh token, and the CLI exchanges it for a new access token when the current one is within five minutes of expiry. You log in again when the refresh token expires, when it is revoked, or when the session has no refresh token.
|
|
84
84
|
|
|
85
85
|
### Operation API key
|
|
86
86
|
|
|
@@ -117,11 +117,11 @@ Commands have built-in defaults so you can omit common flags:
|
|
|
117
117
|
| `--query` | `*` |
|
|
118
118
|
| `--max-results` | `100` |
|
|
119
119
|
|
|
120
|
-
Override defaults persistently
|
|
120
|
+
Override defaults persistently. The value is given with `--value`:
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
|
-
tsuga config set default from
|
|
124
|
-
tsuga config set default query 'level:ERROR'
|
|
123
|
+
tsuga config set default from --value=-1h
|
|
124
|
+
tsuga config set default query --value 'level:ERROR'
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Current defaults are listed by `tsuga config` (custom overrides marked with `*`).
|
|
@@ -135,7 +135,7 @@ tsuga config reset defaults
|
|
|
135
135
|
Clear a single default by setting it to an empty value:
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
tsuga config set default cluster ''
|
|
138
|
+
tsuga config set default cluster --value ''
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
## Clusters
|
|
@@ -149,7 +149,7 @@ tsuga clusters list
|
|
|
149
149
|
Pick the cluster you want to use by default via the defaults mechanism:
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
tsuga config set default cluster <CLUSTER_ID>
|
|
152
|
+
tsuga config set default cluster --value <CLUSTER_ID>
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
Override per-command without persisting:
|
|
@@ -209,15 +209,17 @@ For resources with server-side filters, narrowing the query beats paging through
|
|
|
209
209
|
|
|
210
210
|
### Explaining a call with `--rationale`
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
backend request log, which is useful for understanding agent behavior.
|
|
215
|
-
since its message already explains why it's being sent.
|
|
212
|
+
Every command accepts an optional `--rationale` flag to record why it is being run. It does not
|
|
213
|
+
change the result; the text is sent as a request header on any API call the command makes, and
|
|
214
|
+
recorded in the backend request log, which is useful for understanding agent behavior.
|
|
216
215
|
|
|
217
216
|
```bash
|
|
218
217
|
tsuga logs patterns --rationale "exploring telemetry to investigate prod outage"
|
|
219
218
|
```
|
|
220
219
|
|
|
220
|
+
`--rationale`, `--cluster` and `--operation-api-key` are shared flags: they may be given before
|
|
221
|
+
or after the subcommand, and are inherited by every subcommand.
|
|
222
|
+
|
|
221
223
|
### Available resources
|
|
222
224
|
|
|
223
225
|
`cloud-resources`, `dashboard-folders`, `dashboards`, `ingestion-api-keys`, `investigations`, `monitors`, `notification-integrations`, `notification-rules`, `notification-silences`, `public-tokens`, `quality-reports`, `retention-policies`, `log-routes`, `services`, `slos`, `tag-policies`, `teams`
|
|
@@ -285,6 +287,8 @@ tsuga retention-policies delete abc-123
|
|
|
285
287
|
|
|
286
288
|
### Time formats
|
|
287
289
|
|
|
290
|
+
Use an equals sign for negative offsets, such as `--from=-1h`.
|
|
291
|
+
|
|
288
292
|
`--from` and `--to` accept any of:
|
|
289
293
|
|
|
290
294
|
| Format | Example |
|
|
@@ -297,7 +301,7 @@ tsuga retention-policies delete abc-123
|
|
|
297
301
|
### Search logs
|
|
298
302
|
|
|
299
303
|
```bash
|
|
300
|
-
tsuga logs search --from
|
|
304
|
+
tsuga logs search --from=-1h --query 'level:ERROR'
|
|
301
305
|
tsuga logs search --from 1704067200 --to 1704153600 --query 'service:api'
|
|
302
306
|
```
|
|
303
307
|
|
|
@@ -306,40 +310,40 @@ dot-paths from each log, and `-o tsv|csv` for tabular output:
|
|
|
306
310
|
|
|
307
311
|
```bash
|
|
308
312
|
# JSON projected to selected fields (preserves the {logs: [...]} envelope and nesting)
|
|
309
|
-
tsuga logs search --from
|
|
313
|
+
tsuga logs search --from=-10m \
|
|
310
314
|
--fields timestamp,level,message,context.k8s.pod.name
|
|
311
315
|
|
|
312
316
|
# TSV with default columns: timestamp, level, message
|
|
313
|
-
tsuga logs search --from
|
|
317
|
+
tsuga logs search --from=-10m --query 'level:ERROR' -o tsv
|
|
314
318
|
|
|
315
319
|
# CSV with custom columns
|
|
316
|
-
tsuga logs search --from
|
|
320
|
+
tsuga logs search --from=-10m -o csv \
|
|
317
321
|
--fields timestamp,level,message,context.k8s.pod.name
|
|
318
322
|
```
|
|
319
323
|
|
|
320
324
|
### Log attributes
|
|
321
325
|
|
|
322
326
|
```bash
|
|
323
|
-
tsuga logs attributes --from
|
|
327
|
+
tsuga logs attributes --from=-1h
|
|
324
328
|
```
|
|
325
329
|
|
|
326
330
|
### Log patterns
|
|
327
331
|
|
|
328
332
|
```bash
|
|
329
333
|
# Group recent logs into patterns
|
|
330
|
-
tsuga logs patterns --from
|
|
334
|
+
tsuga logs patterns --from=-1h --query 'level:ERROR'
|
|
331
335
|
|
|
332
336
|
# List new error patterns observed in the time range
|
|
333
|
-
tsuga logs new-error-patterns --from
|
|
337
|
+
tsuga logs new-error-patterns --from=-24h --team my-team --service api --env prod
|
|
334
338
|
|
|
335
339
|
# List error patterns whose volume increased for a team
|
|
336
|
-
tsuga logs error-pattern-increases --from
|
|
340
|
+
tsuga logs error-pattern-increases --from=-24h --team my-team --env prod
|
|
337
341
|
```
|
|
338
342
|
|
|
339
343
|
### Search traces
|
|
340
344
|
|
|
341
345
|
```bash
|
|
342
|
-
tsuga traces search --from
|
|
346
|
+
tsuga traces search --from=-30m --query 'span_name:GET'
|
|
343
347
|
```
|
|
344
348
|
|
|
345
349
|
### Summarize a trace
|
|
@@ -348,7 +352,7 @@ Aggregates groups of similar spans into synthetic summary spans (marked with
|
|
|
348
352
|
`spanAttributes.aggregation.is_summary`) for a compact view of large traces:
|
|
349
353
|
|
|
350
354
|
```bash
|
|
351
|
-
tsuga traces summarize --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from
|
|
355
|
+
tsuga traces summarize --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from=-30m
|
|
352
356
|
```
|
|
353
357
|
|
|
354
358
|
### Trace latency summary
|
|
@@ -357,13 +361,13 @@ Summarizes where wall-clock time is spent in a trace: each slice of the timeline
|
|
|
357
361
|
is attributed to the services with active leaf spans, with per-service totals:
|
|
358
362
|
|
|
359
363
|
```bash
|
|
360
|
-
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from
|
|
364
|
+
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from=-30m
|
|
361
365
|
|
|
362
366
|
# Per-service totals only, without the range timeline
|
|
363
|
-
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from
|
|
367
|
+
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from=-30m --no-ranges
|
|
364
368
|
|
|
365
369
|
# Collapse timeline ranges shorter than 50ms (0 disables collapsing)
|
|
366
|
-
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from
|
|
370
|
+
tsuga traces latency-summary --trace-id 78c99c5bb1e4a30297fa134b9dbec64f --from=-30m --min-range-duration-ms 50
|
|
367
371
|
```
|
|
368
372
|
|
|
369
373
|
### Contrast sets
|
|
@@ -431,10 +435,10 @@ with `topK`, `minLift`, and `minSupport`; restrict the attributes tested with
|
|
|
431
435
|
|
|
432
436
|
```bash
|
|
433
437
|
# List all metrics
|
|
434
|
-
tsuga metrics list --from
|
|
438
|
+
tsuga metrics list --from=-1h
|
|
435
439
|
|
|
436
440
|
# Get a specific metric
|
|
437
|
-
tsuga metrics get my.metric.name --from
|
|
441
|
+
tsuga metrics get my.metric.name --from=-1h
|
|
438
442
|
|
|
439
443
|
# List dashboards and monitors that use a metric
|
|
440
444
|
tsuga metrics assets-usage my.metric.name
|
|
@@ -460,7 +464,7 @@ tsuga aggregation scalar --generate-skeleton > query.json
|
|
|
460
464
|
Inspect service dependency graphs:
|
|
461
465
|
|
|
462
466
|
```bash
|
|
463
|
-
tsuga service-graph get <SERVICE_ID> --from
|
|
467
|
+
tsuga service-graph get <SERVICE_ID> --from=-1h --query 'env:prod'
|
|
464
468
|
```
|
|
465
469
|
|
|
466
470
|
## Kubernetes
|
|
@@ -471,10 +475,11 @@ Explore Kubernetes resources observed across the organization, inferred from you
|
|
|
471
475
|
tsuga kubernetes pods --search my-service
|
|
472
476
|
tsuga kubernetes clusters
|
|
473
477
|
tsuga kubernetes nodes --search ip-10-0
|
|
478
|
+
tsuga kubernetes events --search my-pod
|
|
474
479
|
tsuga kubernetes pod-details --k8s-cluster prod --k8s-namespace default --pod-name my-pod-abc123
|
|
475
480
|
```
|
|
476
481
|
|
|
477
|
-
Available resources: `pods`, `clusters`, `namespaces`, `nodes`, `deployments`, `statefulsets`, `daemonsets` (list, with an optional `--search`), and `pod-details`, `pod-manifest`, `deployment-details` (single-resource lookups, with required identifying flags).
|
|
482
|
+
Available resources: `pods`, `clusters`, `namespaces`, `nodes`, `deployments`, `statefulsets`, `daemonsets`, `events` (list, with an optional `--search`), and `pod-details`, `pod-manifest`, `deployment-details` (single-resource lookups, with required identifying flags).
|
|
478
483
|
|
|
479
484
|
## Grok
|
|
480
485
|
|
|
@@ -512,11 +517,11 @@ Commands under `tsuga experimental` may change or be removed without notice.
|
|
|
512
517
|
|
|
513
518
|
```bash
|
|
514
519
|
# Rank functions by self (flat) and inclusive (cum) sample value, like `go tool pprof -top`
|
|
515
|
-
tsuga experimental profiles top --service api --type cpu --from
|
|
516
|
-
tsuga experimental profiles top --service api --type alloc_space --from
|
|
520
|
+
tsuga experimental profiles top --service api --type cpu --from=-1h
|
|
521
|
+
tsuga experimental profiles top --service api --type alloc_space --from=-1h --limit 10 -o tsv
|
|
517
522
|
|
|
518
523
|
# Download the merged profile as raw pprof protobuf and open it with pprof
|
|
519
|
-
tsuga experimental profiles pprof --service api --type cpu --from
|
|
524
|
+
tsuga experimental profiles pprof --service api --type cpu --from=-1h -O cpu.pb
|
|
520
525
|
go tool pprof -http=: cpu.pb
|
|
521
526
|
|
|
522
527
|
# Raw folded stacks (`root;...;leaf` with a value), with the usual -f / -d / --generate-skeleton
|
|
@@ -577,3 +582,14 @@ Read from stdin with `-f -`:
|
|
|
577
582
|
```bash
|
|
578
583
|
echo '{"name": "My Team"}' | tsuga teams create -f -
|
|
579
584
|
```
|
|
585
|
+
|
|
586
|
+
## Implementation
|
|
587
|
+
|
|
588
|
+
The CLI uses Effect v4 services for HTTP, configuration, filesystem access, subprocesses, and
|
|
589
|
+
command parsing. Command folders mirror tadmin: each group has a composition `index.ts` and one
|
|
590
|
+
file per action, with nearby tests. Cross-directory application imports use `@cli/*`. `packages/common-cli` shares OAuth token exchange, browser callbacks, macOS
|
|
591
|
+
keychain access, output, and closed-pipe handling with tadmin. The CLIs retain separate credential
|
|
592
|
+
namespaces and authentication policies. Generic field projection lives in `common`.
|
|
593
|
+
|
|
594
|
+
Run `yarn lint`, `yarn typecheck`, `yarn test`, and `yarn build` from `packages/cli` to verify
|
|
595
|
+
changes. Lint includes Effect language-service diagnostics.
|