@tonbo/cli 0.25.0 → 0.26.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.
Files changed (2) hide show
  1. package/dist/bin/tonbo.js +48 -2
  2. package/package.json +1 -1
package/dist/bin/tonbo.js CHANGED
@@ -796,6 +796,20 @@ var managementOperations = {
796
796
  "idempotencyKey": false,
797
797
  "cli": "tonbo metrics streams"
798
798
  },
799
+ "getAccountDatabaseAndStreamMetrics": {
800
+ "method": "GET",
801
+ "path": "/metrics/databases-and-streams",
802
+ "pathParams": [],
803
+ "query": [
804
+ "series",
805
+ "window",
806
+ "granularity",
807
+ "from",
808
+ "to"
809
+ ],
810
+ "idempotencyKey": false,
811
+ "cli": "tonbo metrics databases-and-streams"
812
+ },
799
813
  "listMachineShapes": {
800
814
  "method": "GET",
801
815
  "path": "/machine-shapes",
@@ -2461,6 +2475,10 @@ var ManagementApi = class {
2461
2475
  getAccountStreamMetrics(key, query = {}) {
2462
2476
  return this.call("getAccountStreamMetrics", key, { query });
2463
2477
  }
2478
+ /** The account's databases and streams together, with one server latency for both. */
2479
+ getAccountDatabaseAndStreamMetrics(key, query = {}) {
2480
+ return this.call("getAccountDatabaseAndStreamMetrics", key, { query });
2481
+ }
2464
2482
  /** The whole usage page: its rows, `other`, prices and checkpoint. */
2465
2483
  listStreamUsage(key, page, query = {}) {
2466
2484
  return this.page("listStreamUsage", key, page, query);
@@ -5414,7 +5432,7 @@ function printAccountRegistryMetrics(deps, noun, metrics, options) {
5414
5432
  "",
5415
5433
  table(
5416
5434
  [
5417
- noun === "databases" ? "DATABASE" : "STREAM",
5435
+ noun === "databases" ? "DATABASE" : noun === "streams" ? "STREAM" : "NAME",
5418
5436
  "REGION",
5419
5437
  ...sized ? ["STORED"] : [],
5420
5438
  ...counted.map((name) => REGISTRY_COLUMNS[name][0])
@@ -5422,7 +5440,7 @@ function printAccountRegistryMetrics(deps, noun, metrics, options) {
5422
5440
  metrics.resources.map((resource) => {
5423
5441
  const stored = [...resource.points].reverse().find((point) => point.stored_bytes !== null && point.stored_bytes !== void 0);
5424
5442
  return [
5425
- resource.name,
5443
+ resource.kind ? `${resource.name} (${resource.kind})` : resource.name,
5426
5444
  resource.region,
5427
5445
  ...sized ? [stored ? bytes(stored.stored_bytes ?? 0) : "-"] : [],
5428
5446
  ...counted.map(
@@ -5454,6 +5472,13 @@ async function metricsStreamsCommand(deps, options = {}) {
5454
5472
  );
5455
5473
  printAccountRegistryMetrics(deps, "streams", metrics, options);
5456
5474
  }
5475
+ async function metricsDatabasesAndStreamsCommand(deps, options = {}) {
5476
+ const metrics = await deps.api.getAccountDatabaseAndStreamMetrics(
5477
+ await deps.auth.apiKey(),
5478
+ metricsQuery(options)
5479
+ );
5480
+ printAccountRegistryMetrics(deps, "databases and streams", metrics, options);
5481
+ }
5457
5482
  function streamFields(stream) {
5458
5483
  return fields([
5459
5484
  ["Name", stream.name],
@@ -7983,6 +8008,16 @@ var COMMAND_HELP = {
7983
8008
  examples: ["tonbo metrics databases --window 30d --series stored_bytes,write_units"],
7984
8009
  defaults: { "--window": "7d" }
7985
8010
  },
8011
+ "tonbo metrics databases-and-streams": {
8012
+ about: [
8013
+ "Prints the account's databases and streams together, per UTC hour or day, summed over every region, with the same series as `tonbo database metrics`: the total's server latency comes from every database's and stream's merged histograms, one figure for both kinds, never an average of percentiles. Server latency is measured at Tonbo's servers, from request to response headers; your network adds to this. Then each one's row over the window, named with its kind.",
8014
+ "Give `--window`, or `--from` and `--to` with `--granularity` (at most 31 days hourly, 92 days daily)."
8015
+ ],
8016
+ examples: [
8017
+ "tonbo metrics databases-and-streams --window 30d --series server_read_latency_p50_ms"
8018
+ ],
8019
+ defaults: { "--window": "7d" }
8020
+ },
7986
8021
  "tonbo metrics streams": {
7987
8022
  about: [
7988
8023
  "Prints the account's streams per UTC hour or day, summed over every region, with the same series as `tonbo stream metrics`: the total's server latency comes from every stream's merged histograms, never an average of percentiles. Server latency is measured at Tonbo's servers, from request to response headers; your network adds to this. Then each stream's row over the window: its stored size at the last measured step and its counts summed.",
@@ -10049,6 +10084,17 @@ function createProgram(makeDependencies = createDependencies) {
10049
10084
  ).option("--granularity <step>", "with --from and --to, hour or day").option("--from <time>", "with --to, the window's start, on a UTC hour or day").option("--to <time>", "with --from, the window's end, exclusive"),
10050
10085
  "getAccountStreamMetrics"
10051
10086
  ).action(async (options) => metricsStreamsCommand(dependencies(), options));
10087
+ operationOptions(
10088
+ metrics.command("databases-and-streams").description(
10089
+ "show the account's databases and streams together, with one server latency for both"
10090
+ ).option("--window <window>", "24h or 7d hourly, 30d or 90d daily; 7d when omitted").option(
10091
+ "--series <series>",
10092
+ "the series to print, comma-separated; every series when omitted"
10093
+ ).option("--granularity <step>", "with --from and --to, hour or day").option("--from <time>", "with --to, the window's start, on a UTC hour or day").option("--to <time>", "with --from, the window's end, exclusive"),
10094
+ "getAccountDatabaseAndStreamMetrics"
10095
+ ).action(
10096
+ async (options) => metricsDatabasesAndStreamsCommand(dependencies(), options)
10097
+ );
10052
10098
  const ssh = program.command("ssh").description("open a terminal on a Machine, or run a command there, over SSH").argument("<machine>", "the Machine's name").argument("[command...]", "a command to run instead of a shell, after --").action(async (name, command) => sshCommand(dependencies(), name, command));
10053
10099
  ssh.command("config").description(
10054
10100
  "print the ssh_config block that lets ssh, scp, sftp and Remote-SSH reach every Machine"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonbo/cli",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "The Tonbo CLI. Compute, disks, databases and streams for AI agents: your agent picks what it needs, sets it up, and knows what it costs, from the command line.",
5
5
  "homepage": "https://tonbo.dev",
6
6
  "bugs": {