@belvador/api 0.4.0 → 0.5.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/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OPERATIONS, type OperationId, type OperationMeta, type OperationParams } from "./operations.gen.js";
2
- export declare const CLIENT_VERSION = "0.4.0";
2
+ export declare const CLIENT_VERSION = "0.5.0";
3
3
  export declare const DEFAULT_BASE_URL = "https://api.belvador.dev";
4
4
  /** Personal (`blv_pat_`), service (`blv_svc_`) or OAuth access (`blv_oat_`) token. */
5
5
  export declare const TOKEN_PATTERN: RegExp;
package/dist/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BelvadorApiError, errorFrom } from "./errors.js";
2
2
  import { nodeErrorWord, nodeReadRequest, nodeRefusal, nodeWindowMissing, NODE_REFUSAL_STATUS, reshapeNodeAnswer, } from "./node-wire.gen.js";
3
3
  import { OPERATIONS } from "./operations.gen.js";
4
- export const CLIENT_VERSION = "0.4.0";
4
+ export const CLIENT_VERSION = "0.5.0";
5
5
  export const DEFAULT_BASE_URL = "https://api.belvador.dev";
6
6
  /** Personal (`blv_pat_`), service (`blv_svc_`) or OAuth access (`blv_oat_`) token. */
7
7
  export const TOKEN_PATTERN = /^blv_(pat|svc|oat)_[A-Za-z0-9_-]{20,200}$/;
@@ -772,6 +772,56 @@ export declare const OPERATIONS: {
772
772
  readonly node: null;
773
773
  readonly defaults: {};
774
774
  };
775
+ readonly "metrics.names": {
776
+ readonly method: "GET";
777
+ readonly path: "/v1/metrics/names";
778
+ readonly pathParams: readonly [];
779
+ readonly scope: "metrics:read";
780
+ readonly kind: "node";
781
+ readonly sensitivity: "normal";
782
+ readonly idempotency: "none";
783
+ readonly ifMatch: false;
784
+ readonly paged: false;
785
+ readonly status: 200;
786
+ readonly node: {
787
+ readonly path: "q/metrics/names";
788
+ };
789
+ readonly defaults: {};
790
+ };
791
+ readonly "metrics.query": {
792
+ readonly method: "GET";
793
+ readonly path: "/v1/metrics/query";
794
+ readonly pathParams: readonly [];
795
+ readonly scope: "metrics:read";
796
+ readonly kind: "node";
797
+ readonly sensitivity: "normal";
798
+ readonly idempotency: "none";
799
+ readonly ifMatch: false;
800
+ readonly paged: false;
801
+ readonly status: 200;
802
+ readonly node: {
803
+ readonly path: "q/metrics/query";
804
+ readonly window: true;
805
+ };
806
+ readonly defaults: {};
807
+ };
808
+ readonly "metrics.series": {
809
+ readonly method: "GET";
810
+ readonly path: "/v1/metrics/series";
811
+ readonly pathParams: readonly [];
812
+ readonly scope: "metrics:read";
813
+ readonly kind: "node";
814
+ readonly sensitivity: "normal";
815
+ readonly idempotency: "none";
816
+ readonly ifMatch: false;
817
+ readonly paged: true;
818
+ readonly status: 200;
819
+ readonly node: {
820
+ readonly path: "q/metrics/series";
821
+ readonly list: "series";
822
+ };
823
+ readonly defaults: {};
824
+ };
775
825
  readonly "monitors.backtest": {
776
826
  readonly method: "POST";
777
827
  readonly path: "/v1/monitors/backtest";
@@ -1920,7 +1970,7 @@ export interface OperationParams {
1920
1970
  is_enabled: boolean;
1921
1971
  notify_all: boolean;
1922
1972
  destination_ids: Array<string>;
1923
- monitor_kinds?: Array<"missed" | "failed" | "timeout" | "unknown" | "count" | "assertion" | "deadline" | "stalled">;
1973
+ monitor_kinds?: Array<"missed" | "failed" | "timeout" | "unknown" | "count" | "assertion" | "deadline" | "stalled" | "metric">;
1924
1974
  slo_severities?: Array<"page" | "ticket">;
1925
1975
  policy_id?: string | null;
1926
1976
  };
@@ -2067,7 +2117,7 @@ export interface OperationParams {
2067
2117
  "ingest_keys.create": {
2068
2118
  project_id: number;
2069
2119
  name: string;
2070
- scopes: Array<"traces" | "logs" | "errors" | "monitors">;
2120
+ scopes: Array<"traces" | "logs" | "metrics" | "errors" | "monitors">;
2071
2121
  environments: Array<string>;
2072
2122
  expires_at: string | null;
2073
2123
  };
@@ -2278,6 +2328,32 @@ export interface OperationParams {
2278
2328
  "members.remove": {
2279
2329
  user_id: string;
2280
2330
  };
2331
+ /** The metric catalog of one project (name, type, kind, unit, series count, last seen) and the node's series and name caps with the metrics it is dropping points for. */
2332
+ "metrics.names": {
2333
+ project: number;
2334
+ environment?: string;
2335
+ q?: string;
2336
+ };
2337
+ /** One metric aggregated per step (avg, sum, min, max, count, rate, p50–p99) in a window of at most 7 days, optionally grouped by up to two attributes (≤ 50 groups, ≤ 10,000 points), with exemplar trace ids. */
2338
+ "metrics.query": {
2339
+ project: number;
2340
+ name: string;
2341
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2342
+ start?: string;
2343
+ end?: string;
2344
+ step?: number;
2345
+ attrs?: string;
2346
+ group_by?: string;
2347
+ environment?: string;
2348
+ };
2349
+ /** The time series of one metric (attributes, service, environment, first and last seen), 100 per page. */
2350
+ "metrics.series": {
2351
+ project?: number;
2352
+ name?: string;
2353
+ environment?: string;
2354
+ attrs?: string;
2355
+ cursor?: string;
2356
+ };
2281
2357
  /** How often count/assertion settings would have alerted over the last 30 days of stored data (same rule as the live evaluator). */
2282
2358
  "monitors.backtest": {
2283
2359
  project: number;
@@ -2398,6 +2474,26 @@ export interface OperationParams {
2398
2474
  environments: Array<string>;
2399
2475
  severity: "critical" | "high" | "medium" | "low";
2400
2476
  recovery_threshold: number;
2477
+ } | {
2478
+ type: "metric";
2479
+ metric_query: {
2480
+ name: string;
2481
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2482
+ filter: Array<{
2483
+ k: string;
2484
+ op: "=" | "!=" | "exists";
2485
+ v?: string;
2486
+ }>;
2487
+ group_by: Array<string>;
2488
+ };
2489
+ window_minutes: number;
2490
+ comparator: "lt" | "gt" | "outside";
2491
+ threshold: number;
2492
+ threshold_high: number | null;
2493
+ missing_data: "alert" | "keep" | "resolve" | "treat_as_zero";
2494
+ environments: Array<string>;
2495
+ severity: "critical" | "high" | "medium" | "low";
2496
+ recovery_threshold: number;
2401
2497
  };
2402
2498
  }));
2403
2499
  /** Delete a monitor; `confirm_slug` must repeat its slug. */
@@ -2418,7 +2514,7 @@ export interface OperationParams {
2418
2514
  limit?: number;
2419
2515
  cursor?: string;
2420
2516
  project_id?: number;
2421
- type?: "job" | "count" | "assertion" | "deadline" | "progress";
2517
+ type?: "job" | "count" | "assertion" | "deadline" | "progress" | "metric";
2422
2518
  };
2423
2519
  /** Occurrences of a deadline monitor (pending, on time, late, missed, failed, cancelled), newest due first. */
2424
2520
  "monitors.occurrences": {
@@ -2517,6 +2613,26 @@ export interface OperationParams {
2517
2613
  environments: Array<string>;
2518
2614
  severity: "critical" | "high" | "medium" | "low";
2519
2615
  recovery_threshold: number;
2616
+ } | {
2617
+ type: "metric";
2618
+ metric_query: {
2619
+ name: string;
2620
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2621
+ filter: Array<{
2622
+ k: string;
2623
+ op: "=" | "!=" | "exists";
2624
+ v?: string;
2625
+ }>;
2626
+ group_by: Array<string>;
2627
+ };
2628
+ window_minutes: number;
2629
+ comparator: "lt" | "gt" | "outside";
2630
+ threshold: number;
2631
+ threshold_high: number | null;
2632
+ missing_data: "alert" | "keep" | "resolve" | "treat_as_zero";
2633
+ environments: Array<string>;
2634
+ severity: "critical" | "high" | "medium" | "low";
2635
+ recovery_threshold: number;
2520
2636
  };
2521
2637
  }));
