@miradorlabs/web-grpc 2.24.0 → 2.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.
@@ -73,290 +73,6 @@ export function metricKindToJSON(object: MetricKind): string {
73
73
  }
74
74
  }
75
75
 
76
- export enum GaugeAggregation {
77
- GAUGE_AGGREGATION_UNSPECIFIED = 0,
78
- GAUGE_AGGREGATION_LAST = 1,
79
- GAUGE_AGGREGATION_AVG = 2,
80
- GAUGE_AGGREGATION_MIN = 3,
81
- GAUGE_AGGREGATION_MAX = 4,
82
- GAUGE_AGGREGATION_SUM = 5,
83
- GAUGE_AGGREGATION_COUNT = 6,
84
- UNRECOGNIZED = -1,
85
- }
86
-
87
- export function gaugeAggregationFromJSON(object: any): GaugeAggregation {
88
- switch (object) {
89
- case 0:
90
- case "GAUGE_AGGREGATION_UNSPECIFIED":
91
- return GaugeAggregation.GAUGE_AGGREGATION_UNSPECIFIED;
92
- case 1:
93
- case "GAUGE_AGGREGATION_LAST":
94
- return GaugeAggregation.GAUGE_AGGREGATION_LAST;
95
- case 2:
96
- case "GAUGE_AGGREGATION_AVG":
97
- return GaugeAggregation.GAUGE_AGGREGATION_AVG;
98
- case 3:
99
- case "GAUGE_AGGREGATION_MIN":
100
- return GaugeAggregation.GAUGE_AGGREGATION_MIN;
101
- case 4:
102
- case "GAUGE_AGGREGATION_MAX":
103
- return GaugeAggregation.GAUGE_AGGREGATION_MAX;
104
- case 5:
105
- case "GAUGE_AGGREGATION_SUM":
106
- return GaugeAggregation.GAUGE_AGGREGATION_SUM;
107
- case 6:
108
- case "GAUGE_AGGREGATION_COUNT":
109
- return GaugeAggregation.GAUGE_AGGREGATION_COUNT;
110
- case -1:
111
- case "UNRECOGNIZED":
112
- default:
113
- return GaugeAggregation.UNRECOGNIZED;
114
- }
115
- }
116
-
117
- export function gaugeAggregationToJSON(object: GaugeAggregation): string {
118
- switch (object) {
119
- case GaugeAggregation.GAUGE_AGGREGATION_UNSPECIFIED:
120
- return "GAUGE_AGGREGATION_UNSPECIFIED";
121
- case GaugeAggregation.GAUGE_AGGREGATION_LAST:
122
- return "GAUGE_AGGREGATION_LAST";
123
- case GaugeAggregation.GAUGE_AGGREGATION_AVG:
124
- return "GAUGE_AGGREGATION_AVG";
125
- case GaugeAggregation.GAUGE_AGGREGATION_MIN:
126
- return "GAUGE_AGGREGATION_MIN";
127
- case GaugeAggregation.GAUGE_AGGREGATION_MAX:
128
- return "GAUGE_AGGREGATION_MAX";
129
- case GaugeAggregation.GAUGE_AGGREGATION_SUM:
130
- return "GAUGE_AGGREGATION_SUM";
131
- case GaugeAggregation.GAUGE_AGGREGATION_COUNT:
132
- return "GAUGE_AGGREGATION_COUNT";
133
- case GaugeAggregation.UNRECOGNIZED:
134
- default:
135
- return "UNRECOGNIZED";
136
- }
137
- }
138
-
139
- export enum SumAggregation {
140
- SUM_AGGREGATION_UNSPECIFIED = 0,
141
- /** SUM_AGGREGATION_RATE - Per-second rate from monotonic deltas. */
142
- SUM_AGGREGATION_RATE = 1,
143
- /** SUM_AGGREGATION_INCREASE - Windowed total (sum of per-point deltas). */
144
- SUM_AGGREGATION_INCREASE = 2,
145
- /** SUM_AGGREGATION_LAST - Latest cumulative value in each bucket. */
146
- SUM_AGGREGATION_LAST = 3,
147
- SUM_AGGREGATION_COUNT = 4,
148
- UNRECOGNIZED = -1,
149
- }
150
-
151
- export function sumAggregationFromJSON(object: any): SumAggregation {
152
- switch (object) {
153
- case 0:
154
- case "SUM_AGGREGATION_UNSPECIFIED":
155
- return SumAggregation.SUM_AGGREGATION_UNSPECIFIED;
156
- case 1:
157
- case "SUM_AGGREGATION_RATE":
158
- return SumAggregation.SUM_AGGREGATION_RATE;
159
- case 2:
160
- case "SUM_AGGREGATION_INCREASE":
161
- return SumAggregation.SUM_AGGREGATION_INCREASE;
162
- case 3:
163
- case "SUM_AGGREGATION_LAST":
164
- return SumAggregation.SUM_AGGREGATION_LAST;
165
- case 4:
166
- case "SUM_AGGREGATION_COUNT":
167
- return SumAggregation.SUM_AGGREGATION_COUNT;
168
- case -1:
169
- case "UNRECOGNIZED":
170
- default:
171
- return SumAggregation.UNRECOGNIZED;
172
- }
173
- }
174
-
175
- export function sumAggregationToJSON(object: SumAggregation): string {
176
- switch (object) {
177
- case SumAggregation.SUM_AGGREGATION_UNSPECIFIED:
178
- return "SUM_AGGREGATION_UNSPECIFIED";
179
- case SumAggregation.SUM_AGGREGATION_RATE:
180
- return "SUM_AGGREGATION_RATE";
181
- case SumAggregation.SUM_AGGREGATION_INCREASE:
182
- return "SUM_AGGREGATION_INCREASE";
183
- case SumAggregation.SUM_AGGREGATION_LAST:
184
- return "SUM_AGGREGATION_LAST";
185
- case SumAggregation.SUM_AGGREGATION_COUNT:
186
- return "SUM_AGGREGATION_COUNT";
187
- case SumAggregation.UNRECOGNIZED:
188
- default:
189
- return "UNRECOGNIZED";
190
- }
191
- }
192
-
193
- export enum HistogramAggregation {
194
- HISTOGRAM_AGGREGATION_UNSPECIFIED = 0,
195
- /** HISTOGRAM_AGGREGATION_QUANTILE - Interpolated percentile; reads HistogramQuerySpec.quantile. */
196
- HISTOGRAM_AGGREGATION_QUANTILE = 1,
197
- HISTOGRAM_AGGREGATION_AVG = 2,
198
- HISTOGRAM_AGGREGATION_MIN = 3,
199
- HISTOGRAM_AGGREGATION_MAX = 4,
200
- HISTOGRAM_AGGREGATION_COUNT = 5,
201
- UNRECOGNIZED = -1,
202
- }
203
-
204
- export function histogramAggregationFromJSON(object: any): HistogramAggregation {
205
- switch (object) {
206
- case 0:
207
- case "HISTOGRAM_AGGREGATION_UNSPECIFIED":
208
- return HistogramAggregation.HISTOGRAM_AGGREGATION_UNSPECIFIED;
209
- case 1:
210
- case "HISTOGRAM_AGGREGATION_QUANTILE":
211
- return HistogramAggregation.HISTOGRAM_AGGREGATION_QUANTILE;
212
- case 2:
213
- case "HISTOGRAM_AGGREGATION_AVG":
214
- return HistogramAggregation.HISTOGRAM_AGGREGATION_AVG;
215
- case 3:
216
- case "HISTOGRAM_AGGREGATION_MIN":
217
- return HistogramAggregation.HISTOGRAM_AGGREGATION_MIN;
218
- case 4:
219
- case "HISTOGRAM_AGGREGATION_MAX":
220
- return HistogramAggregation.HISTOGRAM_AGGREGATION_MAX;
221
- case 5:
222
- case "HISTOGRAM_AGGREGATION_COUNT":
223
- return HistogramAggregation.HISTOGRAM_AGGREGATION_COUNT;
224
- case -1:
225
- case "UNRECOGNIZED":
226
- default:
227
- return HistogramAggregation.UNRECOGNIZED;
228
- }
229
- }
230
-
231
- export function histogramAggregationToJSON(object: HistogramAggregation): string {
232
- switch (object) {
233
- case HistogramAggregation.HISTOGRAM_AGGREGATION_UNSPECIFIED:
234
- return "HISTOGRAM_AGGREGATION_UNSPECIFIED";
235
- case HistogramAggregation.HISTOGRAM_AGGREGATION_QUANTILE:
236
- return "HISTOGRAM_AGGREGATION_QUANTILE";
237
- case HistogramAggregation.HISTOGRAM_AGGREGATION_AVG:
238
- return "HISTOGRAM_AGGREGATION_AVG";
239
- case HistogramAggregation.HISTOGRAM_AGGREGATION_MIN:
240
- return "HISTOGRAM_AGGREGATION_MIN";
241
- case HistogramAggregation.HISTOGRAM_AGGREGATION_MAX:
242
- return "HISTOGRAM_AGGREGATION_MAX";
243
- case HistogramAggregation.HISTOGRAM_AGGREGATION_COUNT:
244
- return "HISTOGRAM_AGGREGATION_COUNT";
245
- case HistogramAggregation.UNRECOGNIZED:
246
- default:
247
- return "UNRECOGNIZED";
248
- }
249
- }
250
-
251
- export enum ExponentialHistogramAggregation {
252
- EXPONENTIAL_HISTOGRAM_AGGREGATION_UNSPECIFIED = 0,
253
- /** EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE - Percentile from exponential buckets; reads ExponentialHistogramQuerySpec.quantile. */
254
- EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE = 1,
255
- EXPONENTIAL_HISTOGRAM_AGGREGATION_AVG = 2,
256
- EXPONENTIAL_HISTOGRAM_AGGREGATION_MIN = 3,
257
- EXPONENTIAL_HISTOGRAM_AGGREGATION_MAX = 4,
258
- EXPONENTIAL_HISTOGRAM_AGGREGATION_COUNT = 5,
259
- UNRECOGNIZED = -1,
260
- }
261
-
262
- export function exponentialHistogramAggregationFromJSON(object: any): ExponentialHistogramAggregation {
263
- switch (object) {
264
- case 0:
265
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_UNSPECIFIED":
266
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_UNSPECIFIED;
267
- case 1:
268
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE":
269
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE;
270
- case 2:
271
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_AVG":
272
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_AVG;
273
- case 3:
274
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_MIN":
275
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_MIN;
276
- case 4:
277
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_MAX":
278
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_MAX;
279
- case 5:
280
- case "EXPONENTIAL_HISTOGRAM_AGGREGATION_COUNT":
281
- return ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_COUNT;
282
- case -1:
283
- case "UNRECOGNIZED":
284
- default:
285
- return ExponentialHistogramAggregation.UNRECOGNIZED;
286
- }
287
- }
288
-
289
- export function exponentialHistogramAggregationToJSON(object: ExponentialHistogramAggregation): string {
290
- switch (object) {
291
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_UNSPECIFIED:
292
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_UNSPECIFIED";
293
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE:
294
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_QUANTILE";
295
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_AVG:
296
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_AVG";
297
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_MIN:
298
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_MIN";
299
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_MAX:
300
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_MAX";
301
- case ExponentialHistogramAggregation.EXPONENTIAL_HISTOGRAM_AGGREGATION_COUNT:
302
- return "EXPONENTIAL_HISTOGRAM_AGGREGATION_COUNT";
303
- case ExponentialHistogramAggregation.UNRECOGNIZED:
304
- default:
305
- return "UNRECOGNIZED";
306
- }
307
- }
308
-
309
- export enum AttributeFilterOp {
310
- ATTRIBUTE_FILTER_OP_UNSPECIFIED = 0,
311
- ATTRIBUTE_FILTER_OP_EQUALS = 1,
312
- ATTRIBUTE_FILTER_OP_NOT_EQUALS = 2,
313
- ATTRIBUTE_FILTER_OP_IN = 3,
314
- ATTRIBUTE_FILTER_OP_NOT_IN = 4,
315
- UNRECOGNIZED = -1,
316
- }
317
-
318
- export function attributeFilterOpFromJSON(object: any): AttributeFilterOp {
319
- switch (object) {
320
- case 0:
321
- case "ATTRIBUTE_FILTER_OP_UNSPECIFIED":
322
- return AttributeFilterOp.ATTRIBUTE_FILTER_OP_UNSPECIFIED;
323
- case 1:
324
- case "ATTRIBUTE_FILTER_OP_EQUALS":
325
- return AttributeFilterOp.ATTRIBUTE_FILTER_OP_EQUALS;
326
- case 2:
327
- case "ATTRIBUTE_FILTER_OP_NOT_EQUALS":
328
- return AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_EQUALS;
329
- case 3:
330
- case "ATTRIBUTE_FILTER_OP_IN":
331
- return AttributeFilterOp.ATTRIBUTE_FILTER_OP_IN;
332
- case 4:
333
- case "ATTRIBUTE_FILTER_OP_NOT_IN":
334
- return AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_IN;
335
- case -1:
336
- case "UNRECOGNIZED":
337
- default:
338
- return AttributeFilterOp.UNRECOGNIZED;
339
- }
340
- }
341
-
342
- export function attributeFilterOpToJSON(object: AttributeFilterOp): string {
343
- switch (object) {
344
- case AttributeFilterOp.ATTRIBUTE_FILTER_OP_UNSPECIFIED:
345
- return "ATTRIBUTE_FILTER_OP_UNSPECIFIED";
346
- case AttributeFilterOp.ATTRIBUTE_FILTER_OP_EQUALS:
347
- return "ATTRIBUTE_FILTER_OP_EQUALS";
348
- case AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_EQUALS:
349
- return "ATTRIBUTE_FILTER_OP_NOT_EQUALS";
350
- case AttributeFilterOp.ATTRIBUTE_FILTER_OP_IN:
351
- return "ATTRIBUTE_FILTER_OP_IN";
352
- case AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_IN:
353
- return "ATTRIBUTE_FILTER_OP_NOT_IN";
354
- case AttributeFilterOp.UNRECOGNIZED:
355
- default:
356
- return "UNRECOGNIZED";
357
- }
358
- }
359
-
360
76
  export enum WidgetType {
361
77
  WIDGET_TYPE_UNSPECIFIED = 0,
362
78
  /** WIDGET_TYPE_TIMESERIES - Bucketed series over the range. */
@@ -516,7 +232,11 @@ export interface StreamQueryRequest {
516
232
  /** Verified against the caller's identity before proxying. */
517
233
  organizationId: string;
518
234
  projectId: string;
519
- query: MetricQuery | undefined;
235
+ /**
236
+ * PromQL expression. A bucketed time_interval range-queries it (timeseries);
237
+ * WHOLE_RANGE evaluates it instantly at the range end (stat/pie/table).
238
+ */
239
+ promql: string;
520
240
  timeRange:
521
241
  | TimeRange
522
242
  | undefined;
@@ -527,60 +247,6 @@ export interface StreamQueryRequest {
527
247
  timeInterval: AnalyticsTimeInterval;
528
248
  }
529
249
 
530
- /**
531
- * MetricQuery is the stored, validated unit of computation: which metric, how
532
- * to aggregate it, filtered and split by attributes. The kind arm must match
533
- * the metric's catalog kind, and each arm exposes only its own aggregations.
534
- */
535
- export interface MetricQuery {
536
- metricName: string;
537
- gauge?: GaugeQuerySpec | undefined;
538
- sum?: SumQuerySpec | undefined;
539
- histogram?: HistogramQuerySpec | undefined;
540
- exponentialHistogram?:
541
- | ExponentialHistogramQuerySpec
542
- | undefined;
543
- /** ≤16 filters, ANDed. Keys resolve point attributes first, then resource. */
544
- filters: AttributeFilter[];
545
- /**
546
- * Attribute keys to split series by (≤4), same key resolution as filters.
547
- * Empty = one unlabeled series.
548
- */
549
- groupBy: string[];
550
- /**
551
- * Top-k series kept when group_by is set, ranked by aggregate magnitude
552
- * over the range. 0 = server default (10); server-capped at 50.
553
- */
554
- groupLimit: number;
555
- }
556
-
557
- export interface GaugeQuerySpec {
558
- aggregation: GaugeAggregation;
559
- }
560
-
561
- export interface SumQuerySpec {
562
- aggregation: SumAggregation;
563
- }
564
-
565
- export interface HistogramQuerySpec {
566
- aggregation: HistogramAggregation;
567
- /** Quantile level in (0,1); required iff aggregation == QUANTILE. */
568
- quantile: number;
569
- }
570
-
571
- export interface ExponentialHistogramQuerySpec {
572
- aggregation: ExponentialHistogramAggregation;
573
- /** Quantile level in (0,1); required iff aggregation == QUANTILE. */
574
- quantile: number;
575
- }
576
-
577
- export interface AttributeFilter {
578
- key: string;
579
- op: AttributeFilterOp;
580
- /** EQUALS / NOT_EQUALS use exactly one value; IN / NOT_IN use one or more. */
581
- values: string[];
582
- }
583
-
584
250
  export interface TimeRange {
585
251
  /** Relative: [now - window, now). Slides while the stream is open. */
586
252
  window?:
@@ -1478,7 +1144,7 @@ export const MetricAttribute: MessageFns<MetricAttribute> = {
1478
1144
  };
1479
1145
 
1480
1146
  function createBaseStreamQueryRequest(): StreamQueryRequest {
1481
- return { organizationId: "", projectId: "", query: undefined, timeRange: undefined, timeInterval: 0 };
1147
+ return { organizationId: "", projectId: "", promql: "", timeRange: undefined, timeInterval: 0 };
1482
1148
  }
1483
1149
 
1484
1150
  export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
@@ -1489,8 +1155,8 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1489
1155
  if (message.projectId !== "") {
1490
1156
  writer.uint32(18).string(message.projectId);
1491
1157
  }
1492
- if (message.query !== undefined) {
1493
- MetricQuery.encode(message.query, writer.uint32(26).fork()).join();
1158
+ if (message.promql !== "") {
1159
+ writer.uint32(26).string(message.promql);
1494
1160
  }
1495
1161
  if (message.timeRange !== undefined) {
1496
1162
  TimeRange.encode(message.timeRange, writer.uint32(34).fork()).join();
@@ -1529,7 +1195,7 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1529
1195
  break;
1530
1196
  }
1531
1197
 
1532
- message.query = MetricQuery.decode(reader, reader.uint32());
1198
+ message.promql = reader.string();
1533
1199
  continue;
1534
1200
  }
1535
1201
  case 4: {
@@ -1569,7 +1235,7 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1569
1235
  : isSet(object.project_id)
1570
1236
  ? globalThis.String(object.project_id)
1571
1237
  : "",
1572
- query: isSet(object.query) ? MetricQuery.fromJSON(object.query) : undefined,
1238
+ promql: isSet(object.promql) ? globalThis.String(object.promql) : "",
1573
1239
  timeRange: isSet(object.timeRange)
1574
1240
  ? TimeRange.fromJSON(object.timeRange)
1575
1241
  : isSet(object.time_range)
@@ -1591,8 +1257,8 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1591
1257
  if (message.projectId !== "") {
1592
1258
  obj.projectId = message.projectId;
1593
1259
  }
1594
- if (message.query !== undefined) {
1595
- obj.query = MetricQuery.toJSON(message.query);
1260
+ if (message.promql !== "") {
1261
+ obj.promql = message.promql;
1596
1262
  }
1597
1263
  if (message.timeRange !== undefined) {
1598
1264
  obj.timeRange = TimeRange.toJSON(message.timeRange);
@@ -1610,9 +1276,7 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1610
1276
  const message = createBaseStreamQueryRequest();
1611
1277
  message.organizationId = object.organizationId ?? "";
1612
1278
  message.projectId = object.projectId ?? "";
1613
- message.query = (object.query !== undefined && object.query !== null)
1614
- ? MetricQuery.fromPartial(object.query)
1615
- : undefined;
1279
+ message.promql = object.promql ?? "";
1616
1280
  message.timeRange = (object.timeRange !== undefined && object.timeRange !== null)
1617
1281
  ? TimeRange.fromPartial(object.timeRange)
1618
1282
  : undefined;
@@ -1621,573 +1285,6 @@ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1621
1285
  },
1622
1286
  };
1623
1287
 
1624
- function createBaseMetricQuery(): MetricQuery {
1625
- return {
1626
- metricName: "",
1627
- gauge: undefined,
1628
- sum: undefined,
1629
- histogram: undefined,
1630
- exponentialHistogram: undefined,
1631
- filters: [],
1632
- groupBy: [],
1633
- groupLimit: 0,
1634
- };
1635
- }
1636
-
1637
- export const MetricQuery: MessageFns<MetricQuery> = {
1638
- encode(message: MetricQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1639
- if (message.metricName !== "") {
1640
- writer.uint32(10).string(message.metricName);
1641
- }
1642
- if (message.gauge !== undefined) {
1643
- GaugeQuerySpec.encode(message.gauge, writer.uint32(18).fork()).join();
1644
- }
1645
- if (message.sum !== undefined) {
1646
- SumQuerySpec.encode(message.sum, writer.uint32(26).fork()).join();
1647
- }
1648
- if (message.histogram !== undefined) {
1649
- HistogramQuerySpec.encode(message.histogram, writer.uint32(34).fork()).join();
1650
- }
1651
- if (message.exponentialHistogram !== undefined) {
1652
- ExponentialHistogramQuerySpec.encode(message.exponentialHistogram, writer.uint32(66).fork()).join();
1653
- }
1654
- for (const v of message.filters) {
1655
- AttributeFilter.encode(v!, writer.uint32(42).fork()).join();
1656
- }
1657
- for (const v of message.groupBy) {
1658
- writer.uint32(50).string(v!);
1659
- }
1660
- if (message.groupLimit !== 0) {
1661
- writer.uint32(56).int32(message.groupLimit);
1662
- }
1663
- return writer;
1664
- },
1665
-
1666
- decode(input: BinaryReader | Uint8Array, length?: number): MetricQuery {
1667
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1668
- const end = length === undefined ? reader.len : reader.pos + length;
1669
- const message = createBaseMetricQuery();
1670
- while (reader.pos < end) {
1671
- const tag = reader.uint32();
1672
- switch (tag >>> 3) {
1673
- case 1: {
1674
- if (tag !== 10) {
1675
- break;
1676
- }
1677
-
1678
- message.metricName = reader.string();
1679
- continue;
1680
- }
1681
- case 2: {
1682
- if (tag !== 18) {
1683
- break;
1684
- }
1685
-
1686
- message.gauge = GaugeQuerySpec.decode(reader, reader.uint32());
1687
- continue;
1688
- }
1689
- case 3: {
1690
- if (tag !== 26) {
1691
- break;
1692
- }
1693
-
1694
- message.sum = SumQuerySpec.decode(reader, reader.uint32());
1695
- continue;
1696
- }
1697
- case 4: {
1698
- if (tag !== 34) {
1699
- break;
1700
- }
1701
-
1702
- message.histogram = HistogramQuerySpec.decode(reader, reader.uint32());
1703
- continue;
1704
- }
1705
- case 8: {
1706
- if (tag !== 66) {
1707
- break;
1708
- }
1709
-
1710
- message.exponentialHistogram = ExponentialHistogramQuerySpec.decode(reader, reader.uint32());
1711
- continue;
1712
- }
1713
- case 5: {
1714
- if (tag !== 42) {
1715
- break;
1716
- }
1717
-
1718
- message.filters.push(AttributeFilter.decode(reader, reader.uint32()));
1719
- continue;
1720
- }
1721
- case 6: {
1722
- if (tag !== 50) {
1723
- break;
1724
- }
1725
-
1726
- message.groupBy.push(reader.string());
1727
- continue;
1728
- }
1729
- case 7: {
1730
- if (tag !== 56) {
1731
- break;
1732
- }
1733
-
1734
- message.groupLimit = reader.int32();
1735
- continue;
1736
- }
1737
- }
1738
- if ((tag & 7) === 4 || tag === 0) {
1739
- break;
1740
- }
1741
- reader.skip(tag & 7);
1742
- }
1743
- return message;
1744
- },
1745
-
1746
- fromJSON(object: any): MetricQuery {
1747
- return {
1748
- metricName: isSet(object.metricName)
1749
- ? globalThis.String(object.metricName)
1750
- : isSet(object.metric_name)
1751
- ? globalThis.String(object.metric_name)
1752
- : "",
1753
- gauge: isSet(object.gauge) ? GaugeQuerySpec.fromJSON(object.gauge) : undefined,
1754
- sum: isSet(object.sum) ? SumQuerySpec.fromJSON(object.sum) : undefined,
1755
- histogram: isSet(object.histogram) ? HistogramQuerySpec.fromJSON(object.histogram) : undefined,
1756
- exponentialHistogram: isSet(object.exponentialHistogram)
1757
- ? ExponentialHistogramQuerySpec.fromJSON(object.exponentialHistogram)
1758
- : isSet(object.exponential_histogram)
1759
- ? ExponentialHistogramQuerySpec.fromJSON(object.exponential_histogram)
1760
- : undefined,
1761
- filters: globalThis.Array.isArray(object?.filters)
1762
- ? object.filters.map((e: any) => AttributeFilter.fromJSON(e))
1763
- : [],
1764
- groupBy: globalThis.Array.isArray(object?.groupBy)
1765
- ? object.groupBy.map((e: any) => globalThis.String(e))
1766
- : globalThis.Array.isArray(object?.group_by)
1767
- ? object.group_by.map((e: any) => globalThis.String(e))
1768
- : [],
1769
- groupLimit: isSet(object.groupLimit)
1770
- ? globalThis.Number(object.groupLimit)
1771
- : isSet(object.group_limit)
1772
- ? globalThis.Number(object.group_limit)
1773
- : 0,
1774
- };
1775
- },
1776
-
1777
- toJSON(message: MetricQuery): unknown {
1778
- const obj: any = {};
1779
- if (message.metricName !== "") {
1780
- obj.metricName = message.metricName;
1781
- }
1782
- if (message.gauge !== undefined) {
1783
- obj.gauge = GaugeQuerySpec.toJSON(message.gauge);
1784
- }
1785
- if (message.sum !== undefined) {
1786
- obj.sum = SumQuerySpec.toJSON(message.sum);
1787
- }
1788
- if (message.histogram !== undefined) {
1789
- obj.histogram = HistogramQuerySpec.toJSON(message.histogram);
1790
- }
1791
- if (message.exponentialHistogram !== undefined) {
1792
- obj.exponentialHistogram = ExponentialHistogramQuerySpec.toJSON(message.exponentialHistogram);
1793
- }
1794
- if (message.filters?.length) {
1795
- obj.filters = message.filters.map((e) => AttributeFilter.toJSON(e));
1796
- }
1797
- if (message.groupBy?.length) {
1798
- obj.groupBy = message.groupBy;
1799
- }
1800
- if (message.groupLimit !== 0) {
1801
- obj.groupLimit = Math.round(message.groupLimit);
1802
- }
1803
- return obj;
1804
- },
1805
-
1806
- create<I extends Exact<DeepPartial<MetricQuery>, I>>(base?: I): MetricQuery {
1807
- return MetricQuery.fromPartial(base ?? ({} as any));
1808
- },
1809
- fromPartial<I extends Exact<DeepPartial<MetricQuery>, I>>(object: I): MetricQuery {
1810
- const message = createBaseMetricQuery();
1811
- message.metricName = object.metricName ?? "";
1812
- message.gauge = (object.gauge !== undefined && object.gauge !== null)
1813
- ? GaugeQuerySpec.fromPartial(object.gauge)
1814
- : undefined;
1815
- message.sum = (object.sum !== undefined && object.sum !== null) ? SumQuerySpec.fromPartial(object.sum) : undefined;
1816
- message.histogram = (object.histogram !== undefined && object.histogram !== null)
1817
- ? HistogramQuerySpec.fromPartial(object.histogram)
1818
- : undefined;
1819
- message.exponentialHistogram = (object.exponentialHistogram !== undefined && object.exponentialHistogram !== null)
1820
- ? ExponentialHistogramQuerySpec.fromPartial(object.exponentialHistogram)
1821
- : undefined;
1822
- message.filters = object.filters?.map((e) => AttributeFilter.fromPartial(e)) || [];
1823
- message.groupBy = object.groupBy?.map((e) => e) || [];
1824
- message.groupLimit = object.groupLimit ?? 0;
1825
- return message;
1826
- },
1827
- };
1828
-
1829
- function createBaseGaugeQuerySpec(): GaugeQuerySpec {
1830
- return { aggregation: 0 };
1831
- }
1832
-
1833
- export const GaugeQuerySpec: MessageFns<GaugeQuerySpec> = {
1834
- encode(message: GaugeQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1835
- if (message.aggregation !== 0) {
1836
- writer.uint32(8).int32(message.aggregation);
1837
- }
1838
- return writer;
1839
- },
1840
-
1841
- decode(input: BinaryReader | Uint8Array, length?: number): GaugeQuerySpec {
1842
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1843
- const end = length === undefined ? reader.len : reader.pos + length;
1844
- const message = createBaseGaugeQuerySpec();
1845
- while (reader.pos < end) {
1846
- const tag = reader.uint32();
1847
- switch (tag >>> 3) {
1848
- case 1: {
1849
- if (tag !== 8) {
1850
- break;
1851
- }
1852
-
1853
- message.aggregation = reader.int32() as any;
1854
- continue;
1855
- }
1856
- }
1857
- if ((tag & 7) === 4 || tag === 0) {
1858
- break;
1859
- }
1860
- reader.skip(tag & 7);
1861
- }
1862
- return message;
1863
- },
1864
-
1865
- fromJSON(object: any): GaugeQuerySpec {
1866
- return { aggregation: isSet(object.aggregation) ? gaugeAggregationFromJSON(object.aggregation) : 0 };
1867
- },
1868
-
1869
- toJSON(message: GaugeQuerySpec): unknown {
1870
- const obj: any = {};
1871
- if (message.aggregation !== 0) {
1872
- obj.aggregation = gaugeAggregationToJSON(message.aggregation);
1873
- }
1874
- return obj;
1875
- },
1876
-
1877
- create<I extends Exact<DeepPartial<GaugeQuerySpec>, I>>(base?: I): GaugeQuerySpec {
1878
- return GaugeQuerySpec.fromPartial(base ?? ({} as any));
1879
- },
1880
- fromPartial<I extends Exact<DeepPartial<GaugeQuerySpec>, I>>(object: I): GaugeQuerySpec {
1881
- const message = createBaseGaugeQuerySpec();
1882
- message.aggregation = object.aggregation ?? 0;
1883
- return message;
1884
- },
1885
- };
1886
-
1887
- function createBaseSumQuerySpec(): SumQuerySpec {
1888
- return { aggregation: 0 };
1889
- }
1890
-
1891
- export const SumQuerySpec: MessageFns<SumQuerySpec> = {
1892
- encode(message: SumQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1893
- if (message.aggregation !== 0) {
1894
- writer.uint32(8).int32(message.aggregation);
1895
- }
1896
- return writer;
1897
- },
1898
-
1899
- decode(input: BinaryReader | Uint8Array, length?: number): SumQuerySpec {
1900
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1901
- const end = length === undefined ? reader.len : reader.pos + length;
1902
- const message = createBaseSumQuerySpec();
1903
- while (reader.pos < end) {
1904
- const tag = reader.uint32();
1905
- switch (tag >>> 3) {
1906
- case 1: {
1907
- if (tag !== 8) {
1908
- break;
1909
- }
1910
-
1911
- message.aggregation = reader.int32() as any;
1912
- continue;
1913
- }
1914
- }
1915
- if ((tag & 7) === 4 || tag === 0) {
1916
- break;
1917
- }
1918
- reader.skip(tag & 7);
1919
- }
1920
- return message;
1921
- },
1922
-
1923
- fromJSON(object: any): SumQuerySpec {
1924
- return { aggregation: isSet(object.aggregation) ? sumAggregationFromJSON(object.aggregation) : 0 };
1925
- },
1926
-
1927
- toJSON(message: SumQuerySpec): unknown {
1928
- const obj: any = {};
1929
- if (message.aggregation !== 0) {
1930
- obj.aggregation = sumAggregationToJSON(message.aggregation);
1931
- }
1932
- return obj;
1933
- },
1934
-
1935
- create<I extends Exact<DeepPartial<SumQuerySpec>, I>>(base?: I): SumQuerySpec {
1936
- return SumQuerySpec.fromPartial(base ?? ({} as any));
1937
- },
1938
- fromPartial<I extends Exact<DeepPartial<SumQuerySpec>, I>>(object: I): SumQuerySpec {
1939
- const message = createBaseSumQuerySpec();
1940
- message.aggregation = object.aggregation ?? 0;
1941
- return message;
1942
- },
1943
- };
1944
-
1945
- function createBaseHistogramQuerySpec(): HistogramQuerySpec {
1946
- return { aggregation: 0, quantile: 0 };
1947
- }
1948
-
1949
- export const HistogramQuerySpec: MessageFns<HistogramQuerySpec> = {
1950
- encode(message: HistogramQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1951
- if (message.aggregation !== 0) {
1952
- writer.uint32(8).int32(message.aggregation);
1953
- }
1954
- if (message.quantile !== 0) {
1955
- writer.uint32(17).double(message.quantile);
1956
- }
1957
- return writer;
1958
- },
1959
-
1960
- decode(input: BinaryReader | Uint8Array, length?: number): HistogramQuerySpec {
1961
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1962
- const end = length === undefined ? reader.len : reader.pos + length;
1963
- const message = createBaseHistogramQuerySpec();
1964
- while (reader.pos < end) {
1965
- const tag = reader.uint32();
1966
- switch (tag >>> 3) {
1967
- case 1: {
1968
- if (tag !== 8) {
1969
- break;
1970
- }
1971
-
1972
- message.aggregation = reader.int32() as any;
1973
- continue;
1974
- }
1975
- case 2: {
1976
- if (tag !== 17) {
1977
- break;
1978
- }
1979
-
1980
- message.quantile = reader.double();
1981
- continue;
1982
- }
1983
- }
1984
- if ((tag & 7) === 4 || tag === 0) {
1985
- break;
1986
- }
1987
- reader.skip(tag & 7);
1988
- }
1989
- return message;
1990
- },
1991
-
1992
- fromJSON(object: any): HistogramQuerySpec {
1993
- return {
1994
- aggregation: isSet(object.aggregation) ? histogramAggregationFromJSON(object.aggregation) : 0,
1995
- quantile: isSet(object.quantile) ? globalThis.Number(object.quantile) : 0,
1996
- };
1997
- },
1998
-
1999
- toJSON(message: HistogramQuerySpec): unknown {
2000
- const obj: any = {};
2001
- if (message.aggregation !== 0) {
2002
- obj.aggregation = histogramAggregationToJSON(message.aggregation);
2003
- }
2004
- if (message.quantile !== 0) {
2005
- obj.quantile = message.quantile;
2006
- }
2007
- return obj;
2008
- },
2009
-
2010
- create<I extends Exact<DeepPartial<HistogramQuerySpec>, I>>(base?: I): HistogramQuerySpec {
2011
- return HistogramQuerySpec.fromPartial(base ?? ({} as any));
2012
- },
2013
- fromPartial<I extends Exact<DeepPartial<HistogramQuerySpec>, I>>(object: I): HistogramQuerySpec {
2014
- const message = createBaseHistogramQuerySpec();
2015
- message.aggregation = object.aggregation ?? 0;
2016
- message.quantile = object.quantile ?? 0;
2017
- return message;
2018
- },
2019
- };
2020
-
2021
- function createBaseExponentialHistogramQuerySpec(): ExponentialHistogramQuerySpec {
2022
- return { aggregation: 0, quantile: 0 };
2023
- }
2024
-
2025
- export const ExponentialHistogramQuerySpec: MessageFns<ExponentialHistogramQuerySpec> = {
2026
- encode(message: ExponentialHistogramQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2027
- if (message.aggregation !== 0) {
2028
- writer.uint32(8).int32(message.aggregation);
2029
- }
2030
- if (message.quantile !== 0) {
2031
- writer.uint32(17).double(message.quantile);
2032
- }
2033
- return writer;
2034
- },
2035
-
2036
- decode(input: BinaryReader | Uint8Array, length?: number): ExponentialHistogramQuerySpec {
2037
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2038
- const end = length === undefined ? reader.len : reader.pos + length;
2039
- const message = createBaseExponentialHistogramQuerySpec();
2040
- while (reader.pos < end) {
2041
- const tag = reader.uint32();
2042
- switch (tag >>> 3) {
2043
- case 1: {
2044
- if (tag !== 8) {
2045
- break;
2046
- }
2047
-
2048
- message.aggregation = reader.int32() as any;
2049
- continue;
2050
- }
2051
- case 2: {
2052
- if (tag !== 17) {
2053
- break;
2054
- }
2055
-
2056
- message.quantile = reader.double();
2057
- continue;
2058
- }
2059
- }
2060
- if ((tag & 7) === 4 || tag === 0) {
2061
- break;
2062
- }
2063
- reader.skip(tag & 7);
2064
- }
2065
- return message;
2066
- },
2067
-
2068
- fromJSON(object: any): ExponentialHistogramQuerySpec {
2069
- return {
2070
- aggregation: isSet(object.aggregation) ? exponentialHistogramAggregationFromJSON(object.aggregation) : 0,
2071
- quantile: isSet(object.quantile) ? globalThis.Number(object.quantile) : 0,
2072
- };
2073
- },
2074
-
2075
- toJSON(message: ExponentialHistogramQuerySpec): unknown {
2076
- const obj: any = {};
2077
- if (message.aggregation !== 0) {
2078
- obj.aggregation = exponentialHistogramAggregationToJSON(message.aggregation);
2079
- }
2080
- if (message.quantile !== 0) {
2081
- obj.quantile = message.quantile;
2082
- }
2083
- return obj;
2084
- },
2085
-
2086
- create<I extends Exact<DeepPartial<ExponentialHistogramQuerySpec>, I>>(base?: I): ExponentialHistogramQuerySpec {
2087
- return ExponentialHistogramQuerySpec.fromPartial(base ?? ({} as any));
2088
- },
2089
- fromPartial<I extends Exact<DeepPartial<ExponentialHistogramQuerySpec>, I>>(
2090
- object: I,
2091
- ): ExponentialHistogramQuerySpec {
2092
- const message = createBaseExponentialHistogramQuerySpec();
2093
- message.aggregation = object.aggregation ?? 0;
2094
- message.quantile = object.quantile ?? 0;
2095
- return message;
2096
- },
2097
- };
2098
-
2099
- function createBaseAttributeFilter(): AttributeFilter {
2100
- return { key: "", op: 0, values: [] };
2101
- }
2102
-
2103
- export const AttributeFilter: MessageFns<AttributeFilter> = {
2104
- encode(message: AttributeFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2105
- if (message.key !== "") {
2106
- writer.uint32(10).string(message.key);
2107
- }
2108
- if (message.op !== 0) {
2109
- writer.uint32(16).int32(message.op);
2110
- }
2111
- for (const v of message.values) {
2112
- writer.uint32(26).string(v!);
2113
- }
2114
- return writer;
2115
- },
2116
-
2117
- decode(input: BinaryReader | Uint8Array, length?: number): AttributeFilter {
2118
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2119
- const end = length === undefined ? reader.len : reader.pos + length;
2120
- const message = createBaseAttributeFilter();
2121
- while (reader.pos < end) {
2122
- const tag = reader.uint32();
2123
- switch (tag >>> 3) {
2124
- case 1: {
2125
- if (tag !== 10) {
2126
- break;
2127
- }
2128
-
2129
- message.key = reader.string();
2130
- continue;
2131
- }
2132
- case 2: {
2133
- if (tag !== 16) {
2134
- break;
2135
- }
2136
-
2137
- message.op = reader.int32() as any;
2138
- continue;
2139
- }
2140
- case 3: {
2141
- if (tag !== 26) {
2142
- break;
2143
- }
2144
-
2145
- message.values.push(reader.string());
2146
- continue;
2147
- }
2148
- }
2149
- if ((tag & 7) === 4 || tag === 0) {
2150
- break;
2151
- }
2152
- reader.skip(tag & 7);
2153
- }
2154
- return message;
2155
- },
2156
-
2157
- fromJSON(object: any): AttributeFilter {
2158
- return {
2159
- key: isSet(object.key) ? globalThis.String(object.key) : "",
2160
- op: isSet(object.op) ? attributeFilterOpFromJSON(object.op) : 0,
2161
- values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [],
2162
- };
2163
- },
2164
-
2165
- toJSON(message: AttributeFilter): unknown {
2166
- const obj: any = {};
2167
- if (message.key !== "") {
2168
- obj.key = message.key;
2169
- }
2170
- if (message.op !== 0) {
2171
- obj.op = attributeFilterOpToJSON(message.op);
2172
- }
2173
- if (message.values?.length) {
2174
- obj.values = message.values;
2175
- }
2176
- return obj;
2177
- },
2178
-
2179
- create<I extends Exact<DeepPartial<AttributeFilter>, I>>(base?: I): AttributeFilter {
2180
- return AttributeFilter.fromPartial(base ?? ({} as any));
2181
- },
2182
- fromPartial<I extends Exact<DeepPartial<AttributeFilter>, I>>(object: I): AttributeFilter {
2183
- const message = createBaseAttributeFilter();
2184
- message.key = object.key ?? "";
2185
- message.op = object.op ?? 0;
2186
- message.values = object.values?.map((e) => e) || [];
2187
- return message;
2188
- },
2189
- };
2190
-
2191
1288
  function createBaseTimeRange(): TimeRange {
2192
1289
  return { window: undefined, absolute: undefined };
2193
1290
  }
@@ -5177,9 +4274,9 @@ export const WidgetQueryError: MessageFns<WidgetQueryError> = {
5177
4274
  * metric catalog, ad-hoc queries, and Postgres-backed dashboards that compose those
5178
4275
  * queries. Every streaming RPC emits a snapshot first, then live updates.
5179
4276
  *
5180
- * StreamQuery executes one MetricQuery — the same message a dashboard widget
5181
- * stores — so the metrics explorer, the widget editor preview, and a saved
5182
- * dashboard all run through one query path.
4277
+ * StreamQuery evaluates an ad-hoc PromQL expression — the same language saved
4278
+ * dashboard widgets store — so the metrics explorer and the widget editor
4279
+ * preview run through the same query path as the board.
5183
4280
  */
5184
4281
  export interface MetricGatewayService {
5185
4282
  StreamMetrics(request: StreamMetricsRequest, metadata?: Metadata): Observable<MetricCatalogEnvelope>;