@tonbo/cli 0.25.0 → 0.27.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 +54 -4
  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],
@@ -6035,7 +6060,11 @@ var VOLUME_COLUMNS = {
6035
6060
  write_bytes: ["WRITTEN", (value) => bytes(value)],
6036
6061
  read_ops: ["READ OPS", String],
6037
6062
  write_ops: ["WRITE OPS", String],
6038
- trim_ops: ["TRIMS", String]
6063
+ trim_ops: ["TRIMS", String],
6064
+ read_latency_p50_ms: ["READ P50", (value) => `${value} ms`],
6065
+ read_latency_p99_ms: ["READ P99", (value) => `${value} ms`],
6066
+ write_latency_p50_ms: ["WRITE P50", (value) => `${value} ms`],
6067
+ write_latency_p99_ms: ["WRITE P99", (value) => `${value} ms`]
6039
6068
  };
6040
6069
  async function volumeMetricsCommand(deps, name, options = {}) {
6041
6070
  const metrics = await deps.api.getVolumeNameMetrics(
@@ -7926,7 +7955,7 @@ var COMMAND_HELP = {
7926
7955
  },
7927
7956
  "tonbo volume metrics": {
7928
7957
  about: [
7929
- "Prints the Volume's metrics, one row per UTC hour or day: the bytes and requests its Machine read, wrote and trimmed, as the Volume served them, and what its files held at the step's last sample, compressed. The I/O updates about every 30 seconds while the Volume is attached; the current step is marked `so far`.",
7958
+ "Prints the Volume's metrics, one row per UTC hour or day: the bytes and requests its Machine read, wrote and trimmed, as the Volume served them, how long the Volume took to answer its reads and writes (median and 99th percentile, from a request's arrival to its reply), and what its files held at the step's last sample, compressed. The I/O updates about every 30 seconds while the Volume is attached; the current step is marked `so far`.",
7930
7959
  "Give `--window` (24h hourly; 7d, 30d or 90d daily, 7d also hourly with `--granularity hour`), or `--from` and `--to` with `--granularity` (at most 8 days hourly, 92 days daily). `--series` prints only the series it names. It carries no money: `tonbo usage show` says what the Volume cost."
7931
7960
  ],
7932
7961
  examples: [
@@ -7983,6 +8012,16 @@ var COMMAND_HELP = {
7983
8012
  examples: ["tonbo metrics databases --window 30d --series stored_bytes,write_units"],
7984
8013
  defaults: { "--window": "7d" }
7985
8014
  },
8015
+ "tonbo metrics databases-and-streams": {
8016
+ about: [
8017
+ "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.",
8018
+ "Give `--window`, or `--from` and `--to` with `--granularity` (at most 31 days hourly, 92 days daily)."
8019
+ ],
8020
+ examples: [
8021
+ "tonbo metrics databases-and-streams --window 30d --series server_read_latency_p50_ms"
8022
+ ],
8023
+ defaults: { "--window": "7d" }
8024
+ },
7986
8025
  "tonbo metrics streams": {
7987
8026
  about: [
7988
8027
  "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 +10088,17 @@ function createProgram(makeDependencies = createDependencies) {
10049
10088
  ).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
10089
  "getAccountStreamMetrics"
10051
10090
  ).action(async (options) => metricsStreamsCommand(dependencies(), options));
10091
+ operationOptions(
10092
+ metrics.command("databases-and-streams").description(
10093
+ "show the account's databases and streams together, with one server latency for both"
10094
+ ).option("--window <window>", "24h or 7d hourly, 30d or 90d daily; 7d when omitted").option(
10095
+ "--series <series>",
10096
+ "the series to print, comma-separated; every series when omitted"
10097
+ ).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"),
10098
+ "getAccountDatabaseAndStreamMetrics"
10099
+ ).action(
10100
+ async (options) => metricsDatabasesAndStreamsCommand(dependencies(), options)
10101
+ );
10052
10102
  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
10103
  ssh.command("config").description(
10054
10104
  "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.27.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": {