2522
2638
  /** Start a backup now (at most once per 10 minutes). */
@@ -716,6 +716,48 @@ export const OPERATIONS = {
716
716
  node: null,
717
717
  defaults: {},
718
718
  },
719
+ "metrics.names": {
720
+ method: "GET",
721
+ path: "/v1/metrics/names",
722
+ pathParams: [],
723
+ scope: "metrics:read",
724
+ kind: "node",
725
+ sensitivity: "normal",
726
+ idempotency: "none",
727
+ ifMatch: false,
728
+ paged: false,
729
+ status: 200,
730
+ node: { path: "q/metrics/names" },
731
+ defaults: {},
732
+ },
733
+ "metrics.query": {
734
+ method: "GET",
735
+ path: "/v1/metrics/query",
736
+ pathParams: [],
737
+ scope: "metrics:read",
738
+ kind: "node",
739
+ sensitivity: "normal",
740
+ idempotency: "none",
741
+ ifMatch: false,
742
+ paged: false,
743
+ status: 200,
744
+ node: { path: "q/metrics/query", window: true },
745
+ defaults: {},
746
+ },
747
+ "metrics.series": {
748
+ method: "GET",
749
+ path: "/v1/metrics/series",
750
+ pathParams: [],
751
+ scope: "metrics:read",
752
+ kind: "node",
753
+ sensitivity: "normal",
754
+ idempotency: "none",
755
+ ifMatch: false,
756
+ paged: true,
757
+ status: 200,
758
+ node: { path: "q/metrics/series", list: "series" },
759
+ defaults: {},
760
+ },
719
761
  "monitors.backtest": {
720
762
  method: "POST",
721
763
  path: "/v1/monitors/backtest",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belvador/api",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Typed client for the Belvador API (api.belvador.dev, OpenAPI 3.1): every operation by operationId, problem+json errors, retries, and node reads straight from the edge with short-lived tickets.",
5
5
  "license": "MIT",
6
6
  "author": "Belvador (https://belvador.dev)",