@miradorlabs/web-grpc 2.68.0 → 2.70.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.
@@ -313,6 +313,36 @@ export interface QuerySeriesUpdate_GroupValuesEntry {
313
313
  value: string;
314
314
  }
315
315
 
316
+ export interface BatchQueryRequest {
317
+ /** Verified against the caller's identity before proxying. */
318
+ organizationId: string;
319
+ projectId: string;
320
+ /**
321
+ * 1-50 queries, each id nonempty, unique within the request, and bounded in
322
+ * length; violations are rejected before any query runs.
323
+ */
324
+ queries: BatchQueryItem[];
325
+ }
326
+
327
+ /**
328
+ * BatchQueryItem is one query in the batch. Same fields as StreamQueryRequest's
329
+ * query half, plus a client-supplied id echoed back on its outcome.
330
+ */
331
+ export interface BatchQueryItem {
332
+ /** Client-generated, echoed verbatim on this query's outcome envelope. */
333
+ id: string;
334
+ promql: string;
335
+ timeRange: TimeRange | undefined;
336
+ timeInterval: AnalyticsTimeInterval;
337
+ }
338
+
339
+ /** BatchQueryEnvelope is one query's terminal outcome, tagged with its id. */
340
+ export interface BatchQueryEnvelope {
341
+ id: string;
342
+ snapshot?: QuerySnapshot | undefined;
343
+ error?: WidgetQueryError | undefined;
344
+ }
345
+
316
346
  /**
317
347
  * Dashboard is the saved document. Server-enforced caps: ≤24 widgets per
318
348
  * dashboard, ≤4 queries per widget.
@@ -2379,6 +2409,349 @@ export const QuerySeriesUpdate_GroupValuesEntry: MessageFns<QuerySeriesUpdate_Gr
2379
2409
  },
2380
2410
  };
2381
2411
 
2412
+ function createBaseBatchQueryRequest(): BatchQueryRequest {
2413
+ return { organizationId: "", projectId: "", queries: [] };
2414
+ }
2415
+
2416
+ export const BatchQueryRequest: MessageFns<BatchQueryRequest> = {
2417
+ encode(message: BatchQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2418
+ if (message.organizationId !== "") {
2419
+ writer.uint32(10).string(message.organizationId);
2420
+ }
2421
+ if (message.projectId !== "") {
2422
+ writer.uint32(18).string(message.projectId);
2423
+ }
2424
+ for (const v of message.queries) {
2425
+ BatchQueryItem.encode(v!, writer.uint32(26).fork()).join();
2426
+ }
2427
+ return writer;
2428
+ },
2429
+
2430
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchQueryRequest {
2431
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2432
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2433
+ if (previousRecursionDepth >= 100) {
2434
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2435
+ }
2436
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2437
+ try {
2438
+ const end = length === undefined ? reader.len : reader.pos + length;
2439
+ const message = createBaseBatchQueryRequest();
2440
+ while (reader.pos < end) {
2441
+ const tag = reader.uint32();
2442
+ switch (tag >>> 3) {
2443
+ case 1: {
2444
+ if (tag !== 10) {
2445
+ break;
2446
+ }
2447
+
2448
+ message.organizationId = reader.string();
2449
+ continue;
2450
+ }
2451
+ case 2: {
2452
+ if (tag !== 18) {
2453
+ break;
2454
+ }
2455
+
2456
+ message.projectId = reader.string();
2457
+ continue;
2458
+ }
2459
+ case 3: {
2460
+ if (tag !== 26) {
2461
+ break;
2462
+ }
2463
+
2464
+ message.queries.push(BatchQueryItem.decode(reader, reader.uint32()));
2465
+ continue;
2466
+ }
2467
+ }
2468
+ if ((tag & 7) === 4 || tag === 0) {
2469
+ break;
2470
+ }
2471
+ reader.skip(tag & 7);
2472
+ }
2473
+ return message;
2474
+ } finally {
2475
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2476
+ }
2477
+ },
2478
+
2479
+ fromJSON(object: any): BatchQueryRequest {
2480
+ return {
2481
+ organizationId: isSet(object.organizationId)
2482
+ ? globalThis.String(object.organizationId)
2483
+ : isSet(object.organization_id)
2484
+ ? globalThis.String(object.organization_id)
2485
+ : "",
2486
+ projectId: isSet(object.projectId)
2487
+ ? globalThis.String(object.projectId)
2488
+ : isSet(object.project_id)
2489
+ ? globalThis.String(object.project_id)
2490
+ : "",
2491
+ queries: globalThis.Array.isArray(object?.queries)
2492
+ ? object.queries.map((e: any) => BatchQueryItem.fromJSON(e))
2493
+ : [],
2494
+ };
2495
+ },
2496
+
2497
+ toJSON(message: BatchQueryRequest): unknown {
2498
+ const obj: any = {};
2499
+ if (message.organizationId !== "") {
2500
+ obj.organizationId = message.organizationId;
2501
+ }
2502
+ if (message.projectId !== "") {
2503
+ obj.projectId = message.projectId;
2504
+ }
2505
+ if (message.queries?.length) {
2506
+ obj.queries = message.queries.map((e) => BatchQueryItem.toJSON(e));
2507
+ }
2508
+ return obj;
2509
+ },
2510
+
2511
+ create<I extends Exact<DeepPartial<BatchQueryRequest>, I>>(base?: I): BatchQueryRequest {
2512
+ return BatchQueryRequest.fromPartial(base ?? ({} as any));
2513
+ },
2514
+ fromPartial<I extends Exact<DeepPartial<BatchQueryRequest>, I>>(object: I): BatchQueryRequest {
2515
+ const message = createBaseBatchQueryRequest();
2516
+ message.organizationId = object.organizationId ?? "";
2517
+ message.projectId = object.projectId ?? "";
2518
+ message.queries = object.queries?.map((e) => BatchQueryItem.fromPartial(e)) || [];
2519
+ return message;
2520
+ },
2521
+ };
2522
+
2523
+ function createBaseBatchQueryItem(): BatchQueryItem {
2524
+ return { id: "", promql: "", timeRange: undefined, timeInterval: 0 };
2525
+ }
2526
+
2527
+ export const BatchQueryItem: MessageFns<BatchQueryItem> = {
2528
+ encode(message: BatchQueryItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2529
+ if (message.id !== "") {
2530
+ writer.uint32(10).string(message.id);
2531
+ }
2532
+ if (message.promql !== "") {
2533
+ writer.uint32(18).string(message.promql);
2534
+ }
2535
+ if (message.timeRange !== undefined) {
2536
+ TimeRange.encode(message.timeRange, writer.uint32(26).fork()).join();
2537
+ }
2538
+ if (message.timeInterval !== 0) {
2539
+ writer.uint32(32).int32(message.timeInterval);
2540
+ }
2541
+ return writer;
2542
+ },
2543
+
2544
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchQueryItem {
2545
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2546
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2547
+ if (previousRecursionDepth >= 100) {
2548
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2549
+ }
2550
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2551
+ try {
2552
+ const end = length === undefined ? reader.len : reader.pos + length;
2553
+ const message = createBaseBatchQueryItem();
2554
+ while (reader.pos < end) {
2555
+ const tag = reader.uint32();
2556
+ switch (tag >>> 3) {
2557
+ case 1: {
2558
+ if (tag !== 10) {
2559
+ break;
2560
+ }
2561
+
2562
+ message.id = reader.string();
2563
+ continue;
2564
+ }
2565
+ case 2: {
2566
+ if (tag !== 18) {
2567
+ break;
2568
+ }
2569
+
2570
+ message.promql = reader.string();
2571
+ continue;
2572
+ }
2573
+ case 3: {
2574
+ if (tag !== 26) {
2575
+ break;
2576
+ }
2577
+
2578
+ message.timeRange = TimeRange.decode(reader, reader.uint32());
2579
+ continue;
2580
+ }
2581
+ case 4: {
2582
+ if (tag !== 32) {
2583
+ break;
2584
+ }
2585
+
2586
+ message.timeInterval = reader.int32() as any;
2587
+ continue;
2588
+ }
2589
+ }
2590
+ if ((tag & 7) === 4 || tag === 0) {
2591
+ break;
2592
+ }
2593
+ reader.skip(tag & 7);
2594
+ }
2595
+ return message;
2596
+ } finally {
2597
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2598
+ }
2599
+ },
2600
+
2601
+ fromJSON(object: any): BatchQueryItem {
2602
+ return {
2603
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
2604
+ promql: isSet(object.promql) ? globalThis.String(object.promql) : "",
2605
+ timeRange: isSet(object.timeRange)
2606
+ ? TimeRange.fromJSON(object.timeRange)
2607
+ : isSet(object.time_range)
2608
+ ? TimeRange.fromJSON(object.time_range)
2609
+ : undefined,
2610
+ timeInterval: isSet(object.timeInterval)
2611
+ ? analyticsTimeIntervalFromJSON(object.timeInterval)
2612
+ : isSet(object.time_interval)
2613
+ ? analyticsTimeIntervalFromJSON(object.time_interval)
2614
+ : 0,
2615
+ };
2616
+ },
2617
+
2618
+ toJSON(message: BatchQueryItem): unknown {
2619
+ const obj: any = {};
2620
+ if (message.id !== "") {
2621
+ obj.id = message.id;
2622
+ }
2623
+ if (message.promql !== "") {
2624
+ obj.promql = message.promql;
2625
+ }
2626
+ if (message.timeRange !== undefined) {
2627
+ obj.timeRange = TimeRange.toJSON(message.timeRange);
2628
+ }
2629
+ if (message.timeInterval !== 0) {
2630
+ obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
2631
+ }
2632
+ return obj;
2633
+ },
2634
+
2635
+ create<I extends Exact<DeepPartial<BatchQueryItem>, I>>(base?: I): BatchQueryItem {
2636
+ return BatchQueryItem.fromPartial(base ?? ({} as any));
2637
+ },
2638
+ fromPartial<I extends Exact<DeepPartial<BatchQueryItem>, I>>(object: I): BatchQueryItem {
2639
+ const message = createBaseBatchQueryItem();
2640
+ message.id = object.id ?? "";
2641
+ message.promql = object.promql ?? "";
2642
+ message.timeRange = (object.timeRange !== undefined && object.timeRange !== null)
2643
+ ? TimeRange.fromPartial(object.timeRange)
2644
+ : undefined;
2645
+ message.timeInterval = object.timeInterval ?? 0;
2646
+ return message;
2647
+ },
2648
+ };
2649
+
2650
+ function createBaseBatchQueryEnvelope(): BatchQueryEnvelope {
2651
+ return { id: "", snapshot: undefined, error: undefined };
2652
+ }
2653
+
2654
+ export const BatchQueryEnvelope: MessageFns<BatchQueryEnvelope> = {
2655
+ encode(message: BatchQueryEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2656
+ if (message.id !== "") {
2657
+ writer.uint32(10).string(message.id);
2658
+ }
2659
+ if (message.snapshot !== undefined) {
2660
+ QuerySnapshot.encode(message.snapshot, writer.uint32(18).fork()).join();
2661
+ }
2662
+ if (message.error !== undefined) {
2663
+ WidgetQueryError.encode(message.error, writer.uint32(26).fork()).join();
2664
+ }
2665
+ return writer;
2666
+ },
2667
+
2668
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchQueryEnvelope {
2669
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2670
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2671
+ if (previousRecursionDepth >= 100) {
2672
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2673
+ }
2674
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2675
+ try {
2676
+ const end = length === undefined ? reader.len : reader.pos + length;
2677
+ const message = createBaseBatchQueryEnvelope();
2678
+ while (reader.pos < end) {
2679
+ const tag = reader.uint32();
2680
+ switch (tag >>> 3) {
2681
+ case 1: {
2682
+ if (tag !== 10) {
2683
+ break;
2684
+ }
2685
+
2686
+ message.id = reader.string();
2687
+ continue;
2688
+ }
2689
+ case 2: {
2690
+ if (tag !== 18) {
2691
+ break;
2692
+ }
2693
+
2694
+ message.snapshot = QuerySnapshot.decode(reader, reader.uint32());
2695
+ continue;
2696
+ }
2697
+ case 3: {
2698
+ if (tag !== 26) {
2699
+ break;
2700
+ }
2701
+
2702
+ message.error = WidgetQueryError.decode(reader, reader.uint32());
2703
+ continue;
2704
+ }
2705
+ }
2706
+ if ((tag & 7) === 4 || tag === 0) {
2707
+ break;
2708
+ }
2709
+ reader.skip(tag & 7);
2710
+ }
2711
+ return message;
2712
+ } finally {
2713
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2714
+ }
2715
+ },
2716
+
2717
+ fromJSON(object: any): BatchQueryEnvelope {
2718
+ return {
2719
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
2720
+ snapshot: isSet(object.snapshot) ? QuerySnapshot.fromJSON(object.snapshot) : undefined,
2721
+ error: isSet(object.error) ? WidgetQueryError.fromJSON(object.error) : undefined,
2722
+ };
2723
+ },
2724
+
2725
+ toJSON(message: BatchQueryEnvelope): unknown {
2726
+ const obj: any = {};
2727
+ if (message.id !== "") {
2728
+ obj.id = message.id;
2729
+ }
2730
+ if (message.snapshot !== undefined) {
2731
+ obj.snapshot = QuerySnapshot.toJSON(message.snapshot);
2732
+ }
2733
+ if (message.error !== undefined) {
2734
+ obj.error = WidgetQueryError.toJSON(message.error);
2735
+ }
2736
+ return obj;
2737
+ },
2738
+
2739
+ create<I extends Exact<DeepPartial<BatchQueryEnvelope>, I>>(base?: I): BatchQueryEnvelope {
2740
+ return BatchQueryEnvelope.fromPartial(base ?? ({} as any));
2741
+ },
2742
+ fromPartial<I extends Exact<DeepPartial<BatchQueryEnvelope>, I>>(object: I): BatchQueryEnvelope {
2743
+ const message = createBaseBatchQueryEnvelope();
2744
+ message.id = object.id ?? "";
2745
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
2746
+ ? QuerySnapshot.fromPartial(object.snapshot)
2747
+ : undefined;
2748
+ message.error = (object.error !== undefined && object.error !== null)
2749
+ ? WidgetQueryError.fromPartial(object.error)
2750
+ : undefined;
2751
+ return message;
2752
+ },
2753
+ };
2754
+
2382
2755
  function createBaseDashboard(): Dashboard {
2383
2756
  return {
2384
2757
  id: "",
@@ -5207,6 +5580,15 @@ export interface MetricGatewayService {
5207
5580
  * the snapshot). Query failures abort the stream with a gRPC status.
5208
5581
  */
