@miradorlabs/web-grpc 2.0.0 → 2.2.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.
@@ -1,8 +1,8 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.10
3
+ // protoc-gen-ts_proto v2.12.0
4
4
  // protoc v3.21.12
5
- // source: proto/gateway/web/v1/telemetry_gateway.proto
5
+ // source: proto/gateway/web/v1/metric_gateway.proto
6
6
 
7
7
  /* eslint-disable */
8
8
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -131,8 +131,11 @@ export function gaugeAggregationToJSON(object: GaugeAggregation): string {
131
131
 
132
132
  export enum SumAggregation {
133
133
  SUM_AGGREGATION_UNSPECIFIED = 0,
134
+ /** SUM_AGGREGATION_RATE - Per-second rate from monotonic deltas. */
134
135
  SUM_AGGREGATION_RATE = 1,
136
+ /** SUM_AGGREGATION_INCREASE - Windowed total (sum of per-point deltas). */
135
137
  SUM_AGGREGATION_INCREASE = 2,
138
+ /** SUM_AGGREGATION_LAST - Latest cumulative value in each bucket. */
136
139
  SUM_AGGREGATION_LAST = 3,
137
140
  SUM_AGGREGATION_COUNT = 4,
138
141
  UNRECOGNIZED = -1,
@@ -182,6 +185,7 @@ export function sumAggregationToJSON(object: SumAggregation): string {
182
185
 
183
186
  export enum HistogramAggregation {
184
187
  HISTOGRAM_AGGREGATION_UNSPECIFIED = 0,
188
+ /** HISTOGRAM_AGGREGATION_QUANTILE - Interpolated percentile; reads HistogramQuerySpec.quantile. */
185
189
  HISTOGRAM_AGGREGATION_QUANTILE = 1,
186
190
  HISTOGRAM_AGGREGATION_AVG = 2,
187
191
  HISTOGRAM_AGGREGATION_MIN = 3,
@@ -237,8 +241,59 @@ export function histogramAggregationToJSON(object: HistogramAggregation): string
237
241
  }
238
242
  }
239
243
 
244
+ export enum AttributeFilterOp {
245
+ ATTRIBUTE_FILTER_OP_UNSPECIFIED = 0,
246
+ ATTRIBUTE_FILTER_OP_EQUALS = 1,
247
+ ATTRIBUTE_FILTER_OP_NOT_EQUALS = 2,
248
+ ATTRIBUTE_FILTER_OP_IN = 3,
249
+ ATTRIBUTE_FILTER_OP_NOT_IN = 4,
250
+ UNRECOGNIZED = -1,
251
+ }
252
+
253
+ export function attributeFilterOpFromJSON(object: any): AttributeFilterOp {
254
+ switch (object) {
255
+ case 0:
256
+ case "ATTRIBUTE_FILTER_OP_UNSPECIFIED":
257
+ return AttributeFilterOp.ATTRIBUTE_FILTER_OP_UNSPECIFIED;
258
+ case 1:
259
+ case "ATTRIBUTE_FILTER_OP_EQUALS":
260
+ return AttributeFilterOp.ATTRIBUTE_FILTER_OP_EQUALS;
261
+ case 2:
262
+ case "ATTRIBUTE_FILTER_OP_NOT_EQUALS":
263
+ return AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_EQUALS;
264
+ case 3:
265
+ case "ATTRIBUTE_FILTER_OP_IN":
266
+ return AttributeFilterOp.ATTRIBUTE_FILTER_OP_IN;
267
+ case 4:
268
+ case "ATTRIBUTE_FILTER_OP_NOT_IN":
269
+ return AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_IN;
270
+ case -1:
271
+ case "UNRECOGNIZED":
272
+ default:
273
+ return AttributeFilterOp.UNRECOGNIZED;
274
+ }
275
+ }
276
+
277
+ export function attributeFilterOpToJSON(object: AttributeFilterOp): string {
278
+ switch (object) {
279
+ case AttributeFilterOp.ATTRIBUTE_FILTER_OP_UNSPECIFIED:
280
+ return "ATTRIBUTE_FILTER_OP_UNSPECIFIED";
281
+ case AttributeFilterOp.ATTRIBUTE_FILTER_OP_EQUALS:
282
+ return "ATTRIBUTE_FILTER_OP_EQUALS";
283
+ case AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_EQUALS:
284
+ return "ATTRIBUTE_FILTER_OP_NOT_EQUALS";
285
+ case AttributeFilterOp.ATTRIBUTE_FILTER_OP_IN:
286
+ return "ATTRIBUTE_FILTER_OP_IN";
287
+ case AttributeFilterOp.ATTRIBUTE_FILTER_OP_NOT_IN:
288
+ return "ATTRIBUTE_FILTER_OP_NOT_IN";
289
+ case AttributeFilterOp.UNRECOGNIZED:
290
+ default:
291
+ return "UNRECOGNIZED";
292
+ }
293
+ }
294
+
240
295
  export interface StreamMetricsRequest {
241
- /** Stamped by the gateway from the verified identity never client-supplied. */
296
+ /** Verified against the caller's identity before proxying. */
242
297
  organizationId: string;
243
298
  projectId: string;
244
299
  }
@@ -259,7 +314,7 @@ export interface MetricInfo {
259
314
  }
260
315
 
261
316
  export interface StreamMetricAttributesRequest {
262
- /** Stamped by the gateway from the verified identity never client-supplied. */
317
+ /** Verified against the caller's identity before proxying. */
263
318
  organizationId: string;
264
319
  projectId: string;
265
320
  metricName: string;
@@ -279,66 +334,134 @@ export interface MetricAttribute {
279
334
  values: string[];
280
335
  }
281
336
 
282
- export interface GaugeQueryRequest {
283
- /** Stamped by the gateway from the verified identity never client-supplied. */
337
+ export interface StreamQueryRequest {
338
+ /** Verified against the caller's identity before proxying. */
284
339
  organizationId: string;
285
340
  projectId: string;
286
- metricName: string;
287
- aggregation: GaugeAggregation;
288
- timeWindow: AnalyticsTimeWindow;
341
+ query: MetricQuery | undefined;
342
+ timeRange:
343
+ | TimeRange
344
+ | undefined;
345
+ /**
346
+ * UNSPECIFIED = the server picks a sane interval for the range;
347
+ * WHOLE_RANGE = one bucket spanning the range (stat/pie/table shapes).
348
+ */
289
349
  timeInterval: AnalyticsTimeInterval;
290
350
  }
291
351
 
292
- export interface SumQueryRequest {
293
- /** Stamped by the gateway from the verified identity never client-supplied. */
294
- organizationId: string;
295
- projectId: string;
352
+ /**
353
+ * MetricQuery is the stored, validated unit of computation: which metric, how
354
+ * to aggregate it, filtered and split by attributes. The kind arm must match
355
+ * the metric's catalog kind, and each arm exposes only its own aggregations.
356
+ */
357
+ export interface MetricQuery {
296
358
  metricName: string;
359
+ gauge?: GaugeQuerySpec | undefined;
360
+ sum?: SumQuerySpec | undefined;
361
+ histogram?:
362
+ | HistogramQuerySpec
363
+ | undefined;
364
+ /** ≤16 filters, ANDed. Keys resolve point attributes first, then resource. */
365
+ filters: AttributeFilter[];
366
+ /**
367
+ * Attribute keys to split series by (≤4), same key resolution as filters.
368
+ * Empty = one unlabeled series.
369
+ */
370
+ groupBy: string[];
371
+ /**
372
+ * Top-k series kept when group_by is set, ranked by aggregate magnitude
373
+ * over the range. 0 = server default (10); server-capped at 50.
374
+ */
375
+ groupLimit: number;
376
+ }
377
+
378
+ export interface GaugeQuerySpec {
379
+ aggregation: GaugeAggregation;
380
+ }
381
+
382
+ export interface SumQuerySpec {
297
383
  aggregation: SumAggregation;
298
- timeWindow: AnalyticsTimeWindow;
299
- timeInterval: AnalyticsTimeInterval;
300
384
  }
301
385
 
302
- export interface HistogramQueryRequest {
303
- /** Stamped by the gateway from the verified identity — never client-supplied. */
304
- organizationId: string;
305
- projectId: string;
306
- metricName: string;
386
+ export interface HistogramQuerySpec {
307
387
  aggregation: HistogramAggregation;
308
388
  /** Quantile level in (0,1); required iff aggregation == QUANTILE. */
309
389
  quantile: number;
310
- timeWindow: AnalyticsTimeWindow;
311
- timeInterval: AnalyticsTimeInterval;
312
390
  }
313
391
 
314
- export interface MetricAnalyticsEnvelope {
315
- snapshot?: MetricAnalyticsSnapshot | undefined;
316
- bucketUpdate?: MetricSeriesBucketUpdate | undefined;
392
+ export interface AttributeFilter {
393
+ key: string;
394
+ op: AttributeFilterOp;
395
+ /** EQUALS / NOT_EQUALS use exactly one value; IN / NOT_IN use one or more. */
396
+ values: string[];
397
+ }
398
+
399
+ export interface TimeRange {
400
+ /** Relative: [now - window, now). Slides while the stream is open. */
401
+ window?:
402
+ | AnalyticsTimeWindow
403
+ | undefined;
404
+ /** Fixed range (e.g. drag-to-zoom): snapshot only, then the stream completes. */
405
+ absolute?: AbsoluteTimeRange | undefined;
406
+ }
407
+
408
+ export interface AbsoluteTimeRange {
409
+ start: Date | undefined;
410
+ end: Date | undefined;
411
+ }
412
+
413
+ export interface QueryDataEnvelope {
414
+ snapshot?: QuerySnapshot | undefined;
415
+ update?: QuerySeriesUpdate | undefined;
317
416
  }
318
417
 
319
- export interface MetricAnalyticsSnapshot {
418
+ export interface QuerySnapshot {
419
+ /**
420
+ * One entry per group_by value combination; a single series with empty
421
+ * group_values when the query has no group_by.
422
+ */
320
423
  series: MetricSeries[];
321
- windowStart: Date | undefined;
322
- windowEnd: Date | undefined;
424
+ rangeStart: Date | undefined;
425
+ rangeEnd: Date | undefined;
323
426
  bucketSizeMs: number;
427
+ /** Drives frontend gap fill (buckets are sparse); 1 for WHOLE_RANGE. */
324
428
  expectedBucketCount: number;
325
429
  unit: string;
326
430
  }
327
431
 
328
432
  export interface MetricSeries {
433
+ /** group_by key → this series' value. Empty for ungrouped queries. */
434
+ groupValues: { [key: string]: string };
435
+ /** Sparse: buckets with no data are omitted. */
329
436
  buckets: MetricBucket[];
330
437
  }
331
438
 
439
+ export interface MetricSeries_GroupValuesEntry {
440
+ key: string;
441
+ value: string;
442
+ }
443
+
332
444
  export interface MetricBucket {
333
445
  bucketStart: Date | undefined;
334
446
  value: number;
335
447
  }
336
448
 
337
- export interface MetricSeriesBucketUpdate {
449
+ /**
450
+ * QuerySeriesUpdate replaces the bucket with the same bucket_start in the
451
+ * identified series; unseen group_values introduce a new series. For
452
+ * WHOLE_RANGE queries it replaces the single whole-range bucket.
453
+ */
454
+ export interface QuerySeriesUpdate {
455
+ groupValues: { [key: string]: string };
338
456
  bucket: MetricBucket | undefined;
339
457
  generatedAt: Date | undefined;
340
458
  }
341
459
 
460
+ export interface QuerySeriesUpdate_GroupValuesEntry {
461
+ key: string;
462
+ value: string;
463
+ }
464
+
342
465
  function createBaseStreamMetricsRequest(): StreamMetricsRequest {
343
466
  return { organizationId: "", projectId: "" };
344
467
  }
@@ -979,37 +1102,34 @@ export const MetricAttribute: MessageFns<MetricAttribute> = {
979
1102
  },
980
1103
  };
981
1104
 
982
- function createBaseGaugeQueryRequest(): GaugeQueryRequest {
983
- return { organizationId: "", projectId: "", metricName: "", aggregation: 0, timeWindow: 0, timeInterval: 0 };
1105
+ function createBaseStreamQueryRequest(): StreamQueryRequest {
1106
+ return { organizationId: "", projectId: "", query: undefined, timeRange: undefined, timeInterval: 0 };
984
1107
  }
985
1108
 
986
- export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
987
- encode(message: GaugeQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1109
+ export const StreamQueryRequest: MessageFns<StreamQueryRequest> = {
1110
+ encode(message: StreamQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
988
1111
  if (message.organizationId !== "") {
989
1112
  writer.uint32(10).string(message.organizationId);
990
1113
  }
991
1114
  if (message.projectId !== "") {
992
1115
  writer.uint32(18).string(message.projectId);
993
1116
  }
994
- if (message.metricName !== "") {
995
- writer.uint32(26).string(message.metricName);
996
- }
997
- if (message.aggregation !== 0) {
998
- writer.uint32(32).int32(message.aggregation);
1117
+ if (message.query !== undefined) {
1118
+ MetricQuery.encode(message.query, writer.uint32(26).fork()).join();
999
1119
  }
1000
- if (message.timeWindow !== 0) {
1001
- writer.uint32(40).int32(message.timeWindow);
1120
+ if (message.timeRange !== undefined) {
1121
+ TimeRange.encode(message.timeRange, writer.uint32(34).fork()).join();
1002
1122
  }
1003
1123
  if (message.timeInterval !== 0) {
1004
- writer.uint32(48).int32(message.timeInterval);
1124
+ writer.uint32(40).int32(message.timeInterval);
1005
1125
  }
1006
1126
  return writer;
1007
1127
  },
1008
1128
 
1009
- decode(input: BinaryReader | Uint8Array, length?: number): GaugeQueryRequest {
1129
+ decode(input: BinaryReader | Uint8Array, length?: number): StreamQueryRequest {
1010
1130
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1011
1131
  const end = length === undefined ? reader.len : reader.pos + length;
1012
- const message = createBaseGaugeQueryRequest();
1132
+ const message = createBaseStreamQueryRequest();
1013
1133
  while (reader.pos < end) {
1014
1134
  const tag = reader.uint32();
1015
1135
  switch (tag >>> 3) {
@@ -1034,15 +1154,15 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1034
1154
  break;
1035
1155
  }
1036
1156
 
1037
- message.metricName = reader.string();
1157
+ message.query = MetricQuery.decode(reader, reader.uint32());
1038
1158
  continue;
1039
1159
  }
1040
1160
  case 4: {
1041
- if (tag !== 32) {
1161
+ if (tag !== 34) {
1042
1162
  break;
1043
1163
  }
1044
1164
 
1045
- message.aggregation = reader.int32() as any;
1165
+ message.timeRange = TimeRange.decode(reader, reader.uint32());
1046
1166
  continue;
1047
1167
  }
1048
1168
  case 5: {
@@ -1050,14 +1170,6 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1050
1170
  break;
1051
1171
  }
1052
1172
 
1053
- message.timeWindow = reader.int32() as any;
1054
- continue;
1055
- }
1056
- case 6: {
1057
- if (tag !== 48) {
1058
- break;
1059
- }
1060
-
1061
1173
  message.timeInterval = reader.int32() as any;
1062
1174
  continue;
1063
1175
  }
@@ -1070,7 +1182,7 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1070
1182
  return message;
1071
1183
  },
1072
1184
 
1073
- fromJSON(object: any): GaugeQueryRequest {
1185
+ fromJSON(object: any): StreamQueryRequest {
1074
1186
  return {
1075
1187
  organizationId: isSet(object.organizationId)
1076
1188
  ? globalThis.String(object.organizationId)
@@ -1082,17 +1194,12 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1082
1194
  : isSet(object.project_id)
1083
1195
  ? globalThis.String(object.project_id)
1084
1196
  : "",
1085
- metricName: isSet(object.metricName)
1086
- ? globalThis.String(object.metricName)
1087
- : isSet(object.metric_name)
1088
- ? globalThis.String(object.metric_name)
1089
- : "",
1090
- aggregation: isSet(object.aggregation) ? gaugeAggregationFromJSON(object.aggregation) : 0,
1091
- timeWindow: isSet(object.timeWindow)
1092
- ? analyticsTimeWindowFromJSON(object.timeWindow)
1093
- : isSet(object.time_window)
1094
- ? analyticsTimeWindowFromJSON(object.time_window)
1095
- : 0,
1197
+ query: isSet(object.query) ? MetricQuery.fromJSON(object.query) : undefined,
1198
+ timeRange: isSet(object.timeRange)
1199
+ ? TimeRange.fromJSON(object.timeRange)
1200
+ : isSet(object.time_range)
1201
+ ? TimeRange.fromJSON(object.time_range)
1202
+ : undefined,
1096
1203
  timeInterval: isSet(object.timeInterval)
1097
1204
  ? analyticsTimeIntervalFromJSON(object.timeInterval)
1098
1205
  : isSet(object.time_interval)
@@ -1101,7 +1208,7 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1101
1208
  };
1102
1209
  },
1103
1210
 
1104
- toJSON(message: GaugeQueryRequest): unknown {
1211
+ toJSON(message: StreamQueryRequest): unknown {
1105
1212
  const obj: any = {};
1106
1213
  if (message.organizationId !== "") {
1107
1214
  obj.organizationId = message.organizationId;
@@ -1109,14 +1216,11 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1109
1216
  if (message.projectId !== "") {
1110
1217
  obj.projectId = message.projectId;
1111
1218
  }
1112
- if (message.metricName !== "") {
1113
- obj.metricName = message.metricName;
1114
- }
1115
- if (message.aggregation !== 0) {
1116
- obj.aggregation = gaugeAggregationToJSON(message.aggregation);
1219
+ if (message.query !== undefined) {
1220
+ obj.query = MetricQuery.toJSON(message.query);
1117
1221
  }
1118
- if (message.timeWindow !== 0) {
1119
- obj.timeWindow = analyticsTimeWindowToJSON(message.timeWindow);
1222
+ if (message.timeRange !== undefined) {
1223
+ obj.timeRange = TimeRange.toJSON(message.timeRange);
1120
1224
  }
1121
1225
  if (message.timeInterval !== 0) {
1122
1226
  obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
@@ -1124,52 +1228,66 @@ export const GaugeQueryRequest: MessageFns<GaugeQueryRequest> = {
1124
1228
  return obj;
1125
1229
  },
1126
1230
 
1127
- create<I extends Exact<DeepPartial<GaugeQueryRequest>, I>>(base?: I): GaugeQueryRequest {
1128
- return GaugeQueryRequest.fromPartial(base ?? ({} as any));
1231
+ create<I extends Exact<DeepPartial<StreamQueryRequest>, I>>(base?: I): StreamQueryRequest {
1232
+ return StreamQueryRequest.fromPartial(base ?? ({} as any));
1129
1233
  },
1130
- fromPartial<I extends Exact<DeepPartial<GaugeQueryRequest>, I>>(object: I): GaugeQueryRequest {
1131
- const message = createBaseGaugeQueryRequest();
1234
+ fromPartial<I extends Exact<DeepPartial<StreamQueryRequest>, I>>(object: I): StreamQueryRequest {
1235
+ const message = createBaseStreamQueryRequest();
1132
1236
  message.organizationId = object.organizationId ?? "";
1133
1237
  message.projectId = object.projectId ?? "";
1134
- message.metricName = object.metricName ?? "";
1135
- message.aggregation = object.aggregation ?? 0;
1136
- message.timeWindow = object.timeWindow ?? 0;
1238
+ message.query = (object.query !== undefined && object.query !== null)
1239
+ ? MetricQuery.fromPartial(object.query)
1240
+ : undefined;
1241
+ message.timeRange = (object.timeRange !== undefined && object.timeRange !== null)
1242
+ ? TimeRange.fromPartial(object.timeRange)
1243
+ : undefined;
1137
1244
  message.timeInterval = object.timeInterval ?? 0;
1138
1245
  return message;
1139
1246
  },
1140
1247
  };
1141
1248
 
1142
- function createBaseSumQueryRequest(): SumQueryRequest {
1143
- return { organizationId: "", projectId: "", metricName: "", aggregation: 0, timeWindow: 0, timeInterval: 0 };
1249
+ function createBaseMetricQuery(): MetricQuery {
1250
+ return {
1251
+ metricName: "",
1252
+ gauge: undefined,
1253
+ sum: undefined,
1254
+ histogram: undefined,
1255
+ filters: [],
1256
+ groupBy: [],
1257
+ groupLimit: 0,
1258
+ };
1144
1259
  }
1145
1260
 
1146
- export const SumQueryRequest: MessageFns<SumQueryRequest> = {
1147
- encode(message: SumQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1148
- if (message.organizationId !== "") {
1149
- writer.uint32(10).string(message.organizationId);
1261
+ export const MetricQuery: MessageFns<MetricQuery> = {
1262
+ encode(message: MetricQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1263
+ if (message.metricName !== "") {
1264
+ writer.uint32(10).string(message.metricName);
1150
1265
  }
1151
- if (message.projectId !== "") {
1152
- writer.uint32(18).string(message.projectId);
1266
+ if (message.gauge !== undefined) {
1267
+ GaugeQuerySpec.encode(message.gauge, writer.uint32(18).fork()).join();
1153
1268
  }
1154
- if (message.metricName !== "") {
1155
- writer.uint32(26).string(message.metricName);
1269
+ if (message.sum !== undefined) {
1270
+ SumQuerySpec.encode(message.sum, writer.uint32(26).fork()).join();
1156
1271
  }
1157
- if (message.aggregation !== 0) {
1158
- writer.uint32(32).int32(message.aggregation);
1272
+ if (message.histogram !== undefined) {
1273
+ HistogramQuerySpec.encode(message.histogram, writer.uint32(34).fork()).join();
1159
1274
  }
1160
- if (message.timeWindow !== 0) {
1161
- writer.uint32(40).int32(message.timeWindow);
1275
+ for (const v of message.filters) {
1276
+ AttributeFilter.encode(v!, writer.uint32(42).fork()).join();
1162
1277
  }
1163
- if (message.timeInterval !== 0) {
1164
- writer.uint32(48).int32(message.timeInterval);
1278
+ for (const v of message.groupBy) {
1279
+ writer.uint32(50).string(v!);
1280
+ }
1281
+ if (message.groupLimit !== 0) {
1282
+ writer.uint32(56).int32(message.groupLimit);
1165
1283
  }
1166
1284
  return writer;
1167
1285
  },
1168
1286
 
1169
- decode(input: BinaryReader | Uint8Array, length?: number): SumQueryRequest {
1287
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricQuery {
1170
1288
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1171
1289
  const end = length === undefined ? reader.len : reader.pos + length;
1172
- const message = createBaseSumQueryRequest();
1290
+ const message = createBaseMetricQuery();
1173
1291
  while (reader.pos < end) {
1174
1292
  const tag = reader.uint32();
1175
1293
  switch (tag >>> 3) {
@@ -1178,7 +1296,7 @@ export const SumQueryRequest: MessageFns<SumQueryRequest> = {
1178
1296
  break;
1179
1297
  }
1180
1298
 
1181
- message.organizationId = reader.string();
1299
+ message.metricName = reader.string();
1182
1300
  continue;
1183
1301
  }
1184
1302
  case 2: {
@@ -1186,7 +1304,7 @@ export const SumQueryRequest: MessageFns<SumQueryRequest> = {
1186
1304
  break;
1187
1305
  }
1188
1306
 
1189
- message.projectId = reader.string();
1307
+ message.gauge = GaugeQuerySpec.decode(reader, reader.uint32());
1190
1308
  continue;
1191
1309
  }
1192
1310
  case 3: {
@@ -1194,31 +1312,39 @@ export const SumQueryRequest: MessageFns<SumQueryRequest> = {
1194
1312
  break;
1195
1313
  }
1196
1314
 
1197
- message.metricName = reader.string();
1315
+ message.sum = SumQuerySpec.decode(reader, reader.uint32());
1198
1316
  continue;
1199
1317
  }
1200
1318
  case 4: {
1201
- if (tag !== 32) {
1319
+ if (tag !== 34) {
1202
1320
  break;
1203
1321
  }
1204
1322
 
1205
- message.aggregation = reader.int32() as any;
1323
+ message.histogram = HistogramQuerySpec.decode(reader, reader.uint32());
1206
1324
  continue;
1207
1325
  }
1208
1326
  case 5: {
1209
- if (tag !== 40) {
1327
+ if (tag !== 42) {
1210
1328
  break;
1211
1329
  }
1212
1330
 
1213
- message.timeWindow = reader.int32() as any;
1331
+ message.filters.push(AttributeFilter.decode(reader, reader.uint32()));
1214
1332
  continue;
1215
1333
  }
1216
1334
  case 6: {
1217
- if (tag !== 48) {
1335
+ if (tag !== 50) {
1218
1336
  break;
1219
1337
  }
1220
1338
 
1221
- message.timeInterval = reader.int32() as any;
1339
+ message.groupBy.push(reader.string());
1340
+ continue;
1341
+ }
1342
+ case 7: {
1343
+ if (tag !== 56) {
1344
+ break;
1345
+ }
1346
+
1347
+ message.groupLimit = reader.int32();
1222
1348
  continue;
1223
1349
  }
1224
1350
  }
@@ -1230,176 +1356,105 @@ export const SumQueryRequest: MessageFns<SumQueryRequest> = {
1230
1356
  return message;
1231
1357
  },
1232
1358
 
1233
- fromJSON(object: any): SumQueryRequest {
1359
+ fromJSON(object: any): MetricQuery {
1234
1360
  return {
1235
- organizationId: isSet(object.organizationId)
1236
- ? globalThis.String(object.organizationId)
1237
- : isSet(object.organization_id)
1238
- ? globalThis.String(object.organization_id)
1239
- : "",
1240
- projectId: isSet(object.projectId)
1241
- ? globalThis.String(object.projectId)
1242
- : isSet(object.project_id)
1243
- ? globalThis.String(object.project_id)
1244
- : "",
1245
1361
  metricName: isSet(object.metricName)
1246
1362
  ? globalThis.String(object.metricName)
1247
1363
  : isSet(object.metric_name)
1248
1364
  ? globalThis.String(object.metric_name)
1249
1365
  : "",
1250
- aggregation: isSet(object.aggregation) ? sumAggregationFromJSON(object.aggregation) : 0,
1251
- timeWindow: isSet(object.timeWindow)
1252
- ? analyticsTimeWindowFromJSON(object.timeWindow)
1253
- : isSet(object.time_window)
1254
- ? analyticsTimeWindowFromJSON(object.time_window)
1255
- : 0,
1256
- timeInterval: isSet(object.timeInterval)
1257
- ? analyticsTimeIntervalFromJSON(object.timeInterval)
1258
- : isSet(object.time_interval)
1259
- ? analyticsTimeIntervalFromJSON(object.time_interval)
1366
+ gauge: isSet(object.gauge) ? GaugeQuerySpec.fromJSON(object.gauge) : undefined,
1367
+ sum: isSet(object.sum) ? SumQuerySpec.fromJSON(object.sum) : undefined,
1368
+ histogram: isSet(object.histogram) ? HistogramQuerySpec.fromJSON(object.histogram) : undefined,
1369
+ filters: globalThis.Array.isArray(object?.filters)
1370
+ ? object.filters.map((e: any) => AttributeFilter.fromJSON(e))
1371
+ : [],
1372
+ groupBy: globalThis.Array.isArray(object?.groupBy)
1373
+ ? object.groupBy.map((e: any) => globalThis.String(e))
1374
+ : globalThis.Array.isArray(object?.group_by)
1375
+ ? object.group_by.map((e: any) => globalThis.String(e))
1376
+ : [],
1377
+ groupLimit: isSet(object.groupLimit)
1378
+ ? globalThis.Number(object.groupLimit)
1379
+ : isSet(object.group_limit)
1380
+ ? globalThis.Number(object.group_limit)
1260
1381
  : 0,
1261
1382
  };
1262
1383
  },
1263
1384
 
1264
- toJSON(message: SumQueryRequest): unknown {
1385
+ toJSON(message: MetricQuery): unknown {
1265
1386
  const obj: any = {};
1266
- if (message.organizationId !== "") {
1267
- obj.organizationId = message.organizationId;
1268
- }
1269
- if (message.projectId !== "") {
1270
- obj.projectId = message.projectId;
1271
- }
1272
1387
  if (message.metricName !== "") {
1273
1388
  obj.metricName = message.metricName;
1274
1389
  }
1275
- if (message.aggregation !== 0) {
1276
- obj.aggregation = sumAggregationToJSON(message.aggregation);
1390
+ if (message.gauge !== undefined) {
1391
+ obj.gauge = GaugeQuerySpec.toJSON(message.gauge);
1277
1392
  }
1278
- if (message.timeWindow !== 0) {
1279
- obj.timeWindow = analyticsTimeWindowToJSON(message.timeWindow);
1393
+ if (message.sum !== undefined) {
1394
+ obj.sum = SumQuerySpec.toJSON(message.sum);
1280
1395
  }
1281
- if (message.timeInterval !== 0) {
1282
- obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
1396
+ if (message.histogram !== undefined) {
1397
+ obj.histogram = HistogramQuerySpec.toJSON(message.histogram);
1398
+ }
1399
+ if (message.filters?.length) {
1400
+ obj.filters = message.filters.map((e) => AttributeFilter.toJSON(e));
1401
+ }
1402
+ if (message.groupBy?.length) {
1403
+ obj.groupBy = message.groupBy;
1404
+ }
1405
+ if (message.groupLimit !== 0) {
1406
+ obj.groupLimit = Math.round(message.groupLimit);
1283
1407
  }
1284
1408
  return obj;
1285
1409
  },
1286
1410
 
1287
- create<I extends Exact<DeepPartial<SumQueryRequest>, I>>(base?: I): SumQueryRequest {
1288
- return SumQueryRequest.fromPartial(base ?? ({} as any));
1411
+ create<I extends Exact<DeepPartial<MetricQuery>, I>>(base?: I): MetricQuery {
1412
+ return MetricQuery.fromPartial(base ?? ({} as any));
1289
1413
  },
1290
- fromPartial<I extends Exact<DeepPartial<SumQueryRequest>, I>>(object: I): SumQueryRequest {
1291
- const message = createBaseSumQueryRequest();
1292
- message.organizationId = object.organizationId ?? "";
1293
- message.projectId = object.projectId ?? "";
1414
+ fromPartial<I extends Exact<DeepPartial<MetricQuery>, I>>(object: I): MetricQuery {
1415
+ const message = createBaseMetricQuery();
1294
1416
  message.metricName = object.metricName ?? "";
1295
- message.aggregation = object.aggregation ?? 0;
1296
- message.timeWindow = object.timeWindow ?? 0;
1297
- message.timeInterval = object.timeInterval ?? 0;
1417
+ message.gauge = (object.gauge !== undefined && object.gauge !== null)
1418
+ ? GaugeQuerySpec.fromPartial(object.gauge)
1419
+ : undefined;
1420
+ message.sum = (object.sum !== undefined && object.sum !== null) ? SumQuerySpec.fromPartial(object.sum) : undefined;
1421
+ message.histogram = (object.histogram !== undefined && object.histogram !== null)
1422
+ ? HistogramQuerySpec.fromPartial(object.histogram)
1423
+ : undefined;
1424
+ message.filters = object.filters?.map((e) => AttributeFilter.fromPartial(e)) || [];
1425
+ message.groupBy = object.groupBy?.map((e) => e) || [];
1426
+ message.groupLimit = object.groupLimit ?? 0;
1298
1427
  return message;
1299
1428
  },
1300
1429
  };
1301
1430
 
1302
- function createBaseHistogramQueryRequest(): HistogramQueryRequest {
1303
- return {
1304
- organizationId: "",
1305
- projectId: "",
1306
- metricName: "",
1307
- aggregation: 0,
1308
- quantile: 0,
1309
- timeWindow: 0,
1310
- timeInterval: 0,
1311
- };
1431
+ function createBaseGaugeQuerySpec(): GaugeQuerySpec {
1432
+ return { aggregation: 0 };
1312
1433
  }
1313
1434
 
1314
- export const HistogramQueryRequest: MessageFns<HistogramQueryRequest> = {
1315
- encode(message: HistogramQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1316
- if (message.organizationId !== "") {
1317
- writer.uint32(10).string(message.organizationId);
1318
- }
1319
- if (message.projectId !== "") {
1320
- writer.uint32(18).string(message.projectId);
1321
- }
1322
- if (message.metricName !== "") {
1323
- writer.uint32(26).string(message.metricName);
1324
- }
1435
+ export const GaugeQuerySpec: MessageFns<GaugeQuerySpec> = {
1436
+ encode(message: GaugeQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1325
1437
  if (message.aggregation !== 0) {
1326
- writer.uint32(32).int32(message.aggregation);
1327
- }
1328
- if (message.quantile !== 0) {
1329
- writer.uint32(41).double(message.quantile);
1330
- }
1331
- if (message.timeWindow !== 0) {
1332
- writer.uint32(48).int32(message.timeWindow);
1333
- }
1334
- if (message.timeInterval !== 0) {
1335
- writer.uint32(56).int32(message.timeInterval);
1438
+ writer.uint32(8).int32(message.aggregation);
1336
1439
  }
1337
1440
  return writer;
1338
1441
  },
1339
1442
 
1340
- decode(input: BinaryReader | Uint8Array, length?: number): HistogramQueryRequest {
1443
+ decode(input: BinaryReader | Uint8Array, length?: number): GaugeQuerySpec {
1341
1444
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1342
1445
  const end = length === undefined ? reader.len : reader.pos + length;
1343
- const message = createBaseHistogramQueryRequest();
1446
+ const message = createBaseGaugeQuerySpec();
1344
1447
  while (reader.pos < end) {
1345
1448
  const tag = reader.uint32();
1346
1449
  switch (tag >>> 3) {
1347
1450
  case 1: {
1348
- if (tag !== 10) {
1349
- break;
1350
- }
1351
-
1352
- message.organizationId = reader.string();
1353
- continue;
1354
- }
1355
- case 2: {
1356
- if (tag !== 18) {
1357
- break;
1358
- }
1359
-
1360
- message.projectId = reader.string();
1361
- continue;
1362
- }
1363
- case 3: {
1364
- if (tag !== 26) {
1365
- break;
1366
- }
1367
-
1368
- message.metricName = reader.string();
1369
- continue;
1370
- }
1371
- case 4: {
1372
- if (tag !== 32) {
1451
+ if (tag !== 8) {
1373
1452
  break;
1374
1453
  }
1375
1454
 
1376
1455
  message.aggregation = reader.int32() as any;
1377
1456
  continue;
1378
1457
  }
1379
- case 5: {
1380
- if (tag !== 41) {
1381
- break;
1382
- }
1383
-
1384
- message.quantile = reader.double();
1385
- continue;
1386
- }
1387
- case 6: {
1388
- if (tag !== 48) {
1389
- break;
1390
- }
1391
-
1392
- message.timeWindow = reader.int32() as any;
1393
- continue;
1394
- }
1395
- case 7: {
1396
- if (tag !== 56) {
1397
- break;
1398
- }
1399
-
1400
- message.timeInterval = reader.int32() as any;
1401
- continue;
1402
- }
1403
1458
  }
1404
1459
  if ((tag & 7) === 4 || tag === 0) {
1405
1460
  break;
@@ -1409,99 +1464,427 @@ export const HistogramQueryRequest: MessageFns<HistogramQueryRequest> = {
1409
1464
  return message;
1410
1465
  },
1411
1466
 
1412
- fromJSON(object: any): HistogramQueryRequest {
1413
- return {
1414
- organizationId: isSet(object.organizationId)
1415
- ? globalThis.String(object.organizationId)
1416
- : isSet(object.organization_id)
1417
- ? globalThis.String(object.organization_id)
1418
- : "",
1419
- projectId: isSet(object.projectId)
1420
- ? globalThis.String(object.projectId)
1421
- : isSet(object.project_id)
1422
- ? globalThis.String(object.project_id)
1423
- : "",
1424
- metricName: isSet(object.metricName)
1425
- ? globalThis.String(object.metricName)
1426
- : isSet(object.metric_name)
1427
- ? globalThis.String(object.metric_name)
1428
- : "",
1429
- aggregation: isSet(object.aggregation) ? histogramAggregationFromJSON(object.aggregation) : 0,
1430
- quantile: isSet(object.quantile) ? globalThis.Number(object.quantile) : 0,
1431
- timeWindow: isSet(object.timeWindow)
1432
- ? analyticsTimeWindowFromJSON(object.timeWindow)
1433
- : isSet(object.time_window)
1434
- ? analyticsTimeWindowFromJSON(object.time_window)
1435
- : 0,
1436
- timeInterval: isSet(object.timeInterval)
1437
- ? analyticsTimeIntervalFromJSON(object.timeInterval)
1438
- : isSet(object.time_interval)
1439
- ? analyticsTimeIntervalFromJSON(object.time_interval)
1440
- : 0,
1441
- };
1467
+ fromJSON(object: any): GaugeQuerySpec {
1468
+ return { aggregation: isSet(object.aggregation) ? gaugeAggregationFromJSON(object.aggregation) : 0 };
1442
1469
  },
1443
1470
 
1444
- toJSON(message: HistogramQueryRequest): unknown {
1471
+ toJSON(message: GaugeQuerySpec): unknown {
1445
1472
  const obj: any = {};
1446
- if (message.organizationId !== "") {
1447
- obj.organizationId = message.organizationId;
1448
- }
1449
- if (message.projectId !== "") {
1450
- obj.projectId = message.projectId;
1451
- }
1452
- if (message.metricName !== "") {
1453
- obj.metricName = message.metricName;
1454
- }
1455
1473
  if (message.aggregation !== 0) {
1456
- obj.aggregation = histogramAggregationToJSON(message.aggregation);
1457
- }
1458
- if (message.quantile !== 0) {
1459
- obj.quantile = message.quantile;
1460
- }
1461
- if (message.timeWindow !== 0) {
1462
- obj.timeWindow = analyticsTimeWindowToJSON(message.timeWindow);
1463
- }
1464
- if (message.timeInterval !== 0) {
1465
- obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
1474
+ obj.aggregation = gaugeAggregationToJSON(message.aggregation);
1466
1475
  }
1467
1476
  return obj;
1468
1477
  },
1469
1478
 
1470
- create<I extends Exact<DeepPartial<HistogramQueryRequest>, I>>(base?: I): HistogramQueryRequest {
1471
- return HistogramQueryRequest.fromPartial(base ?? ({} as any));
1479
+ create<I extends Exact<DeepPartial<GaugeQuerySpec>, I>>(base?: I): GaugeQuerySpec {
1480
+ return GaugeQuerySpec.fromPartial(base ?? ({} as any));
1472
1481
  },
1473
- fromPartial<I extends Exact<DeepPartial<HistogramQueryRequest>, I>>(object: I): HistogramQueryRequest {
1474
- const message = createBaseHistogramQueryRequest();
1475
- message.organizationId = object.organizationId ?? "";
1476
- message.projectId = object.projectId ?? "";
1477
- message.metricName = object.metricName ?? "";
1482
+ fromPartial<I extends Exact<DeepPartial<GaugeQuerySpec>, I>>(object: I): GaugeQuerySpec {
1483
+ const message = createBaseGaugeQuerySpec();
1484
+ message.aggregation = object.aggregation ?? 0;
1485
+ return message;
1486
+ },
1487
+ };
1488
+
1489
+ function createBaseSumQuerySpec(): SumQuerySpec {
1490
+ return { aggregation: 0 };
1491
+ }
1492
+
1493
+ export const SumQuerySpec: MessageFns<SumQuerySpec> = {
1494
+ encode(message: SumQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1495
+ if (message.aggregation !== 0) {
1496
+ writer.uint32(8).int32(message.aggregation);
1497
+ }
1498
+ return writer;
1499
+ },
1500
+
1501
+ decode(input: BinaryReader | Uint8Array, length?: number): SumQuerySpec {
1502
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1503
+ const end = length === undefined ? reader.len : reader.pos + length;
1504
+ const message = createBaseSumQuerySpec();
1505
+ while (reader.pos < end) {
1506
+ const tag = reader.uint32();
1507
+ switch (tag >>> 3) {
1508
+ case 1: {
1509
+ if (tag !== 8) {
1510
+ break;
1511
+ }
1512
+
1513
+ message.aggregation = reader.int32() as any;
1514
+ continue;
1515
+ }
1516
+ }
1517
+ if ((tag & 7) === 4 || tag === 0) {
1518
+ break;
1519
+ }
1520
+ reader.skip(tag & 7);
1521
+ }
1522
+ return message;
1523
+ },
1524
+
1525
+ fromJSON(object: any): SumQuerySpec {
1526
+ return { aggregation: isSet(object.aggregation) ? sumAggregationFromJSON(object.aggregation) : 0 };
1527
+ },
1528
+
1529
+ toJSON(message: SumQuerySpec): unknown {
1530
+ const obj: any = {};
1531
+ if (message.aggregation !== 0) {
1532
+ obj.aggregation = sumAggregationToJSON(message.aggregation);
1533
+ }
1534
+ return obj;
1535
+ },
1536
+
1537
+ create<I extends Exact<DeepPartial<SumQuerySpec>, I>>(base?: I): SumQuerySpec {
1538
+ return SumQuerySpec.fromPartial(base ?? ({} as any));
1539
+ },
1540
+ fromPartial<I extends Exact<DeepPartial<SumQuerySpec>, I>>(object: I): SumQuerySpec {
1541
+ const message = createBaseSumQuerySpec();
1542
+ message.aggregation = object.aggregation ?? 0;
1543
+ return message;
1544
+ },
1545
+ };
1546
+
1547
+ function createBaseHistogramQuerySpec(): HistogramQuerySpec {
1548
+ return { aggregation: 0, quantile: 0 };
1549
+ }
1550
+
1551
+ export const HistogramQuerySpec: MessageFns<HistogramQuerySpec> = {
1552
+ encode(message: HistogramQuerySpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1553
+ if (message.aggregation !== 0) {
1554
+ writer.uint32(8).int32(message.aggregation);
1555
+ }
1556
+ if (message.quantile !== 0) {
1557
+ writer.uint32(17).double(message.quantile);
1558
+ }
1559
+ return writer;
1560
+ },
1561
+
1562
+ decode(input: BinaryReader | Uint8Array, length?: number): HistogramQuerySpec {
1563
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1564
+ const end = length === undefined ? reader.len : reader.pos + length;
1565
+ const message = createBaseHistogramQuerySpec();
1566
+ while (reader.pos < end) {
1567
+ const tag = reader.uint32();
1568
+ switch (tag >>> 3) {
1569
+ case 1: {
1570
+ if (tag !== 8) {
1571
+ break;
1572
+ }
1573
+
1574
+ message.aggregation = reader.int32() as any;
1575
+ continue;
1576
+ }
1577
+ case 2: {
1578
+ if (tag !== 17) {
1579
+ break;
1580
+ }
1581
+
1582
+ message.quantile = reader.double();
1583
+ continue;
1584
+ }
1585
+ }
1586
+ if ((tag & 7) === 4 || tag === 0) {
1587
+ break;
1588
+ }
1589
+ reader.skip(tag & 7);
1590
+ }
1591
+ return message;
1592
+ },
1593
+
1594
+ fromJSON(object: any): HistogramQuerySpec {
1595
+ return {
1596
+ aggregation: isSet(object.aggregation) ? histogramAggregationFromJSON(object.aggregation) : 0,
1597
+ quantile: isSet(object.quantile) ? globalThis.Number(object.quantile) : 0,
1598
+ };
1599
+ },
1600
+
1601
+ toJSON(message: HistogramQuerySpec): unknown {
1602
+ const obj: any = {};
1603
+ if (message.aggregation !== 0) {
1604
+ obj.aggregation = histogramAggregationToJSON(message.aggregation);
1605
+ }
1606
+ if (message.quantile !== 0) {
1607
+ obj.quantile = message.quantile;
1608
+ }
1609
+ return obj;
1610
+ },
1611
+
1612
+ create<I extends Exact<DeepPartial<HistogramQuerySpec>, I>>(base?: I): HistogramQuerySpec {
1613
+ return HistogramQuerySpec.fromPartial(base ?? ({} as any));
1614
+ },
1615
+ fromPartial<I extends Exact<DeepPartial<HistogramQuerySpec>, I>>(object: I): HistogramQuerySpec {
1616
+ const message = createBaseHistogramQuerySpec();
1478
1617
  message.aggregation = object.aggregation ?? 0;
1479
1618
  message.quantile = object.quantile ?? 0;
1480
- message.timeWindow = object.timeWindow ?? 0;
1481
- message.timeInterval = object.timeInterval ?? 0;
1482
1619
  return message;
1483
1620
  },
1484
1621
  };
1485
1622
 
1486
- function createBaseMetricAnalyticsEnvelope(): MetricAnalyticsEnvelope {
1487
- return { snapshot: undefined, bucketUpdate: undefined };
1623
+ function createBaseAttributeFilter(): AttributeFilter {
1624
+ return { key: "", op: 0, values: [] };
1625
+ }
1626
+
1627
+ export const AttributeFilter: MessageFns<AttributeFilter> = {
1628
+ encode(message: AttributeFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1629
+ if (message.key !== "") {
1630
+ writer.uint32(10).string(message.key);
1631
+ }
1632
+ if (message.op !== 0) {
1633
+ writer.uint32(16).int32(message.op);
1634
+ }
1635
+ for (const v of message.values) {
1636
+ writer.uint32(26).string(v!);
1637
+ }
1638
+ return writer;
1639
+ },
1640
+
1641
+ decode(input: BinaryReader | Uint8Array, length?: number): AttributeFilter {
1642
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1643
+ const end = length === undefined ? reader.len : reader.pos + length;
1644
+ const message = createBaseAttributeFilter();
1645
+ while (reader.pos < end) {
1646
+ const tag = reader.uint32();
1647
+ switch (tag >>> 3) {
1648
+ case 1: {
1649
+ if (tag !== 10) {
1650
+ break;
1651
+ }
1652
+
1653
+ message.key = reader.string();
1654
+ continue;
1655
+ }
1656
+ case 2: {
1657
+ if (tag !== 16) {
1658
+ break;
1659
+ }
1660
+
1661
+ message.op = reader.int32() as any;
1662
+ continue;
1663
+ }
1664
+ case 3: {
1665
+ if (tag !== 26) {
1666
+ break;
1667
+ }
1668
+
1669
+ message.values.push(reader.string());
1670
+ continue;
1671
+ }
1672
+ }
1673
+ if ((tag & 7) === 4 || tag === 0) {
1674
+ break;
1675
+ }
1676
+ reader.skip(tag & 7);
1677
+ }
1678
+ return message;
1679
+ },
1680
+
1681
+ fromJSON(object: any): AttributeFilter {
1682
+ return {
1683
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1684
+ op: isSet(object.op) ? attributeFilterOpFromJSON(object.op) : 0,
1685
+ values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [],
1686
+ };
1687
+ },
1688
+
1689
+ toJSON(message: AttributeFilter): unknown {
1690
+ const obj: any = {};
1691
+ if (message.key !== "") {
1692
+ obj.key = message.key;
1693
+ }
1694
+ if (message.op !== 0) {
1695
+ obj.op = attributeFilterOpToJSON(message.op);
1696
+ }
1697
+ if (message.values?.length) {
1698
+ obj.values = message.values;
1699
+ }
1700
+ return obj;
1701
+ },
1702
+
1703
+ create<I extends Exact<DeepPartial<AttributeFilter>, I>>(base?: I): AttributeFilter {
1704
+ return AttributeFilter.fromPartial(base ?? ({} as any));
1705
+ },
1706
+ fromPartial<I extends Exact<DeepPartial<AttributeFilter>, I>>(object: I): AttributeFilter {
1707
+ const message = createBaseAttributeFilter();
1708
+ message.key = object.key ?? "";
1709
+ message.op = object.op ?? 0;
1710
+ message.values = object.values?.map((e) => e) || [];
1711
+ return message;
1712
+ },
1713
+ };
1714
+
1715
+ function createBaseTimeRange(): TimeRange {
1716
+ return { window: undefined, absolute: undefined };
1717
+ }
1718
+
1719
+ export const TimeRange: MessageFns<TimeRange> = {
1720
+ encode(message: TimeRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1721
+ if (message.window !== undefined) {
1722
+ writer.uint32(8).int32(message.window);
1723
+ }
1724
+ if (message.absolute !== undefined) {
1725
+ AbsoluteTimeRange.encode(message.absolute, writer.uint32(18).fork()).join();
1726
+ }
1727
+ return writer;
1728
+ },
1729
+
1730
+ decode(input: BinaryReader | Uint8Array, length?: number): TimeRange {
1731
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1732
+ const end = length === undefined ? reader.len : reader.pos + length;
1733
+ const message = createBaseTimeRange();
1734
+ while (reader.pos < end) {
1735
+ const tag = reader.uint32();
1736
+ switch (tag >>> 3) {
1737
+ case 1: {
1738
+ if (tag !== 8) {
1739
+ break;
1740
+ }
1741
+
1742
+ message.window = reader.int32() as any;
1743
+ continue;
1744
+ }
1745
+ case 2: {
1746
+ if (tag !== 18) {
1747
+ break;
1748
+ }
1749
+
1750
+ message.absolute = AbsoluteTimeRange.decode(reader, reader.uint32());
1751
+ continue;
1752
+ }
1753
+ }
1754
+ if ((tag & 7) === 4 || tag === 0) {
1755
+ break;
1756
+ }
1757
+ reader.skip(tag & 7);
1758
+ }
1759
+ return message;
1760
+ },
1761
+
1762
+ fromJSON(object: any): TimeRange {
1763
+ return {
1764
+ window: isSet(object.window) ? analyticsTimeWindowFromJSON(object.window) : undefined,
1765
+ absolute: isSet(object.absolute) ? AbsoluteTimeRange.fromJSON(object.absolute) : undefined,
1766
+ };
1767
+ },
1768
+
1769
+ toJSON(message: TimeRange): unknown {
1770
+ const obj: any = {};
1771
+ if (message.window !== undefined) {
1772
+ obj.window = analyticsTimeWindowToJSON(message.window);
1773
+ }
1774
+ if (message.absolute !== undefined) {
1775
+ obj.absolute = AbsoluteTimeRange.toJSON(message.absolute);
1776
+ }
1777
+ return obj;
1778
+ },
1779
+
1780
+ create<I extends Exact<DeepPartial<TimeRange>, I>>(base?: I): TimeRange {
1781
+ return TimeRange.fromPartial(base ?? ({} as any));
1782
+ },
1783
+ fromPartial<I extends Exact<DeepPartial<TimeRange>, I>>(object: I): TimeRange {
1784
+ const message = createBaseTimeRange();
1785
+ message.window = object.window ?? undefined;
1786
+ message.absolute = (object.absolute !== undefined && object.absolute !== null)
1787
+ ? AbsoluteTimeRange.fromPartial(object.absolute)
1788
+ : undefined;
1789
+ return message;
1790
+ },
1791
+ };
1792
+
1793
+ function createBaseAbsoluteTimeRange(): AbsoluteTimeRange {
1794
+ return { start: undefined, end: undefined };
1488
1795
  }
1489
1796
 
1490
- export const MetricAnalyticsEnvelope: MessageFns<MetricAnalyticsEnvelope> = {
1491
- encode(message: MetricAnalyticsEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1797
+ export const AbsoluteTimeRange: MessageFns<AbsoluteTimeRange> = {
1798
+ encode(message: AbsoluteTimeRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1799
+ if (message.start !== undefined) {
1800
+ Timestamp.encode(toTimestamp(message.start), writer.uint32(10).fork()).join();
1801
+ }
1802
+ if (message.end !== undefined) {
1803
+ Timestamp.encode(toTimestamp(message.end), writer.uint32(18).fork()).join();
1804
+ }
1805
+ return writer;
1806
+ },
1807
+
1808
+ decode(input: BinaryReader | Uint8Array, length?: number): AbsoluteTimeRange {
1809
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1810
+ const end = length === undefined ? reader.len : reader.pos + length;
1811
+ const message = createBaseAbsoluteTimeRange();
1812
+ while (reader.pos < end) {
1813
+ const tag = reader.uint32();
1814
+ switch (tag >>> 3) {
1815
+ case 1: {
1816
+ if (tag !== 10) {
1817
+ break;
1818
+ }
1819
+
1820
+ message.start = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1821
+ continue;
1822
+ }
1823
+ case 2: {
1824
+ if (tag !== 18) {
1825
+ break;
1826
+ }
1827
+
1828
+ message.end = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1829
+ continue;
1830
+ }
1831
+ }
1832
+ if ((tag & 7) === 4 || tag === 0) {
1833
+ break;
1834
+ }
1835
+ reader.skip(tag & 7);
1836
+ }
1837
+ return message;
1838
+ },
1839
+
1840
+ fromJSON(object: any): AbsoluteTimeRange {
1841
+ return {
1842
+ start: isSet(object.start) ? fromJsonTimestamp(object.start) : undefined,
1843
+ end: isSet(object.end) ? fromJsonTimestamp(object.end) : undefined,
1844
+ };
1845
+ },
1846
+
1847
+ toJSON(message: AbsoluteTimeRange): unknown {
1848
+ const obj: any = {};
1849
+ if (message.start !== undefined) {
1850
+ obj.start = message.start.toISOString();
1851
+ }
1852
+ if (message.end !== undefined) {
1853
+ obj.end = message.end.toISOString();
1854
+ }
1855
+ return obj;
1856
+ },
1857
+
1858
+ create<I extends Exact<DeepPartial<AbsoluteTimeRange>, I>>(base?: I): AbsoluteTimeRange {
1859
+ return AbsoluteTimeRange.fromPartial(base ?? ({} as any));
1860
+ },
1861
+ fromPartial<I extends Exact<DeepPartial<AbsoluteTimeRange>, I>>(object: I): AbsoluteTimeRange {
1862
+ const message = createBaseAbsoluteTimeRange();
1863
+ message.start = object.start ?? undefined;
1864
+ message.end = object.end ?? undefined;
1865
+ return message;
1866
+ },
1867
+ };
1868
+
1869
+ function createBaseQueryDataEnvelope(): QueryDataEnvelope {
1870
+ return { snapshot: undefined, update: undefined };
1871
+ }
1872
+
1873
+ export const QueryDataEnvelope: MessageFns<QueryDataEnvelope> = {
1874
+ encode(message: QueryDataEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1492
1875
  if (message.snapshot !== undefined) {
1493
- MetricAnalyticsSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
1876
+ QuerySnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
1494
1877
  }
1495
- if (message.bucketUpdate !== undefined) {
1496
- MetricSeriesBucketUpdate.encode(message.bucketUpdate, writer.uint32(18).fork()).join();
1878
+ if (message.update !== undefined) {
1879
+ QuerySeriesUpdate.encode(message.update, writer.uint32(18).fork()).join();
1497
1880
  }
1498
1881
  return writer;
1499
1882
  },
1500
1883
 
1501
- decode(input: BinaryReader | Uint8Array, length?: number): MetricAnalyticsEnvelope {
1884
+ decode(input: BinaryReader | Uint8Array, length?: number): QueryDataEnvelope {
1502
1885
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1503
1886
  const end = length === undefined ? reader.len : reader.pos + length;
1504
- const message = createBaseMetricAnalyticsEnvelope();
1887
+ const message = createBaseQueryDataEnvelope();
1505
1888
  while (reader.pos < end) {
1506
1889
  const tag = reader.uint32();
1507
1890
  switch (tag >>> 3) {
@@ -1510,7 +1893,7 @@ export const MetricAnalyticsEnvelope: MessageFns<MetricAnalyticsEnvelope> = {
1510
1893
  break;
1511
1894
  }
1512
1895
 
1513
- message.snapshot = MetricAnalyticsSnapshot.decode(reader, reader.uint32());
1896
+ message.snapshot = QuerySnapshot.decode(reader, reader.uint32());
1514
1897
  continue;
1515
1898
  }
1516
1899
  case 2: {
@@ -1518,7 +1901,7 @@ export const MetricAnalyticsEnvelope: MessageFns<MetricAnalyticsEnvelope> = {
1518
1901
  break;
1519
1902
  }
1520
1903
 
1521
- message.bucketUpdate = MetricSeriesBucketUpdate.decode(reader, reader.uint32());
1904
+ message.update = QuerySeriesUpdate.decode(reader, reader.uint32());
1522
1905
  continue;
1523
1906
  }
1524
1907
  }
@@ -1530,64 +1913,53 @@ export const MetricAnalyticsEnvelope: MessageFns<MetricAnalyticsEnvelope> = {
1530
1913
  return message;
1531
1914
  },
1532
1915
 
1533
- fromJSON(object: any): MetricAnalyticsEnvelope {
1916
+ fromJSON(object: any): QueryDataEnvelope {
1534
1917
  return {
1535
- snapshot: isSet(object.snapshot) ? MetricAnalyticsSnapshot.fromJSON(object.snapshot) : undefined,
1536
- bucketUpdate: isSet(object.bucketUpdate)
1537
- ? MetricSeriesBucketUpdate.fromJSON(object.bucketUpdate)
1538
- : isSet(object.bucket_update)
1539
- ? MetricSeriesBucketUpdate.fromJSON(object.bucket_update)
1540
- : undefined,
1918
+ snapshot: isSet(object.snapshot) ? QuerySnapshot.fromJSON(object.snapshot) : undefined,
1919
+ update: isSet(object.update) ? QuerySeriesUpdate.fromJSON(object.update) : undefined,
1541
1920
  };
1542
1921
  },
1543
1922
 
1544
- toJSON(message: MetricAnalyticsEnvelope): unknown {
1923
+ toJSON(message: QueryDataEnvelope): unknown {
1545
1924
  const obj: any = {};
1546
1925
  if (message.snapshot !== undefined) {
1547
- obj.snapshot = MetricAnalyticsSnapshot.toJSON(message.snapshot);
1926
+ obj.snapshot = QuerySnapshot.toJSON(message.snapshot);
1548
1927
  }
1549
- if (message.bucketUpdate !== undefined) {
1550
- obj.bucketUpdate = MetricSeriesBucketUpdate.toJSON(message.bucketUpdate);
1928
+ if (message.update !== undefined) {
1929
+ obj.update = QuerySeriesUpdate.toJSON(message.update);
1551
1930
  }
1552
1931
  return obj;
1553
1932
  },
1554
1933
 
1555
- create<I extends Exact<DeepPartial<MetricAnalyticsEnvelope>, I>>(base?: I): MetricAnalyticsEnvelope {
1556
- return MetricAnalyticsEnvelope.fromPartial(base ?? ({} as any));
1934
+ create<I extends Exact<DeepPartial<QueryDataEnvelope>, I>>(base?: I): QueryDataEnvelope {
1935
+ return QueryDataEnvelope.fromPartial(base ?? ({} as any));
1557
1936
  },
1558
- fromPartial<I extends Exact<DeepPartial<MetricAnalyticsEnvelope>, I>>(object: I): MetricAnalyticsEnvelope {
1559
- const message = createBaseMetricAnalyticsEnvelope();
1937
+ fromPartial<I extends Exact<DeepPartial<QueryDataEnvelope>, I>>(object: I): QueryDataEnvelope {
1938
+ const message = createBaseQueryDataEnvelope();
1560
1939
  message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
1561
- ? MetricAnalyticsSnapshot.fromPartial(object.snapshot)
1940
+ ? QuerySnapshot.fromPartial(object.snapshot)
1562
1941
  : undefined;
1563
- message.bucketUpdate = (object.bucketUpdate !== undefined && object.bucketUpdate !== null)
1564
- ? MetricSeriesBucketUpdate.fromPartial(object.bucketUpdate)
1942
+ message.update = (object.update !== undefined && object.update !== null)
1943
+ ? QuerySeriesUpdate.fromPartial(object.update)
1565
1944
  : undefined;
1566
1945
  return message;
1567
1946
  },
1568
1947
  };
1569
1948
 
1570
- function createBaseMetricAnalyticsSnapshot(): MetricAnalyticsSnapshot {
1571
- return {
1572
- series: [],
1573
- windowStart: undefined,
1574
- windowEnd: undefined,
1575
- bucketSizeMs: 0,
1576
- expectedBucketCount: 0,
1577
- unit: "",
1578
- };
1949
+ function createBaseQuerySnapshot(): QuerySnapshot {
1950
+ return { series: [], rangeStart: undefined, rangeEnd: undefined, bucketSizeMs: 0, expectedBucketCount: 0, unit: "" };
1579
1951
  }
1580
1952
 
1581
- export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1582
- encode(message: MetricAnalyticsSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1953
+ export const QuerySnapshot: MessageFns<QuerySnapshot> = {
1954
+ encode(message: QuerySnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1583
1955
  for (const v of message.series) {
1584
1956
  MetricSeries.encode(v!, writer.uint32(10).fork()).join();
1585
1957
  }
1586
- if (message.windowStart !== undefined) {
1587
- Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(18).fork()).join();
1958
+ if (message.rangeStart !== undefined) {
1959
+ Timestamp.encode(toTimestamp(message.rangeStart), writer.uint32(18).fork()).join();
1588
1960
  }
1589
- if (message.windowEnd !== undefined) {
1590
- Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(26).fork()).join();
1961
+ if (message.rangeEnd !== undefined) {
1962
+ Timestamp.encode(toTimestamp(message.rangeEnd), writer.uint32(26).fork()).join();
1591
1963
  }
1592
1964
  if (message.bucketSizeMs !== 0) {
1593
1965
  writer.uint32(32).int64(message.bucketSizeMs);
@@ -1601,10 +1973,10 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1601
1973
  return writer;
1602
1974
  },
1603
1975
 
1604
- decode(input: BinaryReader | Uint8Array, length?: number): MetricAnalyticsSnapshot {
1976
+ decode(input: BinaryReader | Uint8Array, length?: number): QuerySnapshot {
1605
1977
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1606
1978
  const end = length === undefined ? reader.len : reader.pos + length;
1607
- const message = createBaseMetricAnalyticsSnapshot();
1979
+ const message = createBaseQuerySnapshot();
1608
1980
  while (reader.pos < end) {
1609
1981
  const tag = reader.uint32();
1610
1982
  switch (tag >>> 3) {
@@ -1621,7 +1993,7 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1621
1993
  break;
1622
1994
  }
1623
1995
 
1624
- message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1996
+ message.rangeStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1625
1997
  continue;
1626
1998
  }
1627
1999
  case 3: {
@@ -1629,7 +2001,7 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1629
2001
  break;
1630
2002
  }
1631
2003
 
1632
- message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2004
+ message.rangeEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1633
2005
  continue;
1634
2006
  }
1635
2007
  case 4: {
@@ -1665,18 +2037,18 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1665
2037
  return message;
1666
2038
  },
1667
2039
 
1668
- fromJSON(object: any): MetricAnalyticsSnapshot {
2040
+ fromJSON(object: any): QuerySnapshot {
1669
2041
  return {
1670
2042
  series: globalThis.Array.isArray(object?.series) ? object.series.map((e: any) => MetricSeries.fromJSON(e)) : [],
1671
- windowStart: isSet(object.windowStart)
1672
- ? fromJsonTimestamp(object.windowStart)
1673
- : isSet(object.window_start)
1674
- ? fromJsonTimestamp(object.window_start)
2043
+ rangeStart: isSet(object.rangeStart)
2044
+ ? fromJsonTimestamp(object.rangeStart)
2045
+ : isSet(object.range_start)
2046
+ ? fromJsonTimestamp(object.range_start)
1675
2047
  : undefined,
1676
- windowEnd: isSet(object.windowEnd)
1677
- ? fromJsonTimestamp(object.windowEnd)
1678
- : isSet(object.window_end)
1679
- ? fromJsonTimestamp(object.window_end)
2048
+ rangeEnd: isSet(object.rangeEnd)
2049
+ ? fromJsonTimestamp(object.rangeEnd)
2050
+ : isSet(object.range_end)
2051
+ ? fromJsonTimestamp(object.range_end)
1680
2052
  : undefined,
1681
2053
  bucketSizeMs: isSet(object.bucketSizeMs)
1682
2054
  ? globalThis.Number(object.bucketSizeMs)
@@ -1692,16 +2064,16 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1692
2064
  };
1693
2065
  },
1694
2066
 
1695
- toJSON(message: MetricAnalyticsSnapshot): unknown {
2067
+ toJSON(message: QuerySnapshot): unknown {
1696
2068
  const obj: any = {};
1697
2069
  if (message.series?.length) {
1698
2070
  obj.series = message.series.map((e) => MetricSeries.toJSON(e));
1699
2071
  }
1700
- if (message.windowStart !== undefined) {
1701
- obj.windowStart = message.windowStart.toISOString();
2072
+ if (message.rangeStart !== undefined) {
2073
+ obj.rangeStart = message.rangeStart.toISOString();
1702
2074
  }
1703
- if (message.windowEnd !== undefined) {
1704
- obj.windowEnd = message.windowEnd.toISOString();
2075
+ if (message.rangeEnd !== undefined) {
2076
+ obj.rangeEnd = message.rangeEnd.toISOString();
1705
2077
  }
1706
2078
  if (message.bucketSizeMs !== 0) {
1707
2079
  obj.bucketSizeMs = Math.round(message.bucketSizeMs);
@@ -1715,14 +2087,14 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1715
2087
  return obj;
1716
2088
  },
1717
2089
 
1718
- create<I extends Exact<DeepPartial<MetricAnalyticsSnapshot>, I>>(base?: I): MetricAnalyticsSnapshot {
1719
- return MetricAnalyticsSnapshot.fromPartial(base ?? ({} as any));
2090
+ create<I extends Exact<DeepPartial<QuerySnapshot>, I>>(base?: I): QuerySnapshot {
2091
+ return QuerySnapshot.fromPartial(base ?? ({} as any));
1720
2092
  },
1721
- fromPartial<I extends Exact<DeepPartial<MetricAnalyticsSnapshot>, I>>(object: I): MetricAnalyticsSnapshot {
1722
- const message = createBaseMetricAnalyticsSnapshot();
2093
+ fromPartial<I extends Exact<DeepPartial<QuerySnapshot>, I>>(object: I): QuerySnapshot {
2094
+ const message = createBaseQuerySnapshot();
1723
2095
  message.series = object.series?.map((e) => MetricSeries.fromPartial(e)) || [];
1724
- message.windowStart = object.windowStart ?? undefined;
1725
- message.windowEnd = object.windowEnd ?? undefined;
2096
+ message.rangeStart = object.rangeStart ?? undefined;
2097
+ message.rangeEnd = object.rangeEnd ?? undefined;
1726
2098
  message.bucketSizeMs = object.bucketSizeMs ?? 0;
1727
2099
  message.expectedBucketCount = object.expectedBucketCount ?? 0;
1728
2100
  message.unit = object.unit ?? "";
@@ -1731,13 +2103,16 @@ export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
1731
2103
  };
1732
2104
 
1733
2105
  function createBaseMetricSeries(): MetricSeries {
1734
- return { buckets: [] };
2106
+ return { groupValues: {}, buckets: [] };
1735
2107
  }
1736
2108
 
1737
2109
  export const MetricSeries: MessageFns<MetricSeries> = {
1738
2110
  encode(message: MetricSeries, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2111
+ globalThis.Object.entries(message.groupValues).forEach(([key, value]: [string, string]) => {
2112
+ MetricSeries_GroupValuesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
2113
+ });
1739
2114
  for (const v of message.buckets) {
1740
- MetricBucket.encode(v!, writer.uint32(10).fork()).join();
2115
+ MetricBucket.encode(v!, writer.uint32(18).fork()).join();
1741
2116
  }
1742
2117
  return writer;
1743
2118
  },
@@ -1754,6 +2129,17 @@ export const MetricSeries: MessageFns<MetricSeries> = {
1754
2129
  break;
1755
2130
  }
1756
2131
 
2132
+ const entry1 = MetricSeries_GroupValuesEntry.decode(reader, reader.uint32());
2133
+ if (entry1.value !== undefined) {
2134
+ message.groupValues[entry1.key] = entry1.value;
2135
+ }
2136
+ continue;
2137
+ }
2138
+ case 2: {
2139
+ if (tag !== 18) {
2140
+ break;
2141
+ }
2142
+
1757
2143
  message.buckets.push(MetricBucket.decode(reader, reader.uint32()));
1758
2144
  continue;
1759
2145
  }
@@ -1768,6 +2154,23 @@ export const MetricSeries: MessageFns<MetricSeries> = {
1768
2154
 
1769
2155
  fromJSON(object: any): MetricSeries {
1770
2156
  return {
2157
+ groupValues: isObject(object.groupValues)
2158
+ ? (globalThis.Object.entries(object.groupValues) as [string, any][]).reduce(
2159
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2160
+ acc[key] = globalThis.String(value);
2161
+ return acc;
2162
+ },
2163
+ {},
2164
+ )
2165
+ : isObject(object.group_values)
2166
+ ? (globalThis.Object.entries(object.group_values) as [string, any][]).reduce(
2167
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2168
+ acc[key] = globalThis.String(value);
2169
+ return acc;
2170
+ },
2171
+ {},
2172
+ )
2173
+ : {},
1771
2174
  buckets: globalThis.Array.isArray(object?.buckets)
1772
2175
  ? object.buckets.map((e: any) => MetricBucket.fromJSON(e))
1773
2176
  : [],
@@ -1776,6 +2179,15 @@ export const MetricSeries: MessageFns<MetricSeries> = {
1776
2179
 
1777
2180
  toJSON(message: MetricSeries): unknown {
1778
2181
  const obj: any = {};
2182
+ if (message.groupValues) {
2183
+ const entries = globalThis.Object.entries(message.groupValues) as [string, string][];
2184
+ if (entries.length > 0) {
2185
+ obj.groupValues = {};
2186
+ entries.forEach(([k, v]) => {
2187
+ obj.groupValues[k] = v;
2188
+ });
2189
+ }
2190
+ }
1779
2191
  if (message.buckets?.length) {
1780
2192
  obj.buckets = message.buckets.map((e) => MetricBucket.toJSON(e));
1781
2193
  }
@@ -1787,11 +2199,98 @@ export const MetricSeries: MessageFns<MetricSeries> = {
1787
2199
  },
1788
2200
  fromPartial<I extends Exact<DeepPartial<MetricSeries>, I>>(object: I): MetricSeries {
1789
2201
  const message = createBaseMetricSeries();
2202
+ message.groupValues = (globalThis.Object.entries(object.groupValues ?? {}) as [string, string][]).reduce(
2203
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
2204
+ if (value !== undefined) {
2205
+ acc[key] = globalThis.String(value);
2206
+ }
2207
+ return acc;
2208
+ },
2209
+ {},
2210
+ );
1790
2211
  message.buckets = object.buckets?.map((e) => MetricBucket.fromPartial(e)) || [];
1791
2212
  return message;
1792
2213
  },
1793
2214
  };
1794
2215
 
2216
+ function createBaseMetricSeries_GroupValuesEntry(): MetricSeries_GroupValuesEntry {
2217
+ return { key: "", value: "" };
2218
+ }
2219
+
2220
+ export const MetricSeries_GroupValuesEntry: MessageFns<MetricSeries_GroupValuesEntry> = {
2221
+ encode(message: MetricSeries_GroupValuesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2222
+ if (message.key !== "") {
2223
+ writer.uint32(10).string(message.key);
2224
+ }
2225
+ if (message.value !== "") {
2226
+ writer.uint32(18).string(message.value);
2227
+ }
2228
+ return writer;
2229
+ },
2230
+
2231
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricSeries_GroupValuesEntry {
2232
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2233
+ const end = length === undefined ? reader.len : reader.pos + length;
2234
+ const message = createBaseMetricSeries_GroupValuesEntry();
2235
+ while (reader.pos < end) {
2236
+ const tag = reader.uint32();
2237
+ switch (tag >>> 3) {
2238
+ case 1: {
2239
+ if (tag !== 10) {
2240
+ break;
2241
+ }
2242
+
2243
+ message.key = reader.string();
2244
+ continue;
2245
+ }
2246
+ case 2: {
2247
+ if (tag !== 18) {
2248
+ break;
2249
+ }
2250
+
2251
+ message.value = reader.string();
2252
+ continue;
2253
+ }
2254
+ }
2255
+ if ((tag & 7) === 4 || tag === 0) {
2256
+ break;
2257
+ }
2258
+ reader.skip(tag & 7);
2259
+ }
2260
+ return message;
2261
+ },
2262
+
2263
+ fromJSON(object: any): MetricSeries_GroupValuesEntry {
2264
+ return {
2265
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2266
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
2267
+ };
2268
+ },
2269
+
2270
+ toJSON(message: MetricSeries_GroupValuesEntry): unknown {
2271
+ const obj: any = {};
2272
+ if (message.key !== "") {
2273
+ obj.key = message.key;
2274
+ }
2275
+ if (message.value !== "") {
2276
+ obj.value = message.value;
2277
+ }
2278
+ return obj;
2279
+ },
2280
+
2281
+ create<I extends Exact<DeepPartial<MetricSeries_GroupValuesEntry>, I>>(base?: I): MetricSeries_GroupValuesEntry {
2282
+ return MetricSeries_GroupValuesEntry.fromPartial(base ?? ({} as any));
2283
+ },
2284
+ fromPartial<I extends Exact<DeepPartial<MetricSeries_GroupValuesEntry>, I>>(
2285
+ object: I,
2286
+ ): MetricSeries_GroupValuesEntry {
2287
+ const message = createBaseMetricSeries_GroupValuesEntry();
2288
+ message.key = object.key ?? "";
2289
+ message.value = object.value ?? "";
2290
+ return message;
2291
+ },
2292
+ };
2293
+
1795
2294
  function createBaseMetricBucket(): MetricBucket {
1796
2295
  return { bucketStart: undefined, value: 0 };
1797
2296
  }
@@ -1872,25 +2371,28 @@ export const MetricBucket: MessageFns<MetricBucket> = {
1872
2371
  },
1873
2372
  };
1874
2373
 
1875
- function createBaseMetricSeriesBucketUpdate(): MetricSeriesBucketUpdate {
1876
- return { bucket: undefined, generatedAt: undefined };
2374
+ function createBaseQuerySeriesUpdate(): QuerySeriesUpdate {
2375
+ return { groupValues: {}, bucket: undefined, generatedAt: undefined };
1877
2376
  }
1878
2377
 
1879
- export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1880
- encode(message: MetricSeriesBucketUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2378
+ export const QuerySeriesUpdate: MessageFns<QuerySeriesUpdate> = {
2379
+ encode(message: QuerySeriesUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2380
+ globalThis.Object.entries(message.groupValues).forEach(([key, value]: [string, string]) => {
2381
+ QuerySeriesUpdate_GroupValuesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
2382
+ });
1881
2383
  if (message.bucket !== undefined) {
1882
- MetricBucket.encode(message.bucket, writer.uint32(10).fork()).join();
2384
+ MetricBucket.encode(message.bucket, writer.uint32(18).fork()).join();
1883
2385
  }
1884
2386
  if (message.generatedAt !== undefined) {
1885
- Timestamp.encode(toTimestamp(message.generatedAt), writer.uint32(18).fork()).join();
2387
+ Timestamp.encode(toTimestamp(message.generatedAt), writer.uint32(26).fork()).join();
1886
2388
  }
1887
2389
  return writer;
1888
2390
  },
1889
2391
 
1890
- decode(input: BinaryReader | Uint8Array, length?: number): MetricSeriesBucketUpdate {
2392
+ decode(input: BinaryReader | Uint8Array, length?: number): QuerySeriesUpdate {
1891
2393
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1892
2394
  const end = length === undefined ? reader.len : reader.pos + length;
1893
- const message = createBaseMetricSeriesBucketUpdate();
2395
+ const message = createBaseQuerySeriesUpdate();
1894
2396
  while (reader.pos < end) {
1895
2397
  const tag = reader.uint32();
1896
2398
  switch (tag >>> 3) {
@@ -1899,7 +2401,10 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1899
2401
  break;
1900
2402
  }
1901
2403
 
1902
- message.bucket = MetricBucket.decode(reader, reader.uint32());
2404
+ const entry1 = QuerySeriesUpdate_GroupValuesEntry.decode(reader, reader.uint32());
2405
+ if (entry1.value !== undefined) {
2406
+ message.groupValues[entry1.key] = entry1.value;
2407
+ }
1903
2408
  continue;
1904
2409
  }
1905
2410
  case 2: {
@@ -1907,6 +2412,14 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1907
2412
  break;
1908
2413
  }
1909
2414
 
2415
+ message.bucket = MetricBucket.decode(reader, reader.uint32());
2416
+ continue;
2417
+ }
2418
+ case 3: {
2419
+ if (tag !== 26) {
2420
+ break;
2421
+ }
2422
+
1910
2423
  message.generatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1911
2424
  continue;
1912
2425
  }
@@ -1919,8 +2432,25 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1919
2432
  return message;
1920
2433
  },
1921
2434
 
1922
- fromJSON(object: any): MetricSeriesBucketUpdate {
2435
+ fromJSON(object: any): QuerySeriesUpdate {
1923
2436
  return {
2437
+ groupValues: isObject(object.groupValues)
2438
+ ? (globalThis.Object.entries(object.groupValues) as [string, any][]).reduce(
2439
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2440
+ acc[key] = globalThis.String(value);
2441
+ return acc;
2442
+ },
2443
+ {},
2444
+ )
2445
+ : isObject(object.group_values)
2446
+ ? (globalThis.Object.entries(object.group_values) as [string, any][]).reduce(
2447
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2448
+ acc[key] = globalThis.String(value);
2449
+ return acc;
2450
+ },
2451
+ {},
2452
+ )
2453
+ : {},
1924
2454
  bucket: isSet(object.bucket) ? MetricBucket.fromJSON(object.bucket) : undefined,
1925
2455
  generatedAt: isSet(object.generatedAt)
1926
2456
  ? fromJsonTimestamp(object.generatedAt)
@@ -1930,8 +2460,17 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1930
2460
  };
1931
2461
  },
1932
2462
 
1933
- toJSON(message: MetricSeriesBucketUpdate): unknown {
2463
+ toJSON(message: QuerySeriesUpdate): unknown {
1934
2464
  const obj: any = {};
2465
+ if (message.groupValues) {
2466
+ const entries = globalThis.Object.entries(message.groupValues) as [string, string][];
2467
+ if (entries.length > 0) {
2468
+ obj.groupValues = {};
2469
+ entries.forEach(([k, v]) => {
2470
+ obj.groupValues[k] = v;
2471
+ });
2472
+ }
2473
+ }
1935
2474
  if (message.bucket !== undefined) {
1936
2475
  obj.bucket = MetricBucket.toJSON(message.bucket);
1937
2476
  }
@@ -1941,11 +2480,20 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1941
2480
  return obj;
1942
2481
  },
1943
2482
 
1944
- create<I extends Exact<DeepPartial<MetricSeriesBucketUpdate>, I>>(base?: I): MetricSeriesBucketUpdate {
1945
- return MetricSeriesBucketUpdate.fromPartial(base ?? ({} as any));
2483
+ create<I extends Exact<DeepPartial<QuerySeriesUpdate>, I>>(base?: I): QuerySeriesUpdate {
2484
+ return QuerySeriesUpdate.fromPartial(base ?? ({} as any));
1946
2485
  },
1947
- fromPartial<I extends Exact<DeepPartial<MetricSeriesBucketUpdate>, I>>(object: I): MetricSeriesBucketUpdate {
1948
- const message = createBaseMetricSeriesBucketUpdate();
2486
+ fromPartial<I extends Exact<DeepPartial<QuerySeriesUpdate>, I>>(object: I): QuerySeriesUpdate {
2487
+ const message = createBaseQuerySeriesUpdate();
2488
+ message.groupValues = (globalThis.Object.entries(object.groupValues ?? {}) as [string, string][]).reduce(
2489
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
2490
+ if (value !== undefined) {
2491
+ acc[key] = globalThis.String(value);
2492
+ }
2493
+ return acc;
2494
+ },
2495
+ {},
2496
+ );
1949
2497
  message.bucket = (object.bucket !== undefined && object.bucket !== null)
1950
2498
  ? MetricBucket.fromPartial(object.bucket)
1951
2499
  : undefined;
@@ -1954,34 +2502,119 @@ export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
1954
2502
  },
1955
2503
  };
1956
2504
 
2505
+ function createBaseQuerySeriesUpdate_GroupValuesEntry(): QuerySeriesUpdate_GroupValuesEntry {
2506
+ return { key: "", value: "" };
2507
+ }
2508
+
2509
+ export const QuerySeriesUpdate_GroupValuesEntry: MessageFns<QuerySeriesUpdate_GroupValuesEntry> = {
2510
+ encode(message: QuerySeriesUpdate_GroupValuesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2511
+ if (message.key !== "") {
2512
+ writer.uint32(10).string(message.key);
2513
+ }
2514
+ if (message.value !== "") {
2515
+ writer.uint32(18).string(message.value);
2516
+ }
2517
+ return writer;
2518
+ },
2519
+
2520
+ decode(input: BinaryReader | Uint8Array, length?: number): QuerySeriesUpdate_GroupValuesEntry {
2521
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2522
+ const end = length === undefined ? reader.len : reader.pos + length;
2523
+ const message = createBaseQuerySeriesUpdate_GroupValuesEntry();
2524
+ while (reader.pos < end) {
2525
+ const tag = reader.uint32();
2526
+ switch (tag >>> 3) {
2527
+ case 1: {
2528
+ if (tag !== 10) {
2529
+ break;
2530
+ }
2531
+
2532
+ message.key = reader.string();
2533
+ continue;
2534
+ }
2535
+ case 2: {
2536
+ if (tag !== 18) {
2537
+ break;
2538
+ }
2539
+
2540
+ message.value = reader.string();
2541
+ continue;
2542
+ }
2543
+ }
2544
+ if ((tag & 7) === 4 || tag === 0) {
2545
+ break;
2546
+ }
2547
+ reader.skip(tag & 7);
2548
+ }
2549
+ return message;
2550
+ },
2551
+
2552
+ fromJSON(object: any): QuerySeriesUpdate_GroupValuesEntry {
2553
+ return {
2554
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2555
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
2556
+ };
2557
+ },
2558
+
2559
+ toJSON(message: QuerySeriesUpdate_GroupValuesEntry): unknown {
2560
+ const obj: any = {};
2561
+ if (message.key !== "") {
2562
+ obj.key = message.key;
2563
+ }
2564
+ if (message.value !== "") {
2565
+ obj.value = message.value;
2566
+ }
2567
+ return obj;
2568
+ },
2569
+
2570
+ create<I extends Exact<DeepPartial<QuerySeriesUpdate_GroupValuesEntry>, I>>(
2571
+ base?: I,
2572
+ ): QuerySeriesUpdate_GroupValuesEntry {
2573
+ return QuerySeriesUpdate_GroupValuesEntry.fromPartial(base ?? ({} as any));
2574
+ },
2575
+ fromPartial<I extends Exact<DeepPartial<QuerySeriesUpdate_GroupValuesEntry>, I>>(
2576
+ object: I,
2577
+ ): QuerySeriesUpdate_GroupValuesEntry {
2578
+ const message = createBaseQuerySeriesUpdate_GroupValuesEntry();
2579
+ message.key = object.key ?? "";
2580
+ message.value = object.value ?? "";
2581
+ return message;
2582
+ },
2583
+ };
2584
+
1957
2585
  /**
1958
- * TelemetryGatewayService is the web surface of telemetry.api.v1 — the types
2586
+ * MetricGatewayService is the web surface of telemetry.api.v1 MetricService — the types
1959
2587
  * are domain-isolated copies converted in gateways/internal/convert. Every RPC
1960
- * is a server stream (snapshot first, then live updates), split by metric kind.
2588
+ * is a server stream: snapshot first, then live updates.
2589
+ *
2590
+ * StreamQuery executes one MetricQuery — the same message a dashboard widget
2591
+ * stores (dashboard_gateway.proto) — so the metrics explorer, the widget
2592
+ * editor preview, and a saved dashboard all run through one query path.
1961
2593
  */
1962
- export interface TelemetryGatewayService {
2594
+ export interface MetricGatewayService {
1963
2595
  StreamMetrics(request: StreamMetricsRequest, metadata?: Metadata): Observable<MetricCatalogEnvelope>;
1964
2596
  StreamMetricAttributes(
1965
2597
  request: StreamMetricAttributesRequest,
1966
2598
  metadata?: Metadata,
1967
2599
  ): Observable<MetricAttributeEnvelope>;
1968
- StreamGaugeAnalytics(request: GaugeQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope>;
1969
- StreamSumAnalytics(request: SumQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope>;
1970
- StreamHistogramAnalytics(request: HistogramQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope>;
2600
+ /**
2601
+ * Ad-hoc query execution: snapshot, then live bucket updates while the
2602
+ * stream stays open (relative ranges only; absolute ranges complete after
2603
+ * the snapshot). Query failures abort the stream with a gRPC status.
2604
+ */
2605
+ StreamQuery(request: StreamQueryRequest, metadata?: Metadata): Observable<QueryDataEnvelope>;
1971
2606
  }
1972
2607
 
1973
- export const TelemetryGatewayServiceServiceName = "gateway.web.v1.TelemetryGatewayService";
1974
- export class TelemetryGatewayServiceClientImpl implements TelemetryGatewayService {
2608
+ export const MetricGatewayServiceServiceName = "gateway.web.v1.MetricGatewayService";
2609
+ export class MetricGatewayServiceClientImpl implements MetricGatewayService {
1975
2610
  private readonly rpc: Rpc;
1976
2611
  private readonly service: string;
1977
2612
  constructor(rpc: Rpc, opts?: { service?: string }) {
1978
- this.service = opts?.service || TelemetryGatewayServiceServiceName;
2613
+ this.service = opts?.service || MetricGatewayServiceServiceName;
1979
2614
  this.rpc = rpc;
1980
2615
  this.StreamMetrics = this.StreamMetrics.bind(this);
1981
2616
  this.StreamMetricAttributes = this.StreamMetricAttributes.bind(this);
1982
- this.StreamGaugeAnalytics = this.StreamGaugeAnalytics.bind(this);
1983
- this.StreamSumAnalytics = this.StreamSumAnalytics.bind(this);
1984
- this.StreamHistogramAnalytics = this.StreamHistogramAnalytics.bind(this);
2617
+ this.StreamQuery = this.StreamQuery.bind(this);
1985
2618
  }
1986
2619
  StreamMetrics(request: StreamMetricsRequest, metadata?: Metadata): Observable<MetricCatalogEnvelope> {
1987
2620
  const data = StreamMetricsRequest.encode(request).finish();
@@ -1998,22 +2631,10 @@ export class TelemetryGatewayServiceClientImpl implements TelemetryGatewayServic
1998
2631
  return result.pipe(map((data) => MetricAttributeEnvelope.decode(new BinaryReader(data))));
1999
2632
  }
2000
2633
 
2001
- StreamGaugeAnalytics(request: GaugeQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope> {
2002
- const data = GaugeQueryRequest.encode(request).finish();
2003
- const result = this.rpc.serverStreamingRequest(this.service, "StreamGaugeAnalytics", data, metadata);
2004
- return result.pipe(map((data) => MetricAnalyticsEnvelope.decode(new BinaryReader(data))));
2005
- }
2006
-
2007
- StreamSumAnalytics(request: SumQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope> {
2008
- const data = SumQueryRequest.encode(request).finish();
2009
- const result = this.rpc.serverStreamingRequest(this.service, "StreamSumAnalytics", data, metadata);
2010
- return result.pipe(map((data) => MetricAnalyticsEnvelope.decode(new BinaryReader(data))));
2011
- }
2012
-
2013
- StreamHistogramAnalytics(request: HistogramQueryRequest, metadata?: Metadata): Observable<MetricAnalyticsEnvelope> {
2014
- const data = HistogramQueryRequest.encode(request).finish();
2015
- const result = this.rpc.serverStreamingRequest(this.service, "StreamHistogramAnalytics", data, metadata);
2016
- return result.pipe(map((data) => MetricAnalyticsEnvelope.decode(new BinaryReader(data))));
2634
+ StreamQuery(request: StreamQueryRequest, metadata?: Metadata): Observable<QueryDataEnvelope> {
2635
+ const data = StreamQueryRequest.encode(request).finish();
2636
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamQuery", data, metadata);
2637
+ return result.pipe(map((data) => QueryDataEnvelope.decode(new BinaryReader(data))));
2017
2638
  }
2018
2639
  }
2019
2640
 
@@ -2084,6 +2705,10 @@ function longToNumber(int64: { toString(): string }): number {
2084
2705
  return num;
2085
2706
  }
2086
2707
 
2708
+ function isObject(value: any): boolean {
2709
+ return typeof value === "object" && value !== null;
2710
+ }
2711
+
2087
2712
  function isSet(value: any): boolean {
2088
2713
  return value !== null && value !== undefined;
2089
2714
  }