5209
5582
  StreamQuery(request: StreamQueryRequest, metadata?: Metadata): Observable<QueryDataEnvelope>;
5583
+ /**
5584
+ * Batched ad-hoc query execution: N id-tagged PromQL queries over one stream,
5585
+ * each evaluated snapshot-once, each delivered as its own envelope as it
5586
+ * resolves. Exactly one outcome (snapshot or in-band error) per accepted id, no
5587
+ * ordering guarantee; a per-query failure is in-band and never ends the stream.
5588
+ * EOF means every accepted id has returned. See the telemetry-api service
5589
+ * definition for the full ordering/cardinality guarantees.
5590
+ */
5591
+ BatchQuery(request: BatchQueryRequest, metadata?: Metadata): Observable<BatchQueryEnvelope>;
5210
5592
  CreateDashboard(request: CreateDashboardRequest, metadata?: Metadata): Promise<CreateDashboardResponse>;
5211
5593
  GetDashboard(request: GetDashboardRequest, metadata?: Metadata): Promise<GetDashboardResponse>;
5212
5594
  ListDashboards(request: ListDashboardsRequest, metadata?: Metadata): Promise<ListDashboardsResponse>;
@@ -5244,6 +5626,7 @@ export class MetricGatewayServiceClientImpl implements MetricGatewayService {
5244
5626
  this.StreamMetrics = this.StreamMetrics.bind(this);
5245
5627
  this.StreamMetricAttributes = this.StreamMetricAttributes.bind(this);
5246
5628
  this.StreamQuery = this.StreamQuery.bind(this);
5629
+ this.BatchQuery = this.BatchQuery.bind(this);
5247
5630
  this.CreateDashboard = this.CreateDashboard.bind(this);
5248
5631
  this.GetDashboard = this.GetDashboard.bind(this);
5249
5632
  this.ListDashboards = this.ListDashboards.bind(this);
@@ -5273,6 +5656,12 @@ export class MetricGatewayServiceClientImpl implements MetricGatewayService {
5273
5656
  return result.pipe(map((data) => QueryDataEnvelope.decode(new BinaryReader(data))));
5274
5657
  }
5275
5658
 
5659
+ BatchQuery(request: BatchQueryRequest, metadata?: Metadata): Observable<BatchQueryEnvelope> {
5660
+ const data = BatchQueryRequest.encode(request).finish();
5661
+ const result = this.rpc.serverStreamingRequest(this.service, "BatchQuery", data, metadata);
5662
+ return result.pipe(map((data) => BatchQueryEnvelope.decode(new BinaryReader(data))));
5663
+ }
5664
+
5276
5665
  CreateDashboard(request: CreateDashboardRequest, metadata?: Metadata): Promise<CreateDashboardResponse> {
5277
5666
  const data = CreateDashboardRequest.encode(request).finish();
5278
5667
  const promise = this.rpc.request(this.service, "CreateDashboard", data, metadata);
@@ -7,6 +7,28 @@ var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/time
7
7
  var proto_gateway_common_v1_status_pb = require('../../../../proto/gateway/common/v1/status_pb.js');
8
8
  var proto_gateway_web_v1_trace_gateway_pb = require('../../../../proto/gateway/web/v1/trace_gateway_pb.js');
9
9
 
10
+ function serialize_gateway_web_v1_BatchQueryEnvelope(arg) {
11
+ if (!(arg instanceof proto_gateway_web_v1_metric_gateway_pb.BatchQueryEnvelope)) {
12
+ throw new Error('Expected argument of type gateway.web.v1.BatchQueryEnvelope');
13
+ }
14
+ return Buffer.from(arg.serializeBinary());
15
+ }
16
+
17
+ function deserialize_gateway_web_v1_BatchQueryEnvelope(buffer_arg) {
18
+ return proto_gateway_web_v1_metric_gateway_pb.BatchQueryEnvelope.deserializeBinary(new Uint8Array(buffer_arg));
19
+ }
20
+
21
+ function serialize_gateway_web_v1_BatchQueryRequest(arg) {
22
+ if (!(arg instanceof proto_gateway_web_v1_metric_gateway_pb.BatchQueryRequest)) {
23
+ throw new Error('Expected argument of type gateway.web.v1.BatchQueryRequest');
24
+ }
25
+ return Buffer.from(arg.serializeBinary());
26
+ }
27
+
28
+ function deserialize_gateway_web_v1_BatchQueryRequest(buffer_arg) {
29
+ return proto_gateway_web_v1_metric_gateway_pb.BatchQueryRequest.deserializeBinary(new Uint8Array(buffer_arg));
30
+ }
31
+
10
32
  function serialize_gateway_web_v1_CreateDashboardRequest(arg) {
11
33
  if (!(arg instanceof proto_gateway_web_v1_metric_gateway_pb.CreateDashboardRequest)) {
12
34
  throw new Error('Expected argument of type gateway.web.v1.CreateDashboardRequest');
@@ -273,6 +295,23 @@ streamQuery: {
273
295
  responseSerialize: serialize_gateway_web_v1_QueryDataEnvelope,
274
296
  responseDeserialize: deserialize_gateway_web_v1_QueryDataEnvelope,
275
297
  },
298
+ // Batched ad-hoc query execution: N id-tagged PromQL queries over one stream,
299
+ // each evaluated snapshot-once, each delivered as its own envelope as it
300
+ // resolves. Exactly one outcome (snapshot or in-band error) per accepted id, no
301
+ // ordering guarantee; a per-query failure is in-band and never ends the stream.
302
+ // EOF means every accepted id has returned. See the telemetry-api service
303
+ // definition for the full ordering/cardinality guarantees.
304
+ batchQuery: {
305
+ path: '/gateway.web.v1.MetricGatewayService/BatchQuery',
306
+ requestStream: false,
307
+ responseStream: true,
308
+ requestType: proto_gateway_web_v1_metric_gateway_pb.BatchQueryRequest,
309
+ responseType: proto_gateway_web_v1_metric_gateway_pb.BatchQueryEnvelope,
310
+ requestSerialize: serialize_gateway_web_v1_BatchQueryRequest,
311
+ requestDeserialize: deserialize_gateway_web_v1_BatchQueryRequest,
312
+ responseSerialize: serialize_gateway_web_v1_BatchQueryEnvelope,
313
+ responseDeserialize: deserialize_gateway_web_v1_BatchQueryEnvelope,
314
+ },
276
315
  createDashboard: {
277
316
  path: '/gateway.web.v1.MetricGatewayService/CreateDashboard',
278
317
  requestStream: false,