@miradorlabs/web-grpc 2.16.0 → 2.18.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.
@@ -15,6 +15,90 @@ import { EnabledStatus, enabledStatusFromJSON, enabledStatusToJSON } from "./com
15
15
 
16
16
  export const protobufPackage = "gateway.web.v1";
17
17
 
18
+ export enum Severity {
19
+ SEVERITY_UNSPECIFIED = 0,
20
+ SEVERITY_INFO = 1,
21
+ SEVERITY_WARNING = 2,
22
+ SEVERITY_CRITICAL = 3,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export function severityFromJSON(object: any): Severity {
27
+ switch (object) {
28
+ case 0:
29
+ case "SEVERITY_UNSPECIFIED":
30
+ return Severity.SEVERITY_UNSPECIFIED;
31
+ case 1:
32
+ case "SEVERITY_INFO":
33
+ return Severity.SEVERITY_INFO;
34
+ case 2:
35
+ case "SEVERITY_WARNING":
36
+ return Severity.SEVERITY_WARNING;
37
+ case 3:
38
+ case "SEVERITY_CRITICAL":
39
+ return Severity.SEVERITY_CRITICAL;
40
+ case -1:
41
+ case "UNRECOGNIZED":
42
+ default:
43
+ return Severity.UNRECOGNIZED;
44
+ }
45
+ }
46
+
47
+ export function severityToJSON(object: Severity): string {
48
+ switch (object) {
49
+ case Severity.SEVERITY_UNSPECIFIED:
50
+ return "SEVERITY_UNSPECIFIED";
51
+ case Severity.SEVERITY_INFO:
52
+ return "SEVERITY_INFO";
53
+ case Severity.SEVERITY_WARNING:
54
+ return "SEVERITY_WARNING";
55
+ case Severity.SEVERITY_CRITICAL:
56
+ return "SEVERITY_CRITICAL";
57
+ case Severity.UNRECOGNIZED:
58
+ default:
59
+ return "UNRECOGNIZED";
60
+ }
61
+ }
62
+
63
+ export enum MetricActivityType {
64
+ METRIC_ACTIVITY_TYPE_UNSPECIFIED = 0,
65
+ METRIC_ACTIVITY_TYPE_TRIGGERED = 1,
66
+ METRIC_ACTIVITY_TYPE_RECOVERED = 2,
67
+ UNRECOGNIZED = -1,
68
+ }
69
+
70
+ export function metricActivityTypeFromJSON(object: any): MetricActivityType {
71
+ switch (object) {
72
+ case 0:
73
+ case "METRIC_ACTIVITY_TYPE_UNSPECIFIED":
74
+ return MetricActivityType.METRIC_ACTIVITY_TYPE_UNSPECIFIED;
75
+ case 1:
76
+ case "METRIC_ACTIVITY_TYPE_TRIGGERED":
77
+ return MetricActivityType.METRIC_ACTIVITY_TYPE_TRIGGERED;
78
+ case 2:
79
+ case "METRIC_ACTIVITY_TYPE_RECOVERED":
80
+ return MetricActivityType.METRIC_ACTIVITY_TYPE_RECOVERED;
81
+ case -1:
82
+ case "UNRECOGNIZED":
83
+ default:
84
+ return MetricActivityType.UNRECOGNIZED;
85
+ }
86
+ }
87
+
88
+ export function metricActivityTypeToJSON(object: MetricActivityType): string {
89
+ switch (object) {
90
+ case MetricActivityType.METRIC_ACTIVITY_TYPE_UNSPECIFIED:
91
+ return "METRIC_ACTIVITY_TYPE_UNSPECIFIED";
92
+ case MetricActivityType.METRIC_ACTIVITY_TYPE_TRIGGERED:
93
+ return "METRIC_ACTIVITY_TYPE_TRIGGERED";
94
+ case MetricActivityType.METRIC_ACTIVITY_TYPE_RECOVERED:
95
+ return "METRIC_ACTIVITY_TYPE_RECOVERED";
96
+ case MetricActivityType.UNRECOGNIZED:
97
+ default:
98
+ return "UNRECOGNIZED";
99
+ }
100
+ }
101
+
18
102
  export interface TraceRule {
19
103
  id: string;
20
104
  projectId: string;
@@ -131,39 +215,165 @@ export interface TraceRuleSchema {
131
215
  jsonSchema: string;
132
216
  }
133
217
 
134
- export interface StreamTraceRuleMatchesRequest {
218
+ export interface StreamTraceRuleActivityRequest {
135
219
  projectId: string;
136
220
  organizationId: string;
137
221
  limit: number;
138
222
  }
139
223
 
140
- export interface TraceRuleMatchEnvelope {
141
- snapshot?: TraceRuleMatchSnapshot | undefined;
142
- update?: TraceRuleMatchEvent | undefined;
224
+ export interface TraceRuleActivityEnvelope {
225
+ snapshot?: TraceRuleActivitySnapshot | undefined;
226
+ update?: TraceRuleActivityEvent | undefined;
143
227
  }
144
228
 
145
- export interface TraceRuleMatchSnapshot {
146
- matches: TraceRuleMatchEvent[];
229
+ export interface TraceRuleActivitySnapshot {
230
+ activities: TraceRuleActivityEvent[];
147
231
  }
148
232
 
149
- export interface TraceRuleMatchEvent {
150
- matchId: string;
151
- projectId: string;
233
+ export interface TraceRuleActivityEvent {
234
+ activityId: string;
152
235
  ruleId: string;
153
236
  ruleName: string;
154
- integrationIds: string[];
237
+ traceId: string;
238
+ admittedTraceVersion: number;
239
+ traceName: string;
155
240
  matchReason: string;
241
+ occurredAt: Date | undefined;
242
+ }
243
+
244
+ export interface MetricRule {
245
+ id: string;
246
+ projectId: string;
247
+ organizationId: string;
248
+ name: string;
249
+ description: string;
250
+ enabled: EnabledStatus;
251
+ integrationIds: string[];
252
+ condition: MetricRuleCondition | undefined;
253
+ severity: Severity;
156
254
  createdAt: Date | undefined;
157
- entityContexts: TraceRuleMatchEvent_EntityContext[];
255
+ updatedAt: Date | undefined;
158
256
  }
159
257
 
160
- /** EntityContext carries contextual data about a matched entity. */
161
- export interface TraceRuleMatchEvent_EntityContext {
162
- traceContext?: TraceRuleMatchEvent_EntityContext_TraceContext | undefined;
258
+ export interface MetricRuleCondition {
259
+ expression: string;
260
+ recoveryExpression?: string | undefined;
163
261
  }
164
262
 
165
- export interface TraceRuleMatchEvent_EntityContext_TraceContext {
166
- traceId: string;
263
+ export interface CreateMetricRuleRequest {
264
+ projectId: string;
265
+ name: string;
266
+ description: string;
267
+ integrationIds: string[];
268
+ condition: MetricRuleCondition | undefined;
269
+ severity: Severity;
270
+ organizationId: string;
271
+ }
272
+
273
+ export interface CreateMetricRuleResponse {
274
+ status: ResponseStatus | undefined;
275
+ metricRule: MetricRule | undefined;
276
+ }
277
+
278
+ export interface GetMetricRuleRequest {
279
+ projectId: string;
280
+ metricRuleId: string;
281
+ organizationId: string;
282
+ }
283
+
284
+ export interface GetMetricRuleResponse {
285
+ status: ResponseStatus | undefined;
286
+ metricRule: MetricRule | undefined;
287
+ }
288
+
289
+ export interface ListMetricRulesRequest {
290
+ organizationId: string;
291
+ organizationIdFilter?: string | undefined;
292
+ projectIdFilter?: string | undefined;
293
+ }
294
+
295
+ export interface ListMetricRulesResponse {
296
+ status: ResponseStatus | undefined;
297
+ metricRules: MetricRule[];
298
+ }
299
+
300
+ export interface UpdateMetricRuleRequest {
301
+ projectId: string;
302
+ metricRuleId: string;
303
+ updates: UpdateMetricRuleRequest_MetricRuleUpdates | undefined;
304
+ organizationId: string;
305
+ }
306
+
307
+ export interface UpdateMetricRuleRequest_Condition {
308
+ condition: MetricRuleCondition | undefined;
309
+ }
310
+
311
+ export interface UpdateMetricRuleRequest_IntegrationIds {
312
+ ids: string[];
313
+ }
314
+
315
+ export interface UpdateMetricRuleRequest_MetricRuleUpdates {
316
+ name?: string | undefined;
317
+ description?: string | undefined;
318
+ enabled?: EnabledStatus | undefined;
319
+ severity?: Severity | undefined;
320
+ integrationIds: UpdateMetricRuleRequest_IntegrationIds | undefined;
321
+ condition: UpdateMetricRuleRequest_Condition | undefined;
322
+ }
323
+
324
+ export interface UpdateMetricRuleResponse {
325
+ status: ResponseStatus | undefined;
326
+ metricRule: MetricRule | undefined;
327
+ }
328
+
329
+ export interface DeleteMetricRuleRequest {
330
+ projectId: string;
331
+ metricRuleId: string;
332
+ organizationId: string;
333
+ }
334
+
335
+ export interface DeleteMetricRuleResponse {
336
+ status: ResponseStatus | undefined;
337
+ }
338
+
339
+ export interface PreviewMetricRuleRequest {
340
+ projectId: string;
341
+ expression: string;
342
+ organizationId: string;
343
+ }
344
+
345
+ export interface PreviewMetricRuleResponse {
346
+ status: ResponseStatus | undefined;
347
+ value?: number | undefined;
348
+ wouldFire: boolean;
349
+ state: string;
350
+ }
351
+
352
+ export interface StreamMetricRuleActivityRequest {
353
+ projectId: string;
354
+ organizationId: string;
355
+ limit: number;
356
+ }
357
+
358
+ export interface MetricRuleActivityEnvelope {
359
+ snapshot?: MetricRuleActivitySnapshot | undefined;
360
+ update?: MetricRuleActivityEvent | undefined;
361
+ }
362
+
363
+ export interface MetricRuleActivitySnapshot {
364
+ activities: MetricRuleActivityEvent[];
365
+ }
366
+
367
+ export interface MetricRuleActivityEvent {
368
+ activityId: string;
369
+ ruleId: string;
370
+ ruleName: string;
371
+ type: MetricActivityType;
372
+ incidentId: string;
373
+ expression: string;
374
+ observedValue: number;
375
+ severity: Severity;
376
+ occurredAt: Date | undefined;
167
377
  }
168
378
 
169
379
  function createBaseTraceRule(): TraceRule {
@@ -2130,12 +2340,12 @@ export const TraceRuleSchema: MessageFns<TraceRuleSchema> = {
2130
2340
  },
2131
2341
  };
2132
2342
 
2133
- function createBaseStreamTraceRuleMatchesRequest(): StreamTraceRuleMatchesRequest {
2343
+ function createBaseStreamTraceRuleActivityRequest(): StreamTraceRuleActivityRequest {
2134
2344
  return { projectId: "", organizationId: "", limit: 0 };
2135
2345
  }
2136
2346
 
2137
- export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesRequest> = {
2138
- encode(message: StreamTraceRuleMatchesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2347
+ export const StreamTraceRuleActivityRequest: MessageFns<StreamTraceRuleActivityRequest> = {
2348
+ encode(message: StreamTraceRuleActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2139
2349
  if (message.projectId !== "") {
2140
2350
  writer.uint32(10).string(message.projectId);
2141
2351
  }
@@ -2148,10 +2358,10 @@ export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesReq
2148
2358
  return writer;
2149
2359
  },
2150
2360
 
2151
- decode(input: BinaryReader | Uint8Array, length?: number): StreamTraceRuleMatchesRequest {
2361
+ decode(input: BinaryReader | Uint8Array, length?: number): StreamTraceRuleActivityRequest {
2152
2362
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2153
2363
  const end = length === undefined ? reader.len : reader.pos + length;
2154
- const message = createBaseStreamTraceRuleMatchesRequest();
2364
+ const message = createBaseStreamTraceRuleActivityRequest();
2155
2365
  while (reader.pos < end) {
2156
2366
  const tag = reader.uint32();
2157
2367
  switch (tag >>> 3) {
@@ -2188,7 +2398,7 @@ export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesReq
2188
2398
  return message;
2189
2399
  },
2190
2400
 
2191
- fromJSON(object: any): StreamTraceRuleMatchesRequest {
2401
+ fromJSON(object: any): StreamTraceRuleActivityRequest {
2192
2402
  return {
2193
2403
  projectId: isSet(object.projectId)
2194
2404
  ? globalThis.String(object.projectId)
@@ -2204,7 +2414,7 @@ export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesReq
2204
2414
  };
2205
2415
  },
2206
2416
 
2207
- toJSON(message: StreamTraceRuleMatchesRequest): unknown {
2417
+ toJSON(message: StreamTraceRuleActivityRequest): unknown {
2208
2418
  const obj: any = {};
2209
2419
  if (message.projectId !== "") {
2210
2420
  obj.projectId = message.projectId;
@@ -2218,13 +2428,13 @@ export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesReq
2218
2428
  return obj;
2219
2429
  },
2220
2430
 
2221
- create<I extends Exact<DeepPartial<StreamTraceRuleMatchesRequest>, I>>(base?: I): StreamTraceRuleMatchesRequest {
2222
- return StreamTraceRuleMatchesRequest.fromPartial(base ?? ({} as any));
2431
+ create<I extends Exact<DeepPartial<StreamTraceRuleActivityRequest>, I>>(base?: I): StreamTraceRuleActivityRequest {
2432
+ return StreamTraceRuleActivityRequest.fromPartial(base ?? ({} as any));
2223
2433
  },
2224
- fromPartial<I extends Exact<DeepPartial<StreamTraceRuleMatchesRequest>, I>>(
2434
+ fromPartial<I extends Exact<DeepPartial<StreamTraceRuleActivityRequest>, I>>(
2225
2435
  object: I,
2226
- ): StreamTraceRuleMatchesRequest {
2227
- const message = createBaseStreamTraceRuleMatchesRequest();
2436
+ ): StreamTraceRuleActivityRequest {
2437
+ const message = createBaseStreamTraceRuleActivityRequest();
2228
2438
  message.projectId = object.projectId ?? "";
2229
2439
  message.organizationId = object.organizationId ?? "";
2230
2440
  message.limit = object.limit ?? 0;
@@ -2232,25 +2442,25 @@ export const StreamTraceRuleMatchesRequest: MessageFns<StreamTraceRuleMatchesReq
2232
2442
  },
2233
2443
  };
2234
2444
 
2235
- function createBaseTraceRuleMatchEnvelope(): TraceRuleMatchEnvelope {
2445
+ function createBaseTraceRuleActivityEnvelope(): TraceRuleActivityEnvelope {
2236
2446
  return { snapshot: undefined, update: undefined };
2237
2447
  }
2238
2448
 
2239
- export const TraceRuleMatchEnvelope: MessageFns<TraceRuleMatchEnvelope> = {
2240
- encode(message: TraceRuleMatchEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2449
+ export const TraceRuleActivityEnvelope: MessageFns<TraceRuleActivityEnvelope> = {
2450
+ encode(message: TraceRuleActivityEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2241
2451
  if (message.snapshot !== undefined) {
2242
- TraceRuleMatchSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
2452
+ TraceRuleActivitySnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
2243
2453
  }
2244
2454
  if (message.update !== undefined) {
2245
- TraceRuleMatchEvent.encode(message.update, writer.uint32(18).fork()).join();
2455
+ TraceRuleActivityEvent.encode(message.update, writer.uint32(18).fork()).join();
2246
2456
  }
2247
2457
  return writer;
2248
2458
  },
2249
2459
 
2250
- decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleMatchEnvelope {
2460
+ decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleActivityEnvelope {
2251
2461
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2252
2462
  const end = length === undefined ? reader.len : reader.pos + length;
2253
- const message = createBaseTraceRuleMatchEnvelope();
2463
+ const message = createBaseTraceRuleActivityEnvelope();
2254
2464
  while (reader.pos < end) {
2255
2465
  const tag = reader.uint32();
2256
2466
  switch (tag >>> 3) {
@@ -2259,7 +2469,7 @@ export const TraceRuleMatchEnvelope: MessageFns<TraceRuleMatchEnvelope> = {
2259
2469
  break;
2260
2470
  }
2261
2471
 
2262
- message.snapshot = TraceRuleMatchSnapshot.decode(reader, reader.uint32());
2472
+ message.snapshot = TraceRuleActivitySnapshot.decode(reader, reader.uint32());
2263
2473
  continue;
2264
2474
  }
2265
2475
  case 2: {
@@ -2267,7 +2477,7 @@ export const TraceRuleMatchEnvelope: MessageFns<TraceRuleMatchEnvelope> = {
2267
2477
  break;
2268
2478
  }
2269
2479
 
2270
- message.update = TraceRuleMatchEvent.decode(reader, reader.uint32());
2480
+ message.update = TraceRuleActivityEvent.decode(reader, reader.uint32());
2271
2481
  continue;
2272
2482
  }
2273
2483
  }
@@ -2279,55 +2489,55 @@ export const TraceRuleMatchEnvelope: MessageFns<TraceRuleMatchEnvelope> = {
2279
2489
  return message;
2280
2490
  },
2281
2491
 
2282
- fromJSON(object: any): TraceRuleMatchEnvelope {
2492
+ fromJSON(object: any): TraceRuleActivityEnvelope {
2283
2493
  return {
2284
- snapshot: isSet(object.snapshot) ? TraceRuleMatchSnapshot.fromJSON(object.snapshot) : undefined,
2285
- update: isSet(object.update) ? TraceRuleMatchEvent.fromJSON(object.update) : undefined,
2494
+ snapshot: isSet(object.snapshot) ? TraceRuleActivitySnapshot.fromJSON(object.snapshot) : undefined,
2495
+ update: isSet(object.update) ? TraceRuleActivityEvent.fromJSON(object.update) : undefined,
2286
2496
  };
2287
2497
  },
2288
2498
 
2289
- toJSON(message: TraceRuleMatchEnvelope): unknown {
2499
+ toJSON(message: TraceRuleActivityEnvelope): unknown {
2290
2500
  const obj: any = {};
2291
2501
  if (message.snapshot !== undefined) {
2292
- obj.snapshot = TraceRuleMatchSnapshot.toJSON(message.snapshot);
2502
+ obj.snapshot = TraceRuleActivitySnapshot.toJSON(message.snapshot);
2293
2503
  }
2294
2504
  if (message.update !== undefined) {
2295
- obj.update = TraceRuleMatchEvent.toJSON(message.update);
2505
+ obj.update = TraceRuleActivityEvent.toJSON(message.update);
2296
2506
  }
2297
2507
  return obj;
2298
2508
  },
2299
2509
 
2300
- create<I extends Exact<DeepPartial<TraceRuleMatchEnvelope>, I>>(base?: I): TraceRuleMatchEnvelope {
2301
- return TraceRuleMatchEnvelope.fromPartial(base ?? ({} as any));
2510
+ create<I extends Exact<DeepPartial<TraceRuleActivityEnvelope>, I>>(base?: I): TraceRuleActivityEnvelope {
2511
+ return TraceRuleActivityEnvelope.fromPartial(base ?? ({} as any));
2302
2512
  },
2303
- fromPartial<I extends Exact<DeepPartial<TraceRuleMatchEnvelope>, I>>(object: I): TraceRuleMatchEnvelope {
2304
- const message = createBaseTraceRuleMatchEnvelope();
2513
+ fromPartial<I extends Exact<DeepPartial<TraceRuleActivityEnvelope>, I>>(object: I): TraceRuleActivityEnvelope {
2514
+ const message = createBaseTraceRuleActivityEnvelope();
2305
2515
  message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
2306
- ? TraceRuleMatchSnapshot.fromPartial(object.snapshot)
2516
+ ? TraceRuleActivitySnapshot.fromPartial(object.snapshot)
2307
2517
  : undefined;
2308
2518
  message.update = (object.update !== undefined && object.update !== null)
2309
- ? TraceRuleMatchEvent.fromPartial(object.update)
2519
+ ? TraceRuleActivityEvent.fromPartial(object.update)
2310
2520
  : undefined;
2311
2521
  return message;
2312
2522
  },
2313
2523
  };
2314
2524
 
2315
- function createBaseTraceRuleMatchSnapshot(): TraceRuleMatchSnapshot {
2316
- return { matches: [] };
2525
+ function createBaseTraceRuleActivitySnapshot(): TraceRuleActivitySnapshot {
2526
+ return { activities: [] };
2317
2527
  }
2318
2528
 
2319
- export const TraceRuleMatchSnapshot: MessageFns<TraceRuleMatchSnapshot> = {
2320
- encode(message: TraceRuleMatchSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2321
- for (const v of message.matches) {
2322
- TraceRuleMatchEvent.encode(v!, writer.uint32(10).fork()).join();
2529
+ export const TraceRuleActivitySnapshot: MessageFns<TraceRuleActivitySnapshot> = {
2530
+ encode(message: TraceRuleActivitySnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2531
+ for (const v of message.activities) {
2532
+ TraceRuleActivityEvent.encode(v!, writer.uint32(10).fork()).join();
2323
2533
  }
2324
2534
  return writer;
2325
2535
  },
2326
2536
 
2327
- decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleMatchSnapshot {
2537
+ decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleActivitySnapshot {
2328
2538
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2329
2539
  const end = length === undefined ? reader.len : reader.pos + length;
2330
- const message = createBaseTraceRuleMatchSnapshot();
2540
+ const message = createBaseTraceRuleActivitySnapshot();
2331
2541
  while (reader.pos < end) {
2332
2542
  const tag = reader.uint32();
2333
2543
  switch (tag >>> 3) {
@@ -2336,7 +2546,7 @@ export const TraceRuleMatchSnapshot: MessageFns<TraceRuleMatchSnapshot> = {
2336
2546
  break;
2337
2547
  }
2338
2548
 
2339
- message.matches.push(TraceRuleMatchEvent.decode(reader, reader.uint32()));
2549
+ message.activities.push(TraceRuleActivityEvent.decode(reader, reader.uint32()));
2340
2550
  continue;
2341
2551
  }
2342
2552
  }
@@ -2348,78 +2558,78 @@ export const TraceRuleMatchSnapshot: MessageFns<TraceRuleMatchSnapshot> = {
2348
2558
  return message;
2349
2559
  },
2350
2560
 
2351
- fromJSON(object: any): TraceRuleMatchSnapshot {
2561
+ fromJSON(object: any): TraceRuleActivitySnapshot {
2352
2562
  return {
2353
- matches: globalThis.Array.isArray(object?.matches)
2354
- ? object.matches.map((e: any) => TraceRuleMatchEvent.fromJSON(e))
2563
+ activities: globalThis.Array.isArray(object?.activities)
2564
+ ? object.activities.map((e: any) => TraceRuleActivityEvent.fromJSON(e))
2355
2565
  : [],
2356
2566
  };
2357
2567
  },
2358
2568
 
2359
- toJSON(message: TraceRuleMatchSnapshot): unknown {
2569
+ toJSON(message: TraceRuleActivitySnapshot): unknown {
2360
2570
  const obj: any = {};
2361
- if (message.matches?.length) {
2362
- obj.matches = message.matches.map((e) => TraceRuleMatchEvent.toJSON(e));
2571
+ if (message.activities?.length) {
2572
+ obj.activities = message.activities.map((e) => TraceRuleActivityEvent.toJSON(e));
2363
2573
  }
2364
2574
  return obj;
2365
2575
  },
2366
2576
 
2367
- create<I extends Exact<DeepPartial<TraceRuleMatchSnapshot>, I>>(base?: I): TraceRuleMatchSnapshot {
2368
- return TraceRuleMatchSnapshot.fromPartial(base ?? ({} as any));
2577
+ create<I extends Exact<DeepPartial<TraceRuleActivitySnapshot>, I>>(base?: I): TraceRuleActivitySnapshot {
2578
+ return TraceRuleActivitySnapshot.fromPartial(base ?? ({} as any));
2369
2579
  },
2370
- fromPartial<I extends Exact<DeepPartial<TraceRuleMatchSnapshot>, I>>(object: I): TraceRuleMatchSnapshot {
2371
- const message = createBaseTraceRuleMatchSnapshot();
2372
- message.matches = object.matches?.map((e) => TraceRuleMatchEvent.fromPartial(e)) || [];
2580
+ fromPartial<I extends Exact<DeepPartial<TraceRuleActivitySnapshot>, I>>(object: I): TraceRuleActivitySnapshot {
2581
+ const message = createBaseTraceRuleActivitySnapshot();
2582
+ message.activities = object.activities?.map((e) => TraceRuleActivityEvent.fromPartial(e)) || [];
2373
2583
  return message;
2374
2584
  },
2375
2585
  };
2376
2586
 
2377
- function createBaseTraceRuleMatchEvent(): TraceRuleMatchEvent {
2587
+ function createBaseTraceRuleActivityEvent(): TraceRuleActivityEvent {
2378
2588
  return {
2379
- matchId: "",
2380
- projectId: "",
2589
+ activityId: "",
2381
2590
  ruleId: "",
2382
2591
  ruleName: "",
2383
- integrationIds: [],
2592
+ traceId: "",
2593
+ admittedTraceVersion: 0,
2594
+ traceName: "",
2384
2595
  matchReason: "",
2385
- createdAt: undefined,
2386
- entityContexts: [],
2596
+ occurredAt: undefined,
2387
2597
  };
2388
2598
  }
2389
2599
 
2390
- export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2391
- encode(message: TraceRuleMatchEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2392
- if (message.matchId !== "") {
2393
- writer.uint32(10).string(message.matchId);
2394
- }
2395
- if (message.projectId !== "") {
2396
- writer.uint32(18).string(message.projectId);
2600
+ export const TraceRuleActivityEvent: MessageFns<TraceRuleActivityEvent> = {
2601
+ encode(message: TraceRuleActivityEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2602
+ if (message.activityId !== "") {
2603
+ writer.uint32(10).string(message.activityId);
2397
2604
  }
2398
2605
  if (message.ruleId !== "") {
2399
- writer.uint32(26).string(message.ruleId);
2606
+ writer.uint32(18).string(message.ruleId);
2400
2607
  }
2401
2608
  if (message.ruleName !== "") {
2402
- writer.uint32(34).string(message.ruleName);
2609
+ writer.uint32(26).string(message.ruleName);
2403
2610
  }
2404
- for (const v of message.integrationIds) {
2405
- writer.uint32(42).string(v!);
2611
+ if (message.traceId !== "") {
2612
+ writer.uint32(34).string(message.traceId);
2406
2613
  }
2407
- if (message.matchReason !== "") {
2408
- writer.uint32(50).string(message.matchReason);
2614
+ if (message.admittedTraceVersion !== 0) {
2615
+ writer.uint32(40).uint64(message.admittedTraceVersion);
2409
2616
  }
2410
- if (message.createdAt !== undefined) {
2411
- Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
2617
+ if (message.traceName !== "") {
2618
+ writer.uint32(50).string(message.traceName);
2619
+ }
2620
+ if (message.matchReason !== "") {
2621
+ writer.uint32(58).string(message.matchReason);
2412
2622
  }
2413
- for (const v of message.entityContexts) {
2414
- TraceRuleMatchEvent_EntityContext.encode(v!, writer.uint32(66).fork()).join();
2623
+ if (message.occurredAt !== undefined) {
2624
+ Timestamp.encode(toTimestamp(message.occurredAt), writer.uint32(66).fork()).join();
2415
2625
  }
2416
2626
  return writer;
2417
2627
  },
2418
2628
 
2419
- decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleMatchEvent {
2629
+ decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleActivityEvent {
2420
2630
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2421
2631
  const end = length === undefined ? reader.len : reader.pos + length;
2422
- const message = createBaseTraceRuleMatchEvent();
2632
+ const message = createBaseTraceRuleActivityEvent();
2423
2633
  while (reader.pos < end) {
2424
2634
  const tag = reader.uint32();
2425
2635
  switch (tag >>> 3) {
@@ -2428,7 +2638,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2428
2638
  break;
2429
2639
  }
2430
2640
 
2431
- message.matchId = reader.string();
2641
+ message.activityId = reader.string();
2432
2642
  continue;
2433
2643
  }
2434
2644
  case 2: {
@@ -2436,7 +2646,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2436
2646
  break;
2437
2647
  }
2438
2648
 
2439
- message.projectId = reader.string();
2649
+ message.ruleId = reader.string();
2440
2650
  continue;
2441
2651
  }
2442
2652
  case 3: {
@@ -2444,7 +2654,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2444
2654
  break;
2445
2655
  }
2446
2656
 
2447
- message.ruleId = reader.string();
2657
+ message.ruleName = reader.string();
2448
2658
  continue;
2449
2659
  }
2450
2660
  case 4: {
@@ -2452,15 +2662,15 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2452
2662
  break;
2453
2663
  }
2454
2664
 
2455
- message.ruleName = reader.string();
2665
+ message.traceId = reader.string();
2456
2666
  continue;
2457
2667
  }
2458
2668
  case 5: {
2459
- if (tag !== 42) {
2669
+ if (tag !== 40) {
2460
2670
  break;
2461
2671
  }
2462
2672
 
2463
- message.integrationIds.push(reader.string());
2673
+ message.admittedTraceVersion = longToNumber(reader.uint64());
2464
2674
  continue;
2465
2675
  }
2466
2676
  case 6: {
@@ -2468,7 +2678,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2468
2678
  break;
2469
2679
  }
2470
2680
 
2471
- message.matchReason = reader.string();
2681
+ message.traceName = reader.string();
2472
2682
  continue;
2473
2683
  }
2474
2684
  case 7: {
@@ -2476,7 +2686,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2476
2686
  break;
2477
2687
  }
2478
2688
 
2479
- message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2689
+ message.matchReason = reader.string();
2480
2690
  continue;
2481
2691
  }
2482
2692
  case 8: {
@@ -2484,7 +2694,7 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2484
2694
  break;
2485
2695
  }
2486
2696
 
2487
- message.entityContexts.push(TraceRuleMatchEvent_EntityContext.decode(reader, reader.uint32()));
2697
+ message.occurredAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2488
2698
  continue;
2489
2699
  }
2490
2700
  }
@@ -2496,17 +2706,12 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2496
2706
  return message;
2497
2707
  },
2498
2708
 
2499
- fromJSON(object: any): TraceRuleMatchEvent {
2709
+ fromJSON(object: any): TraceRuleActivityEvent {
2500
2710
  return {
2501
- matchId: isSet(object.matchId)
2502
- ? globalThis.String(object.matchId)
2503
- : isSet(object.match_id)
2504
- ? globalThis.String(object.match_id)
2505
- : "",
2506
- projectId: isSet(object.projectId)
2507
- ? globalThis.String(object.projectId)
2508
- : isSet(object.project_id)
2509
- ? globalThis.String(object.project_id)
2711
+ activityId: isSet(object.activityId)
2712
+ ? globalThis.String(object.activityId)
2713
+ : isSet(object.activity_id)
2714
+ ? globalThis.String(object.activity_id)
2510
2715
  : "",
2511
2716
  ruleId: isSet(object.ruleId)
2512
2717
  ? globalThis.String(object.ruleId)
@@ -2518,36 +2723,38 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2518
2723
  : isSet(object.rule_name)
2519
2724
  ? globalThis.String(object.rule_name)
2520
2725
  : "",
2521
- integrationIds: globalThis.Array.isArray(object?.integrationIds)
2522
- ? object.integrationIds.map((e: any) => globalThis.String(e))
2523
- : globalThis.Array.isArray(object?.integration_ids)
2524
- ? object.integration_ids.map((e: any) => globalThis.String(e))
2525
- : [],
2726
+ traceId: isSet(object.traceId)
2727
+ ? globalThis.String(object.traceId)
2728
+ : isSet(object.trace_id)
2729
+ ? globalThis.String(object.trace_id)
2730
+ : "",
2731
+ admittedTraceVersion: isSet(object.admittedTraceVersion)
2732
+ ? globalThis.Number(object.admittedTraceVersion)
2733
+ : isSet(object.admitted_trace_version)
2734
+ ? globalThis.Number(object.admitted_trace_version)
2735
+ : 0,
2736
+ traceName: isSet(object.traceName)
2737
+ ? globalThis.String(object.traceName)
2738
+ : isSet(object.trace_name)
2739
+ ? globalThis.String(object.trace_name)
2740
+ : "",
2526
2741
  matchReason: isSet(object.matchReason)
2527
2742
  ? globalThis.String(object.matchReason)
2528
2743
  : isSet(object.match_reason)
2529
2744
  ? globalThis.String(object.match_reason)
2530
2745
  : "",
2531
- createdAt: isSet(object.createdAt)
2532
- ? fromJsonTimestamp(object.createdAt)
2533
- : isSet(object.created_at)
2534
- ? fromJsonTimestamp(object.created_at)
2746
+ occurredAt: isSet(object.occurredAt)
2747
+ ? fromJsonTimestamp(object.occurredAt)
2748
+ : isSet(object.occurred_at)
2749
+ ? fromJsonTimestamp(object.occurred_at)
2535
2750
  : undefined,
2536
- entityContexts: globalThis.Array.isArray(object?.entityContexts)
2537
- ? object.entityContexts.map((e: any) => TraceRuleMatchEvent_EntityContext.fromJSON(e))
2538
- : globalThis.Array.isArray(object?.entity_contexts)
2539
- ? object.entity_contexts.map((e: any) => TraceRuleMatchEvent_EntityContext.fromJSON(e))
2540
- : [],
2541
2751
  };
2542
2752
  },
2543
2753
 
2544
- toJSON(message: TraceRuleMatchEvent): unknown {
2754
+ toJSON(message: TraceRuleActivityEvent): unknown {
2545
2755
  const obj: any = {};
2546
- if (message.matchId !== "") {
2547
- obj.matchId = message.matchId;
2548
- }
2549
- if (message.projectId !== "") {
2550
- obj.projectId = message.projectId;
2756
+ if (message.activityId !== "") {
2757
+ obj.activityId = message.activityId;
2551
2758
  }
2552
2759
  if (message.ruleId !== "") {
2553
2760
  obj.ruleId = message.ruleId;
@@ -2555,54 +2762,99 @@ export const TraceRuleMatchEvent: MessageFns<TraceRuleMatchEvent> = {
2555
2762
  if (message.ruleName !== "") {
2556
2763
  obj.ruleName = message.ruleName;
2557
2764
  }
2558
- if (message.integrationIds?.length) {
2559
- obj.integrationIds = message.integrationIds;
2765
+ if (message.traceId !== "") {
2766
+ obj.traceId = message.traceId;
2767
+ }
2768
+ if (message.admittedTraceVersion !== 0) {
2769
+ obj.admittedTraceVersion = Math.round(message.admittedTraceVersion);
2770
+ }
2771
+ if (message.traceName !== "") {
2772
+ obj.traceName = message.traceName;
2560
2773
  }
2561
2774
  if (message.matchReason !== "") {
2562
2775
  obj.matchReason = message.matchReason;
2563
2776
  }
2564
- if (message.createdAt !== undefined) {
2565
- obj.createdAt = message.createdAt.toISOString();
2566
- }
2567
- if (message.entityContexts?.length) {
2568
- obj.entityContexts = message.entityContexts.map((e) => TraceRuleMatchEvent_EntityContext.toJSON(e));
2777
+ if (message.occurredAt !== undefined) {
2778
+ obj.occurredAt = message.occurredAt.toISOString();
2569
2779
  }
2570
2780
  return obj;
2571
2781
  },
2572
2782
 
2573
- create<I extends Exact<DeepPartial<TraceRuleMatchEvent>, I>>(base?: I): TraceRuleMatchEvent {
2574
- return TraceRuleMatchEvent.fromPartial(base ?? ({} as any));
2783
+ create<I extends Exact<DeepPartial<TraceRuleActivityEvent>, I>>(base?: I): TraceRuleActivityEvent {
2784
+ return TraceRuleActivityEvent.fromPartial(base ?? ({} as any));
2575
2785
  },
2576
- fromPartial<I extends Exact<DeepPartial<TraceRuleMatchEvent>, I>>(object: I): TraceRuleMatchEvent {
2577
- const message = createBaseTraceRuleMatchEvent();
2578
- message.matchId = object.matchId ?? "";
2579
- message.projectId = object.projectId ?? "";
2786
+ fromPartial<I extends Exact<DeepPartial<TraceRuleActivityEvent>, I>>(object: I): TraceRuleActivityEvent {
2787
+ const message = createBaseTraceRuleActivityEvent();
2788
+ message.activityId = object.activityId ?? "";
2580
2789
  message.ruleId = object.ruleId ?? "";
2581
2790
  message.ruleName = object.ruleName ?? "";
2582
- message.integrationIds = object.integrationIds?.map((e) => e) || [];
2791
+ message.traceId = object.traceId ?? "";
2792
+ message.admittedTraceVersion = object.admittedTraceVersion ?? 0;
2793
+ message.traceName = object.traceName ?? "";
2583
2794
  message.matchReason = object.matchReason ?? "";
2584
- message.createdAt = object.createdAt ?? undefined;
2585
- message.entityContexts = object.entityContexts?.map((e) => TraceRuleMatchEvent_EntityContext.fromPartial(e)) || [];
2795
+ message.occurredAt = object.occurredAt ?? undefined;
2586
2796
  return message;
2587
2797
  },
2588
2798
  };
2589
2799
 
2590
- function createBaseTraceRuleMatchEvent_EntityContext(): TraceRuleMatchEvent_EntityContext {
2591
- return { traceContext: undefined };
2800
+ function createBaseMetricRule(): MetricRule {
2801
+ return {
2802
+ id: "",
2803
+ projectId: "",
2804
+ organizationId: "",
2805
+ name: "",
2806
+ description: "",
2807
+ enabled: 0,
2808
+ integrationIds: [],
2809
+ condition: undefined,
2810
+ severity: 0,
2811
+ createdAt: undefined,
2812
+ updatedAt: undefined,
2813
+ };
2592
2814
  }
2593
2815
 
2594
- export const TraceRuleMatchEvent_EntityContext: MessageFns<TraceRuleMatchEvent_EntityContext> = {
2595
- encode(message: TraceRuleMatchEvent_EntityContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2596
- if (message.traceContext !== undefined) {
2597
- TraceRuleMatchEvent_EntityContext_TraceContext.encode(message.traceContext, writer.uint32(10).fork()).join();
2816
+ export const MetricRule: MessageFns<MetricRule> = {
2817
+ encode(message: MetricRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2818
+ if (message.id !== "") {
2819
+ writer.uint32(10).string(message.id);
2820
+ }
2821
+ if (message.projectId !== "") {
2822
+ writer.uint32(18).string(message.projectId);
2823
+ }
2824
+ if (message.organizationId !== "") {
2825
+ writer.uint32(26).string(message.organizationId);
2826
+ }
2827
+ if (message.name !== "") {
2828
+ writer.uint32(34).string(message.name);
2829
+ }
2830
+ if (message.description !== "") {
2831
+ writer.uint32(42).string(message.description);
2832
+ }
2833
+ if (message.enabled !== 0) {
2834
+ writer.uint32(48).int32(message.enabled);
2835
+ }
2836
+ for (const v of message.integrationIds) {
2837
+ writer.uint32(58).string(v!);
2838
+ }
2839
+ if (message.condition !== undefined) {
2840
+ MetricRuleCondition.encode(message.condition, writer.uint32(66).fork()).join();
2841
+ }
2842
+ if (message.severity !== 0) {
2843
+ writer.uint32(72).int32(message.severity);
2844
+ }
2845
+ if (message.createdAt !== undefined) {
2846
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
2847
+ }
2848
+ if (message.updatedAt !== undefined) {
2849
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join();
2598
2850
  }
2599
2851
  return writer;
2600
2852
  },
2601
2853
 
2602
- decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleMatchEvent_EntityContext {
2854
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricRule {
2603
2855
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2604
2856
  const end = length === undefined ? reader.len : reader.pos + length;
2605
- const message = createBaseTraceRuleMatchEvent_EntityContext();
2857
+ const message = createBaseMetricRule();
2606
2858
  while (reader.pos < end) {
2607
2859
  const tag = reader.uint32();
2608
2860
  switch (tag >>> 3) {
@@ -2611,86 +2863,1921 @@ export const TraceRuleMatchEvent_EntityContext: MessageFns<TraceRuleMatchEvent_E
2611
2863
  break;
2612
2864
  }
2613
2865
 
2614
- message.traceContext = TraceRuleMatchEvent_EntityContext_TraceContext.decode(reader, reader.uint32());
2866
+ message.id = reader.string();
2615
2867
  continue;
2616
2868
  }
2617
- }
2618
- if ((tag & 7) === 4 || tag === 0) {
2619
- break;
2620
- }
2621
- reader.skip(tag & 7);
2622
- }
2623
- return message;
2624
- },
2625
-
2626
- fromJSON(object: any): TraceRuleMatchEvent_EntityContext {
2627
- return {
2628
- traceContext: isSet(object.traceContext)
2629
- ? TraceRuleMatchEvent_EntityContext_TraceContext.fromJSON(object.traceContext)
2630
- : isSet(object.trace_context)
2631
- ? TraceRuleMatchEvent_EntityContext_TraceContext.fromJSON(object.trace_context)
2632
- : undefined,
2633
- };
2634
- },
2635
-
2636
- toJSON(message: TraceRuleMatchEvent_EntityContext): unknown {
2637
- const obj: any = {};
2638
- if (message.traceContext !== undefined) {
2639
- obj.traceContext = TraceRuleMatchEvent_EntityContext_TraceContext.toJSON(message.traceContext);
2640
- }
2641
- return obj;
2642
- },
2643
-
2644
- create<I extends Exact<DeepPartial<TraceRuleMatchEvent_EntityContext>, I>>(
2645
- base?: I,
2646
- ): TraceRuleMatchEvent_EntityContext {
2647
- return TraceRuleMatchEvent_EntityContext.fromPartial(base ?? ({} as any));
2648
- },
2649
- fromPartial<I extends Exact<DeepPartial<TraceRuleMatchEvent_EntityContext>, I>>(
2650
- object: I,
2651
- ): TraceRuleMatchEvent_EntityContext {
2652
- const message = createBaseTraceRuleMatchEvent_EntityContext();
2653
- message.traceContext = (object.traceContext !== undefined && object.traceContext !== null)
2654
- ? TraceRuleMatchEvent_EntityContext_TraceContext.fromPartial(object.traceContext)
2655
- : undefined;
2656
- return message;
2657
- },
2658
- };
2659
-
2660
- function createBaseTraceRuleMatchEvent_EntityContext_TraceContext(): TraceRuleMatchEvent_EntityContext_TraceContext {
2661
- return { traceId: "" };
2662
- }
2663
-
2664
- export const TraceRuleMatchEvent_EntityContext_TraceContext: MessageFns<
2665
- TraceRuleMatchEvent_EntityContext_TraceContext
2666
- > = {
2667
- encode(
2668
- message: TraceRuleMatchEvent_EntityContext_TraceContext,
2669
- writer: BinaryWriter = new BinaryWriter(),
2670
- ): BinaryWriter {
2671
- if (message.traceId !== "") {
2672
- writer.uint32(10).string(message.traceId);
2673
- }
2674
- return writer;
2675
- },
2869
+ case 2: {
2870
+ if (tag !== 18) {
2871
+ break;
2872
+ }
2676
2873
 
2677
- decode(input: BinaryReader | Uint8Array, length?: number): TraceRuleMatchEvent_EntityContext_TraceContext {
2678
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2679
- const end = length === undefined ? reader.len : reader.pos + length;
2680
- const message = createBaseTraceRuleMatchEvent_EntityContext_TraceContext();
2681
- while (reader.pos < end) {
2682
- const tag = reader.uint32();
2683
- switch (tag >>> 3) {
2684
- case 1: {
2685
- if (tag !== 10) {
2874
+ message.projectId = reader.string();
2875
+ continue;
2876
+ }
2877
+ case 3: {
2878
+ if (tag !== 26) {
2686
2879
  break;
2687
2880
  }
2688
2881
 
2689
- message.traceId = reader.string();
2882
+ message.organizationId = reader.string();
2690
2883
  continue;
2691
2884
  }
2692
- }
2693
- if ((tag & 7) === 4 || tag === 0) {
2885
+ case 4: {
2886
+ if (tag !== 34) {
2887
+ break;
2888
+ }
2889
+
2890
+ message.name = reader.string();
2891
+ continue;
2892
+ }
2893
+ case 5: {
2894
+ if (tag !== 42) {
2895
+ break;
2896
+ }
2897
+
2898
+ message.description = reader.string();
2899
+ continue;
2900
+ }
2901
+ case 6: {
2902
+ if (tag !== 48) {
2903
+ break;
2904
+ }
2905
+
2906
+ message.enabled = reader.int32() as any;
2907
+ continue;
2908
+ }
2909
+ case 7: {
2910
+ if (tag !== 58) {
2911
+ break;
2912
+ }
2913
+
2914
+ message.integrationIds.push(reader.string());
2915
+ continue;
2916
+ }
2917
+ case 8: {
2918
+ if (tag !== 66) {
2919
+ break;
2920
+ }
2921
+
2922
+ message.condition = MetricRuleCondition.decode(reader, reader.uint32());
2923
+ continue;
2924
+ }
2925
+ case 9: {
2926
+ if (tag !== 72) {
2927
+ break;
2928
+ }
2929
+
2930
+ message.severity = reader.int32() as any;
2931
+ continue;
2932
+ }
2933
+ case 10: {
2934
+ if (tag !== 82) {
2935
+ break;
2936
+ }
2937
+
2938
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2939
+ continue;
2940
+ }
2941
+ case 11: {
2942
+ if (tag !== 90) {
2943
+ break;
2944
+ }
2945
+
2946
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2947
+ continue;
2948
+ }
2949
+ }
2950
+ if ((tag & 7) === 4 || tag === 0) {
2951
+ break;
2952
+ }
2953
+ reader.skip(tag & 7);
2954
+ }
2955
+ return message;
2956
+ },
2957
+
2958
+ fromJSON(object: any): MetricRule {
2959
+ return {
2960
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
2961
+ projectId: isSet(object.projectId)
2962
+ ? globalThis.String(object.projectId)
2963
+ : isSet(object.project_id)
2964
+ ? globalThis.String(object.project_id)
2965
+ : "",
2966
+ organizationId: isSet(object.organizationId)
2967
+ ? globalThis.String(object.organizationId)
2968
+ : isSet(object.organization_id)
2969
+ ? globalThis.String(object.organization_id)
2970
+ : "",
2971
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2972
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
2973
+ enabled: isSet(object.enabled) ? enabledStatusFromJSON(object.enabled) : 0,
2974
+ integrationIds: globalThis.Array.isArray(object?.integrationIds)
2975
+ ? object.integrationIds.map((e: any) => globalThis.String(e))
2976
+ : globalThis.Array.isArray(object?.integration_ids)
2977
+ ? object.integration_ids.map((e: any) => globalThis.String(e))
2978
+ : [],
2979
+ condition: isSet(object.condition) ? MetricRuleCondition.fromJSON(object.condition) : undefined,
2980
+ severity: isSet(object.severity) ? severityFromJSON(object.severity) : 0,
2981
+ createdAt: isSet(object.createdAt)
2982
+ ? fromJsonTimestamp(object.createdAt)
2983
+ : isSet(object.created_at)
2984
+ ? fromJsonTimestamp(object.created_at)
2985
+ : undefined,
2986
+ updatedAt: isSet(object.updatedAt)
2987
+ ? fromJsonTimestamp(object.updatedAt)
2988
+ : isSet(object.updated_at)
2989
+ ? fromJsonTimestamp(object.updated_at)
2990
+ : undefined,
2991
+ };
2992
+ },
2993
+
2994
+ toJSON(message: MetricRule): unknown {
2995
+ const obj: any = {};
2996
+ if (message.id !== "") {
2997
+ obj.id = message.id;
2998
+ }
2999
+ if (message.projectId !== "") {
3000
+ obj.projectId = message.projectId;
3001
+ }
3002
+ if (message.organizationId !== "") {
3003
+ obj.organizationId = message.organizationId;
3004
+ }
3005
+ if (message.name !== "") {
3006
+ obj.name = message.name;
3007
+ }
3008
+ if (message.description !== "") {
3009
+ obj.description = message.description;
3010
+ }
3011
+ if (message.enabled !== 0) {
3012
+ obj.enabled = enabledStatusToJSON(message.enabled);
3013
+ }
3014
+ if (message.integrationIds?.length) {
3015
+ obj.integrationIds = message.integrationIds;
3016
+ }
3017
+ if (message.condition !== undefined) {
3018
+ obj.condition = MetricRuleCondition.toJSON(message.condition);
3019
+ }
3020
+ if (message.severity !== 0) {
3021
+ obj.severity = severityToJSON(message.severity);
3022
+ }
3023
+ if (message.createdAt !== undefined) {
3024
+ obj.createdAt = message.createdAt.toISOString();
3025
+ }
3026
+ if (message.updatedAt !== undefined) {
3027
+ obj.updatedAt = message.updatedAt.toISOString();
3028
+ }
3029
+ return obj;
3030
+ },
3031
+
3032
+ create<I extends Exact<DeepPartial<MetricRule>, I>>(base?: I): MetricRule {
3033
+ return MetricRule.fromPartial(base ?? ({} as any));
3034
+ },
3035
+ fromPartial<I extends Exact<DeepPartial<MetricRule>, I>>(object: I): MetricRule {
3036
+ const message = createBaseMetricRule();
3037
+ message.id = object.id ?? "";
3038
+ message.projectId = object.projectId ?? "";
3039
+ message.organizationId = object.organizationId ?? "";
3040
+ message.name = object.name ?? "";
3041
+ message.description = object.description ?? "";
3042
+ message.enabled = object.enabled ?? 0;
3043
+ message.integrationIds = object.integrationIds?.map((e) => e) || [];
3044
+ message.condition = (object.condition !== undefined && object.condition !== null)
3045
+ ? MetricRuleCondition.fromPartial(object.condition)
3046
+ : undefined;
3047
+ message.severity = object.severity ?? 0;
3048
+ message.createdAt = object.createdAt ?? undefined;
3049
+ message.updatedAt = object.updatedAt ?? undefined;
3050
+ return message;
3051
+ },
3052
+ };
3053
+
3054
+ function createBaseMetricRuleCondition(): MetricRuleCondition {
3055
+ return { expression: "", recoveryExpression: undefined };
3056
+ }
3057
+
3058
+ export const MetricRuleCondition: MessageFns<MetricRuleCondition> = {
3059
+ encode(message: MetricRuleCondition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3060
+ if (message.expression !== "") {
3061
+ writer.uint32(10).string(message.expression);
3062
+ }
3063
+ if (message.recoveryExpression !== undefined) {
3064
+ writer.uint32(18).string(message.recoveryExpression);
3065
+ }
3066
+ return writer;
3067
+ },
3068
+
3069
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricRuleCondition {
3070
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3071
+ const end = length === undefined ? reader.len : reader.pos + length;
3072
+ const message = createBaseMetricRuleCondition();
3073
+ while (reader.pos < end) {
3074
+ const tag = reader.uint32();
3075
+ switch (tag >>> 3) {
3076
+ case 1: {
3077
+ if (tag !== 10) {
3078
+ break;
3079
+ }
3080
+
3081
+ message.expression = reader.string();
3082
+ continue;
3083
+ }
3084
+ case 2: {
3085
+ if (tag !== 18) {
3086
+ break;
3087
+ }
3088
+
3089
+ message.recoveryExpression = reader.string();
3090
+ continue;
3091
+ }
3092
+ }
3093
+ if ((tag & 7) === 4 || tag === 0) {
3094
+ break;
3095
+ }
3096
+ reader.skip(tag & 7);
3097
+ }
3098
+ return message;
3099
+ },
3100
+
3101
+ fromJSON(object: any): MetricRuleCondition {
3102
+ return {
3103
+ expression: isSet(object.expression) ? globalThis.String(object.expression) : "",
3104
+ recoveryExpression: isSet(object.recoveryExpression)
3105
+ ? globalThis.String(object.recoveryExpression)
3106
+ : isSet(object.recovery_expression)
3107
+ ? globalThis.String(object.recovery_expression)
3108
+ : undefined,
3109
+ };
3110
+ },
3111
+
3112
+ toJSON(message: MetricRuleCondition): unknown {
3113
+ const obj: any = {};
3114
+ if (message.expression !== "") {
3115
+ obj.expression = message.expression;
3116
+ }
3117
+ if (message.recoveryExpression !== undefined) {
3118
+ obj.recoveryExpression = message.recoveryExpression;
3119
+ }
3120
+ return obj;
3121
+ },
3122
+
3123
+ create<I extends Exact<DeepPartial<MetricRuleCondition>, I>>(base?: I): MetricRuleCondition {
3124
+ return MetricRuleCondition.fromPartial(base ?? ({} as any));
3125
+ },
3126
+ fromPartial<I extends Exact<DeepPartial<MetricRuleCondition>, I>>(object: I): MetricRuleCondition {
3127
+ const message = createBaseMetricRuleCondition();
3128
+ message.expression = object.expression ?? "";
3129
+ message.recoveryExpression = object.recoveryExpression ?? undefined;
3130
+ return message;
3131
+ },
3132
+ };
3133
+
3134
+ function createBaseCreateMetricRuleRequest(): CreateMetricRuleRequest {
3135
+ return {
3136
+ projectId: "",
3137
+ name: "",
3138
+ description: "",
3139
+ integrationIds: [],
3140
+ condition: undefined,
3141
+ severity: 0,
3142
+ organizationId: "",
3143
+ };
3144
+ }
3145
+
3146
+ export const CreateMetricRuleRequest: MessageFns<CreateMetricRuleRequest> = {
3147
+ encode(message: CreateMetricRuleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3148
+ if (message.projectId !== "") {
3149
+ writer.uint32(10).string(message.projectId);
3150
+ }
3151
+ if (message.name !== "") {
3152
+ writer.uint32(18).string(message.name);
3153
+ }
3154
+ if (message.description !== "") {
3155
+ writer.uint32(26).string(message.description);
3156
+ }
3157
+ for (const v of message.integrationIds) {
3158
+ writer.uint32(34).string(v!);
3159
+ }
3160
+ if (message.condition !== undefined) {
3161
+ MetricRuleCondition.encode(message.condition, writer.uint32(42).fork()).join();
3162
+ }
3163
+ if (message.severity !== 0) {
3164
+ writer.uint32(48).int32(message.severity);
3165
+ }
3166
+ if (message.organizationId !== "") {
3167
+ writer.uint32(58).string(message.organizationId);
3168
+ }
3169
+ return writer;
3170
+ },
3171
+
3172
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateMetricRuleRequest {
3173
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3174
+ const end = length === undefined ? reader.len : reader.pos + length;
3175
+ const message = createBaseCreateMetricRuleRequest();
3176
+ while (reader.pos < end) {
3177
+ const tag = reader.uint32();
3178
+ switch (tag >>> 3) {
3179
+ case 1: {
3180
+ if (tag !== 10) {
3181
+ break;
3182
+ }
3183
+
3184
+ message.projectId = reader.string();
3185
+ continue;
3186
+ }
3187
+ case 2: {
3188
+ if (tag !== 18) {
3189
+ break;
3190
+ }
3191
+
3192
+ message.name = reader.string();
3193
+ continue;
3194
+ }
3195
+ case 3: {
3196
+ if (tag !== 26) {
3197
+ break;
3198
+ }
3199
+
3200
+ message.description = reader.string();
3201
+ continue;
3202
+ }
3203
+ case 4: {
3204
+ if (tag !== 34) {
3205
+ break;
3206
+ }
3207
+
3208
+ message.integrationIds.push(reader.string());
3209
+ continue;
3210
+ }
3211
+ case 5: {
3212
+ if (tag !== 42) {
3213
+ break;
3214
+ }
3215
+
3216
+ message.condition = MetricRuleCondition.decode(reader, reader.uint32());
3217
+ continue;
3218
+ }
3219
+ case 6: {
3220
+ if (tag !== 48) {
3221
+ break;
3222
+ }
3223
+
3224
+ message.severity = reader.int32() as any;
3225
+ continue;
3226
+ }
3227
+ case 7: {
3228
+ if (tag !== 58) {
3229
+ break;
3230
+ }
3231
+
3232
+ message.organizationId = reader.string();
3233
+ continue;
3234
+ }
3235
+ }
3236
+ if ((tag & 7) === 4 || tag === 0) {
3237
+ break;
3238
+ }
3239
+ reader.skip(tag & 7);
3240
+ }
3241
+ return message;
3242
+ },
3243
+
3244
+ fromJSON(object: any): CreateMetricRuleRequest {
3245
+ return {
3246
+ projectId: isSet(object.projectId)
3247
+ ? globalThis.String(object.projectId)
3248
+ : isSet(object.project_id)
3249
+ ? globalThis.String(object.project_id)
3250
+ : "",
3251
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
3252
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
3253
+ integrationIds: globalThis.Array.isArray(object?.integrationIds)
3254
+ ? object.integrationIds.map((e: any) => globalThis.String(e))
3255
+ : globalThis.Array.isArray(object?.integration_ids)
3256
+ ? object.integration_ids.map((e: any) => globalThis.String(e))
3257
+ : [],
3258
+ condition: isSet(object.condition) ? MetricRuleCondition.fromJSON(object.condition) : undefined,
3259
+ severity: isSet(object.severity) ? severityFromJSON(object.severity) : 0,
3260
+ organizationId: isSet(object.organizationId)
3261
+ ? globalThis.String(object.organizationId)
3262
+ : isSet(object.organization_id)
3263
+ ? globalThis.String(object.organization_id)
3264
+ : "",
3265
+ };
3266
+ },
3267
+
3268
+ toJSON(message: CreateMetricRuleRequest): unknown {
3269
+ const obj: any = {};
3270
+ if (message.projectId !== "") {
3271
+ obj.projectId = message.projectId;
3272
+ }
3273
+ if (message.name !== "") {
3274
+ obj.name = message.name;
3275
+ }
3276
+ if (message.description !== "") {
3277
+ obj.description = message.description;
3278
+ }
3279
+ if (message.integrationIds?.length) {
3280
+ obj.integrationIds = message.integrationIds;
3281
+ }
3282
+ if (message.condition !== undefined) {
3283
+ obj.condition = MetricRuleCondition.toJSON(message.condition);
3284
+ }
3285
+ if (message.severity !== 0) {
3286
+ obj.severity = severityToJSON(message.severity);
3287
+ }
3288
+ if (message.organizationId !== "") {
3289
+ obj.organizationId = message.organizationId;
3290
+ }
3291
+ return obj;
3292
+ },
3293
+
3294
+ create<I extends Exact<DeepPartial<CreateMetricRuleRequest>, I>>(base?: I): CreateMetricRuleRequest {
3295
+ return CreateMetricRuleRequest.fromPartial(base ?? ({} as any));
3296
+ },
3297
+ fromPartial<I extends Exact<DeepPartial<CreateMetricRuleRequest>, I>>(object: I): CreateMetricRuleRequest {
3298
+ const message = createBaseCreateMetricRuleRequest();
3299
+ message.projectId = object.projectId ?? "";
3300
+ message.name = object.name ?? "";
3301
+ message.description = object.description ?? "";
3302
+ message.integrationIds = object.integrationIds?.map((e) => e) || [];
3303
+ message.condition = (object.condition !== undefined && object.condition !== null)
3304
+ ? MetricRuleCondition.fromPartial(object.condition)
3305
+ : undefined;
3306
+ message.severity = object.severity ?? 0;
3307
+ message.organizationId = object.organizationId ?? "";
3308
+ return message;
3309
+ },
3310
+ };
3311
+
3312
+ function createBaseCreateMetricRuleResponse(): CreateMetricRuleResponse {
3313
+ return { status: undefined, metricRule: undefined };
3314
+ }
3315
+
3316
+ export const CreateMetricRuleResponse: MessageFns<CreateMetricRuleResponse> = {
3317
+ encode(message: CreateMetricRuleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3318
+ if (message.status !== undefined) {
3319
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
3320
+ }
3321
+ if (message.metricRule !== undefined) {
3322
+ MetricRule.encode(message.metricRule, writer.uint32(18).fork()).join();
3323
+ }
3324
+ return writer;
3325
+ },
3326
+
3327
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateMetricRuleResponse {
3328
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3329
+ const end = length === undefined ? reader.len : reader.pos + length;
3330
+ const message = createBaseCreateMetricRuleResponse();
3331
+ while (reader.pos < end) {
3332
+ const tag = reader.uint32();
3333
+ switch (tag >>> 3) {
3334
+ case 1: {
3335
+ if (tag !== 10) {
3336
+ break;
3337
+ }
3338
+
3339
+ message.status = ResponseStatus.decode(reader, reader.uint32());
3340
+ continue;
3341
+ }
3342
+ case 2: {
3343
+ if (tag !== 18) {
3344
+ break;
3345
+ }
3346
+
3347
+ message.metricRule = MetricRule.decode(reader, reader.uint32());
3348
+ continue;
3349
+ }
3350
+ }
3351
+ if ((tag & 7) === 4 || tag === 0) {
3352
+ break;
3353
+ }
3354
+ reader.skip(tag & 7);
3355
+ }
3356
+ return message;
3357
+ },
3358
+
3359
+ fromJSON(object: any): CreateMetricRuleResponse {
3360
+ return {
3361
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
3362
+ metricRule: isSet(object.metricRule)
3363
+ ? MetricRule.fromJSON(object.metricRule)
3364
+ : isSet(object.metric_rule)
3365
+ ? MetricRule.fromJSON(object.metric_rule)
3366
+ : undefined,
3367
+ };
3368
+ },
3369
+
3370
+ toJSON(message: CreateMetricRuleResponse): unknown {
3371
+ const obj: any = {};
3372
+ if (message.status !== undefined) {
3373
+ obj.status = ResponseStatus.toJSON(message.status);
3374
+ }
3375
+ if (message.metricRule !== undefined) {
3376
+ obj.metricRule = MetricRule.toJSON(message.metricRule);
3377
+ }
3378
+ return obj;
3379
+ },
3380
+
3381
+ create<I extends Exact<DeepPartial<CreateMetricRuleResponse>, I>>(base?: I): CreateMetricRuleResponse {
3382
+ return CreateMetricRuleResponse.fromPartial(base ?? ({} as any));
3383
+ },
3384
+ fromPartial<I extends Exact<DeepPartial<CreateMetricRuleResponse>, I>>(object: I): CreateMetricRuleResponse {
3385
+ const message = createBaseCreateMetricRuleResponse();
3386
+ message.status = (object.status !== undefined && object.status !== null)
3387
+ ? ResponseStatus.fromPartial(object.status)
3388
+ : undefined;
3389
+ message.metricRule = (object.metricRule !== undefined && object.metricRule !== null)
3390
+ ? MetricRule.fromPartial(object.metricRule)
3391
+ : undefined;
3392
+ return message;
3393
+ },
3394
+ };
3395
+
3396
+ function createBaseGetMetricRuleRequest(): GetMetricRuleRequest {
3397
+ return { projectId: "", metricRuleId: "", organizationId: "" };
3398
+ }
3399
+
3400
+ export const GetMetricRuleRequest: MessageFns<GetMetricRuleRequest> = {
3401
+ encode(message: GetMetricRuleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3402
+ if (message.projectId !== "") {
3403
+ writer.uint32(10).string(message.projectId);
3404
+ }
3405
+ if (message.metricRuleId !== "") {
3406
+ writer.uint32(18).string(message.metricRuleId);
3407
+ }
3408
+ if (message.organizationId !== "") {
3409
+ writer.uint32(26).string(message.organizationId);
3410
+ }
3411
+ return writer;
3412
+ },
3413
+
3414
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMetricRuleRequest {
3415
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3416
+ const end = length === undefined ? reader.len : reader.pos + length;
3417
+ const message = createBaseGetMetricRuleRequest();
3418
+ while (reader.pos < end) {
3419
+ const tag = reader.uint32();
3420
+ switch (tag >>> 3) {
3421
+ case 1: {
3422
+ if (tag !== 10) {
3423
+ break;
3424
+ }
3425
+
3426
+ message.projectId = reader.string();
3427
+ continue;
3428
+ }
3429
+ case 2: {
3430
+ if (tag !== 18) {
3431
+ break;
3432
+ }
3433
+
3434
+ message.metricRuleId = reader.string();
3435
+ continue;
3436
+ }
3437
+ case 3: {
3438
+ if (tag !== 26) {
3439
+ break;
3440
+ }
3441
+
3442
+ message.organizationId = reader.string();
3443
+ continue;
3444
+ }
3445
+ }
3446
+ if ((tag & 7) === 4 || tag === 0) {
3447
+ break;
3448
+ }
3449
+ reader.skip(tag & 7);
3450
+ }
3451
+ return message;
3452
+ },
3453
+
3454
+ fromJSON(object: any): GetMetricRuleRequest {
3455
+ return {
3456
+ projectId: isSet(object.projectId)
3457
+ ? globalThis.String(object.projectId)
3458
+ : isSet(object.project_id)
3459
+ ? globalThis.String(object.project_id)
3460
+ : "",
3461
+ metricRuleId: isSet(object.metricRuleId)
3462
+ ? globalThis.String(object.metricRuleId)
3463
+ : isSet(object.metric_rule_id)
3464
+ ? globalThis.String(object.metric_rule_id)
3465
+ : "",
3466
+ organizationId: isSet(object.organizationId)
3467
+ ? globalThis.String(object.organizationId)
3468
+ : isSet(object.organization_id)
3469
+ ? globalThis.String(object.organization_id)
3470
+ : "",
3471
+ };
3472
+ },
3473
+
3474
+ toJSON(message: GetMetricRuleRequest): unknown {
3475
+ const obj: any = {};
3476
+ if (message.projectId !== "") {
3477
+ obj.projectId = message.projectId;
3478
+ }
3479
+ if (message.metricRuleId !== "") {
3480
+ obj.metricRuleId = message.metricRuleId;
3481
+ }
3482
+ if (message.organizationId !== "") {
3483
+ obj.organizationId = message.organizationId;
3484
+ }
3485
+ return obj;
3486
+ },
3487
+
3488
+ create<I extends Exact<DeepPartial<GetMetricRuleRequest>, I>>(base?: I): GetMetricRuleRequest {
3489
+ return GetMetricRuleRequest.fromPartial(base ?? ({} as any));
3490
+ },
3491
+ fromPartial<I extends Exact<DeepPartial<GetMetricRuleRequest>, I>>(object: I): GetMetricRuleRequest {
3492
+ const message = createBaseGetMetricRuleRequest();
3493
+ message.projectId = object.projectId ?? "";
3494
+ message.metricRuleId = object.metricRuleId ?? "";
3495
+ message.organizationId = object.organizationId ?? "";
3496
+ return message;
3497
+ },
3498
+ };
3499
+
3500
+ function createBaseGetMetricRuleResponse(): GetMetricRuleResponse {
3501
+ return { status: undefined, metricRule: undefined };
3502
+ }
3503
+
3504
+ export const GetMetricRuleResponse: MessageFns<GetMetricRuleResponse> = {
3505
+ encode(message: GetMetricRuleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3506
+ if (message.status !== undefined) {
3507
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
3508
+ }
3509
+ if (message.metricRule !== undefined) {
3510
+ MetricRule.encode(message.metricRule, writer.uint32(18).fork()).join();
3511
+ }
3512
+ return writer;
3513
+ },
3514
+
3515
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMetricRuleResponse {
3516
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3517
+ const end = length === undefined ? reader.len : reader.pos + length;
3518
+ const message = createBaseGetMetricRuleResponse();
3519
+ while (reader.pos < end) {
3520
+ const tag = reader.uint32();
3521
+ switch (tag >>> 3) {
3522
+ case 1: {
3523
+ if (tag !== 10) {
3524
+ break;
3525
+ }
3526
+
3527
+ message.status = ResponseStatus.decode(reader, reader.uint32());
3528
+ continue;
3529
+ }
3530
+ case 2: {
3531
+ if (tag !== 18) {
3532
+ break;
3533
+ }
3534
+
3535
+ message.metricRule = MetricRule.decode(reader, reader.uint32());
3536
+ continue;
3537
+ }
3538
+ }
3539
+ if ((tag & 7) === 4 || tag === 0) {
3540
+ break;
3541
+ }
3542
+ reader.skip(tag & 7);
3543
+ }
3544
+ return message;
3545
+ },
3546
+
3547
+ fromJSON(object: any): GetMetricRuleResponse {
3548
+ return {
3549
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
3550
+ metricRule: isSet(object.metricRule)
3551
+ ? MetricRule.fromJSON(object.metricRule)
3552
+ : isSet(object.metric_rule)
3553
+ ? MetricRule.fromJSON(object.metric_rule)
3554
+ : undefined,
3555
+ };
3556
+ },
3557
+
3558
+ toJSON(message: GetMetricRuleResponse): unknown {
3559
+ const obj: any = {};
3560
+ if (message.status !== undefined) {
3561
+ obj.status = ResponseStatus.toJSON(message.status);
3562
+ }
3563
+ if (message.metricRule !== undefined) {
3564
+ obj.metricRule = MetricRule.toJSON(message.metricRule);
3565
+ }
3566
+ return obj;
3567
+ },
3568
+
3569
+ create<I extends Exact<DeepPartial<GetMetricRuleResponse>, I>>(base?: I): GetMetricRuleResponse {
3570
+ return GetMetricRuleResponse.fromPartial(base ?? ({} as any));
3571
+ },
3572
+ fromPartial<I extends Exact<DeepPartial<GetMetricRuleResponse>, I>>(object: I): GetMetricRuleResponse {
3573
+ const message = createBaseGetMetricRuleResponse();
3574
+ message.status = (object.status !== undefined && object.status !== null)
3575
+ ? ResponseStatus.fromPartial(object.status)
3576
+ : undefined;
3577
+ message.metricRule = (object.metricRule !== undefined && object.metricRule !== null)
3578
+ ? MetricRule.fromPartial(object.metricRule)
3579
+ : undefined;
3580
+ return message;
3581
+ },
3582
+ };
3583
+
3584
+ function createBaseListMetricRulesRequest(): ListMetricRulesRequest {
3585
+ return { organizationId: "", organizationIdFilter: undefined, projectIdFilter: undefined };
3586
+ }
3587
+
3588
+ export const ListMetricRulesRequest: MessageFns<ListMetricRulesRequest> = {
3589
+ encode(message: ListMetricRulesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3590
+ if (message.organizationId !== "") {
3591
+ writer.uint32(10).string(message.organizationId);
3592
+ }
3593
+ if (message.organizationIdFilter !== undefined) {
3594
+ writer.uint32(18).string(message.organizationIdFilter);
3595
+ }
3596
+ if (message.projectIdFilter !== undefined) {
3597
+ writer.uint32(26).string(message.projectIdFilter);
3598
+ }
3599
+ return writer;
3600
+ },
3601
+
3602
+ decode(input: BinaryReader | Uint8Array, length?: number): ListMetricRulesRequest {
3603
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3604
+ const end = length === undefined ? reader.len : reader.pos + length;
3605
+ const message = createBaseListMetricRulesRequest();
3606
+ while (reader.pos < end) {
3607
+ const tag = reader.uint32();
3608
+ switch (tag >>> 3) {
3609
+ case 1: {
3610
+ if (tag !== 10) {
3611
+ break;
3612
+ }
3613
+
3614
+ message.organizationId = reader.string();
3615
+ continue;
3616
+ }
3617
+ case 2: {
3618
+ if (tag !== 18) {
3619
+ break;
3620
+ }
3621
+
3622
+ message.organizationIdFilter = reader.string();
3623
+ continue;
3624
+ }
3625
+ case 3: {
3626
+ if (tag !== 26) {
3627
+ break;
3628
+ }
3629
+
3630
+ message.projectIdFilter = reader.string();
3631
+ continue;
3632
+ }
3633
+ }
3634
+ if ((tag & 7) === 4 || tag === 0) {
3635
+ break;
3636
+ }
3637
+ reader.skip(tag & 7);
3638
+ }
3639
+ return message;
3640
+ },
3641
+
3642
+ fromJSON(object: any): ListMetricRulesRequest {
3643
+ return {
3644
+ organizationId: isSet(object.organizationId)
3645
+ ? globalThis.String(object.organizationId)
3646
+ : isSet(object.organization_id)
3647
+ ? globalThis.String(object.organization_id)
3648
+ : "",
3649
+ organizationIdFilter: isSet(object.organizationIdFilter)
3650
+ ? globalThis.String(object.organizationIdFilter)
3651
+ : isSet(object.organization_id_filter)
3652
+ ? globalThis.String(object.organization_id_filter)
3653
+ : undefined,
3654
+ projectIdFilter: isSet(object.projectIdFilter)
3655
+ ? globalThis.String(object.projectIdFilter)
3656
+ : isSet(object.project_id_filter)
3657
+ ? globalThis.String(object.project_id_filter)
3658
+ : undefined,
3659
+ };
3660
+ },
3661
+
3662
+ toJSON(message: ListMetricRulesRequest): unknown {
3663
+ const obj: any = {};
3664
+ if (message.organizationId !== "") {
3665
+ obj.organizationId = message.organizationId;
3666
+ }
3667
+ if (message.organizationIdFilter !== undefined) {
3668
+ obj.organizationIdFilter = message.organizationIdFilter;
3669
+ }
3670
+ if (message.projectIdFilter !== undefined) {
3671
+ obj.projectIdFilter = message.projectIdFilter;
3672
+ }
3673
+ return obj;
3674
+ },
3675
+
3676
+ create<I extends Exact<DeepPartial<ListMetricRulesRequest>, I>>(base?: I): ListMetricRulesRequest {
3677
+ return ListMetricRulesRequest.fromPartial(base ?? ({} as any));
3678
+ },
3679
+ fromPartial<I extends Exact<DeepPartial<ListMetricRulesRequest>, I>>(object: I): ListMetricRulesRequest {
3680
+ const message = createBaseListMetricRulesRequest();
3681
+ message.organizationId = object.organizationId ?? "";
3682
+ message.organizationIdFilter = object.organizationIdFilter ?? undefined;
3683
+ message.projectIdFilter = object.projectIdFilter ?? undefined;
3684
+ return message;
3685
+ },
3686
+ };
3687
+
3688
+ function createBaseListMetricRulesResponse(): ListMetricRulesResponse {
3689
+ return { status: undefined, metricRules: [] };
3690
+ }
3691
+
3692
+ export const ListMetricRulesResponse: MessageFns<ListMetricRulesResponse> = {
3693
+ encode(message: ListMetricRulesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3694
+ if (message.status !== undefined) {
3695
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
3696
+ }
3697
+ for (const v of message.metricRules) {
3698
+ MetricRule.encode(v!, writer.uint32(18).fork()).join();
3699
+ }
3700
+ return writer;
3701
+ },
3702
+
3703
+ decode(input: BinaryReader | Uint8Array, length?: number): ListMetricRulesResponse {
3704
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3705
+ const end = length === undefined ? reader.len : reader.pos + length;
3706
+ const message = createBaseListMetricRulesResponse();
3707
+ while (reader.pos < end) {
3708
+ const tag = reader.uint32();
3709
+ switch (tag >>> 3) {
3710
+ case 1: {
3711
+ if (tag !== 10) {
3712
+ break;
3713
+ }
3714
+
3715
+ message.status = ResponseStatus.decode(reader, reader.uint32());
3716
+ continue;
3717
+ }
3718
+ case 2: {
3719
+ if (tag !== 18) {
3720
+ break;
3721
+ }
3722
+
3723
+ message.metricRules.push(MetricRule.decode(reader, reader.uint32()));
3724
+ continue;
3725
+ }
3726
+ }
3727
+ if ((tag & 7) === 4 || tag === 0) {
3728
+ break;
3729
+ }
3730
+ reader.skip(tag & 7);
3731
+ }
3732
+ return message;
3733
+ },
3734
+
3735
+ fromJSON(object: any): ListMetricRulesResponse {
3736
+ return {
3737
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
3738
+ metricRules: globalThis.Array.isArray(object?.metricRules)
3739
+ ? object.metricRules.map((e: any) => MetricRule.fromJSON(e))
3740
+ : globalThis.Array.isArray(object?.metric_rules)
3741
+ ? object.metric_rules.map((e: any) => MetricRule.fromJSON(e))
3742
+ : [],
3743
+ };
3744
+ },
3745
+
3746
+ toJSON(message: ListMetricRulesResponse): unknown {
3747
+ const obj: any = {};
3748
+ if (message.status !== undefined) {
3749
+ obj.status = ResponseStatus.toJSON(message.status);
3750
+ }
3751
+ if (message.metricRules?.length) {
3752
+ obj.metricRules = message.metricRules.map((e) => MetricRule.toJSON(e));
3753
+ }
3754
+ return obj;
3755
+ },
3756
+
3757
+ create<I extends Exact<DeepPartial<ListMetricRulesResponse>, I>>(base?: I): ListMetricRulesResponse {
3758
+ return ListMetricRulesResponse.fromPartial(base ?? ({} as any));
3759
+ },
3760
+ fromPartial<I extends Exact<DeepPartial<ListMetricRulesResponse>, I>>(object: I): ListMetricRulesResponse {
3761
+ const message = createBaseListMetricRulesResponse();
3762
+ message.status = (object.status !== undefined && object.status !== null)
3763
+ ? ResponseStatus.fromPartial(object.status)
3764
+ : undefined;
3765
+ message.metricRules = object.metricRules?.map((e) => MetricRule.fromPartial(e)) || [];
3766
+ return message;
3767
+ },
3768
+ };
3769
+
3770
+ function createBaseUpdateMetricRuleRequest(): UpdateMetricRuleRequest {
3771
+ return { projectId: "", metricRuleId: "", updates: undefined, organizationId: "" };
3772
+ }
3773
+
3774
+ export const UpdateMetricRuleRequest: MessageFns<UpdateMetricRuleRequest> = {
3775
+ encode(message: UpdateMetricRuleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3776
+ if (message.projectId !== "") {
3777
+ writer.uint32(10).string(message.projectId);
3778
+ }
3779
+ if (message.metricRuleId !== "") {
3780
+ writer.uint32(18).string(message.metricRuleId);
3781
+ }
3782
+ if (message.updates !== undefined) {
3783
+ UpdateMetricRuleRequest_MetricRuleUpdates.encode(message.updates, writer.uint32(26).fork()).join();
3784
+ }
3785
+ if (message.organizationId !== "") {
3786
+ writer.uint32(34).string(message.organizationId);
3787
+ }
3788
+ return writer;
3789
+ },
3790
+
3791
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateMetricRuleRequest {
3792
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3793
+ const end = length === undefined ? reader.len : reader.pos + length;
3794
+ const message = createBaseUpdateMetricRuleRequest();
3795
+ while (reader.pos < end) {
3796
+ const tag = reader.uint32();
3797
+ switch (tag >>> 3) {
3798
+ case 1: {
3799
+ if (tag !== 10) {
3800
+ break;
3801
+ }
3802
+
3803
+ message.projectId = reader.string();
3804
+ continue;
3805
+ }
3806
+ case 2: {
3807
+ if (tag !== 18) {
3808
+ break;
3809
+ }
3810
+
3811
+ message.metricRuleId = reader.string();
3812
+ continue;
3813
+ }
3814
+ case 3: {
3815
+ if (tag !== 26) {
3816
+ break;
3817
+ }
3818
+
3819
+ message.updates = UpdateMetricRuleRequest_MetricRuleUpdates.decode(reader, reader.uint32());
3820
+ continue;
3821
+ }
3822
+ case 4: {
3823
+ if (tag !== 34) {
3824
+ break;
3825
+ }
3826
+
3827
+ message.organizationId = reader.string();
3828
+ continue;
3829
+ }
3830
+ }
3831
+ if ((tag & 7) === 4 || tag === 0) {
3832
+ break;
3833
+ }
3834
+ reader.skip(tag & 7);
3835
+ }
3836
+ return message;
3837
+ },
3838
+
3839
+ fromJSON(object: any): UpdateMetricRuleRequest {
3840
+ return {
3841
+ projectId: isSet(object.projectId)
3842
+ ? globalThis.String(object.projectId)
3843
+ : isSet(object.project_id)
3844
+ ? globalThis.String(object.project_id)
3845
+ : "",
3846
+ metricRuleId: isSet(object.metricRuleId)
3847
+ ? globalThis.String(object.metricRuleId)
3848
+ : isSet(object.metric_rule_id)
3849
+ ? globalThis.String(object.metric_rule_id)
3850
+ : "",
3851
+ updates: isSet(object.updates) ? UpdateMetricRuleRequest_MetricRuleUpdates.fromJSON(object.updates) : undefined,
3852
+ organizationId: isSet(object.organizationId)
3853
+ ? globalThis.String(object.organizationId)
3854
+ : isSet(object.organization_id)
3855
+ ? globalThis.String(object.organization_id)
3856
+ : "",
3857
+ };
3858
+ },
3859
+
3860
+ toJSON(message: UpdateMetricRuleRequest): unknown {
3861
+ const obj: any = {};
3862
+ if (message.projectId !== "") {
3863
+ obj.projectId = message.projectId;
3864
+ }
3865
+ if (message.metricRuleId !== "") {
3866
+ obj.metricRuleId = message.metricRuleId;
3867
+ }
3868
+ if (message.updates !== undefined) {
3869
+ obj.updates = UpdateMetricRuleRequest_MetricRuleUpdates.toJSON(message.updates);
3870
+ }
3871
+ if (message.organizationId !== "") {
3872
+ obj.organizationId = message.organizationId;
3873
+ }
3874
+ return obj;
3875
+ },
3876
+
3877
+ create<I extends Exact<DeepPartial<UpdateMetricRuleRequest>, I>>(base?: I): UpdateMetricRuleRequest {
3878
+ return UpdateMetricRuleRequest.fromPartial(base ?? ({} as any));
3879
+ },
3880
+ fromPartial<I extends Exact<DeepPartial<UpdateMetricRuleRequest>, I>>(object: I): UpdateMetricRuleRequest {
3881
+ const message = createBaseUpdateMetricRuleRequest();
3882
+ message.projectId = object.projectId ?? "";
3883
+ message.metricRuleId = object.metricRuleId ?? "";
3884
+ message.updates = (object.updates !== undefined && object.updates !== null)
3885
+ ? UpdateMetricRuleRequest_MetricRuleUpdates.fromPartial(object.updates)
3886
+ : undefined;
3887
+ message.organizationId = object.organizationId ?? "";
3888
+ return message;
3889
+ },
3890
+ };
3891
+
3892
+ function createBaseUpdateMetricRuleRequest_Condition(): UpdateMetricRuleRequest_Condition {
3893
+ return { condition: undefined };
3894
+ }
3895
+
3896
+ export const UpdateMetricRuleRequest_Condition: MessageFns<UpdateMetricRuleRequest_Condition> = {
3897
+ encode(message: UpdateMetricRuleRequest_Condition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3898
+ if (message.condition !== undefined) {
3899
+ MetricRuleCondition.encode(message.condition, writer.uint32(10).fork()).join();
3900
+ }
3901
+ return writer;
3902
+ },
3903
+
3904
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateMetricRuleRequest_Condition {
3905
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3906
+ const end = length === undefined ? reader.len : reader.pos + length;
3907
+ const message = createBaseUpdateMetricRuleRequest_Condition();
3908
+ while (reader.pos < end) {
3909
+ const tag = reader.uint32();
3910
+ switch (tag >>> 3) {
3911
+ case 1: {
3912
+ if (tag !== 10) {
3913
+ break;
3914
+ }
3915
+
3916
+ message.condition = MetricRuleCondition.decode(reader, reader.uint32());
3917
+ continue;
3918
+ }
3919
+ }
3920
+ if ((tag & 7) === 4 || tag === 0) {
3921
+ break;
3922
+ }
3923
+ reader.skip(tag & 7);
3924
+ }
3925
+ return message;
3926
+ },
3927
+
3928
+ fromJSON(object: any): UpdateMetricRuleRequest_Condition {
3929
+ return { condition: isSet(object.condition) ? MetricRuleCondition.fromJSON(object.condition) : undefined };
3930
+ },
3931
+
3932
+ toJSON(message: UpdateMetricRuleRequest_Condition): unknown {
3933
+ const obj: any = {};
3934
+ if (message.condition !== undefined) {
3935
+ obj.condition = MetricRuleCondition.toJSON(message.condition);
3936
+ }
3937
+ return obj;
3938
+ },
3939
+
3940
+ create<I extends Exact<DeepPartial<UpdateMetricRuleRequest_Condition>, I>>(
3941
+ base?: I,
3942
+ ): UpdateMetricRuleRequest_Condition {
3943
+ return UpdateMetricRuleRequest_Condition.fromPartial(base ?? ({} as any));
3944
+ },
3945
+ fromPartial<I extends Exact<DeepPartial<UpdateMetricRuleRequest_Condition>, I>>(
3946
+ object: I,
3947
+ ): UpdateMetricRuleRequest_Condition {
3948
+ const message = createBaseUpdateMetricRuleRequest_Condition();
3949
+ message.condition = (object.condition !== undefined && object.condition !== null)
3950
+ ? MetricRuleCondition.fromPartial(object.condition)
3951
+ : undefined;
3952
+ return message;
3953
+ },
3954
+ };
3955
+
3956
+ function createBaseUpdateMetricRuleRequest_IntegrationIds(): UpdateMetricRuleRequest_IntegrationIds {
3957
+ return { ids: [] };
3958
+ }
3959
+
3960
+ export const UpdateMetricRuleRequest_IntegrationIds: MessageFns<UpdateMetricRuleRequest_IntegrationIds> = {
3961
+ encode(message: UpdateMetricRuleRequest_IntegrationIds, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3962
+ for (const v of message.ids) {
3963
+ writer.uint32(10).string(v!);
3964
+ }
3965
+ return writer;
3966
+ },
3967
+
3968
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateMetricRuleRequest_IntegrationIds {
3969
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3970
+ const end = length === undefined ? reader.len : reader.pos + length;
3971
+ const message = createBaseUpdateMetricRuleRequest_IntegrationIds();
3972
+ while (reader.pos < end) {
3973
+ const tag = reader.uint32();
3974
+ switch (tag >>> 3) {
3975
+ case 1: {
3976
+ if (tag !== 10) {
3977
+ break;
3978
+ }
3979
+
3980
+ message.ids.push(reader.string());
3981
+ continue;
3982
+ }
3983
+ }
3984
+ if ((tag & 7) === 4 || tag === 0) {
3985
+ break;
3986
+ }
3987
+ reader.skip(tag & 7);
3988
+ }
3989
+ return message;
3990
+ },
3991
+
3992
+ fromJSON(object: any): UpdateMetricRuleRequest_IntegrationIds {
3993
+ return { ids: globalThis.Array.isArray(object?.ids) ? object.ids.map((e: any) => globalThis.String(e)) : [] };
3994
+ },
3995
+
3996
+ toJSON(message: UpdateMetricRuleRequest_IntegrationIds): unknown {
3997
+ const obj: any = {};
3998
+ if (message.ids?.length) {
3999
+ obj.ids = message.ids;
4000
+ }
4001
+ return obj;
4002
+ },
4003
+
4004
+ create<I extends Exact<DeepPartial<UpdateMetricRuleRequest_IntegrationIds>, I>>(
4005
+ base?: I,
4006
+ ): UpdateMetricRuleRequest_IntegrationIds {
4007
+ return UpdateMetricRuleRequest_IntegrationIds.fromPartial(base ?? ({} as any));
4008
+ },
4009
+ fromPartial<I extends Exact<DeepPartial<UpdateMetricRuleRequest_IntegrationIds>, I>>(
4010
+ object: I,
4011
+ ): UpdateMetricRuleRequest_IntegrationIds {
4012
+ const message = createBaseUpdateMetricRuleRequest_IntegrationIds();
4013
+ message.ids = object.ids?.map((e) => e) || [];
4014
+ return message;
4015
+ },
4016
+ };
4017
+
4018
+ function createBaseUpdateMetricRuleRequest_MetricRuleUpdates(): UpdateMetricRuleRequest_MetricRuleUpdates {
4019
+ return {
4020
+ name: undefined,
4021
+ description: undefined,
4022
+ enabled: undefined,
4023
+ severity: undefined,
4024
+ integrationIds: undefined,
4025
+ condition: undefined,
4026
+ };
4027
+ }
4028
+
4029
+ export const UpdateMetricRuleRequest_MetricRuleUpdates: MessageFns<UpdateMetricRuleRequest_MetricRuleUpdates> = {
4030
+ encode(message: UpdateMetricRuleRequest_MetricRuleUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4031
+ if (message.name !== undefined) {
4032
+ writer.uint32(10).string(message.name);
4033
+ }
4034
+ if (message.description !== undefined) {
4035
+ writer.uint32(18).string(message.description);
4036
+ }
4037
+ if (message.enabled !== undefined) {
4038
+ writer.uint32(24).int32(message.enabled);
4039
+ }
4040
+ if (message.severity !== undefined) {
4041
+ writer.uint32(32).int32(message.severity);
4042
+ }
4043
+ if (message.integrationIds !== undefined) {
4044
+ UpdateMetricRuleRequest_IntegrationIds.encode(message.integrationIds, writer.uint32(42).fork()).join();
4045
+ }
4046
+ if (message.condition !== undefined) {
4047
+ UpdateMetricRuleRequest_Condition.encode(message.condition, writer.uint32(50).fork()).join();
4048
+ }
4049
+ return writer;
4050
+ },
4051
+
4052
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateMetricRuleRequest_MetricRuleUpdates {
4053
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4054
+ const end = length === undefined ? reader.len : reader.pos + length;
4055
+ const message = createBaseUpdateMetricRuleRequest_MetricRuleUpdates();
4056
+ while (reader.pos < end) {
4057
+ const tag = reader.uint32();
4058
+ switch (tag >>> 3) {
4059
+ case 1: {
4060
+ if (tag !== 10) {
4061
+ break;
4062
+ }
4063
+
4064
+ message.name = reader.string();
4065
+ continue;
4066
+ }
4067
+ case 2: {
4068
+ if (tag !== 18) {
4069
+ break;
4070
+ }
4071
+
4072
+ message.description = reader.string();
4073
+ continue;
4074
+ }
4075
+ case 3: {
4076
+ if (tag !== 24) {
4077
+ break;
4078
+ }
4079
+
4080
+ message.enabled = reader.int32() as any;
4081
+ continue;
4082
+ }
4083
+ case 4: {
4084
+ if (tag !== 32) {
4085
+ break;
4086
+ }
4087
+
4088
+ message.severity = reader.int32() as any;
4089
+ continue;
4090
+ }
4091
+ case 5: {
4092
+ if (tag !== 42) {
4093
+ break;
4094
+ }
4095
+
4096
+ message.integrationIds = UpdateMetricRuleRequest_IntegrationIds.decode(reader, reader.uint32());
4097
+ continue;
4098
+ }
4099
+ case 6: {
4100
+ if (tag !== 50) {
4101
+ break;
4102
+ }
4103
+
4104
+ message.condition = UpdateMetricRuleRequest_Condition.decode(reader, reader.uint32());
4105
+ continue;
4106
+ }
4107
+ }
4108
+ if ((tag & 7) === 4 || tag === 0) {
4109
+ break;
4110
+ }
4111
+ reader.skip(tag & 7);
4112
+ }
4113
+ return message;
4114
+ },
4115
+
4116
+ fromJSON(object: any): UpdateMetricRuleRequest_MetricRuleUpdates {
4117
+ return {
4118
+ name: isSet(object.name) ? globalThis.String(object.name) : undefined,
4119
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
4120
+ enabled: isSet(object.enabled) ? enabledStatusFromJSON(object.enabled) : undefined,
4121
+ severity: isSet(object.severity) ? severityFromJSON(object.severity) : undefined,
4122
+ integrationIds: isSet(object.integrationIds)
4123
+ ? UpdateMetricRuleRequest_IntegrationIds.fromJSON(object.integrationIds)
4124
+ : isSet(object.integration_ids)
4125
+ ? UpdateMetricRuleRequest_IntegrationIds.fromJSON(object.integration_ids)
4126
+ : undefined,
4127
+ condition: isSet(object.condition) ? UpdateMetricRuleRequest_Condition.fromJSON(object.condition) : undefined,
4128
+ };
4129
+ },
4130
+
4131
+ toJSON(message: UpdateMetricRuleRequest_MetricRuleUpdates): unknown {
4132
+ const obj: any = {};
4133
+ if (message.name !== undefined) {
4134
+ obj.name = message.name;
4135
+ }
4136
+ if (message.description !== undefined) {
4137
+ obj.description = message.description;
4138
+ }
4139
+ if (message.enabled !== undefined) {
4140
+ obj.enabled = enabledStatusToJSON(message.enabled);
4141
+ }
4142
+ if (message.severity !== undefined) {
4143
+ obj.severity = severityToJSON(message.severity);
4144
+ }
4145
+ if (message.integrationIds !== undefined) {
4146
+ obj.integrationIds = UpdateMetricRuleRequest_IntegrationIds.toJSON(message.integrationIds);
4147
+ }
4148
+ if (message.condition !== undefined) {
4149
+ obj.condition = UpdateMetricRuleRequest_Condition.toJSON(message.condition);
4150
+ }
4151
+ return obj;
4152
+ },
4153
+
4154
+ create<I extends Exact<DeepPartial<UpdateMetricRuleRequest_MetricRuleUpdates>, I>>(
4155
+ base?: I,
4156
+ ): UpdateMetricRuleRequest_MetricRuleUpdates {
4157
+ return UpdateMetricRuleRequest_MetricRuleUpdates.fromPartial(base ?? ({} as any));
4158
+ },
4159
+ fromPartial<I extends Exact<DeepPartial<UpdateMetricRuleRequest_MetricRuleUpdates>, I>>(
4160
+ object: I,
4161
+ ): UpdateMetricRuleRequest_MetricRuleUpdates {
4162
+ const message = createBaseUpdateMetricRuleRequest_MetricRuleUpdates();
4163
+ message.name = object.name ?? undefined;
4164
+ message.description = object.description ?? undefined;
4165
+ message.enabled = object.enabled ?? undefined;
4166
+ message.severity = object.severity ?? undefined;
4167
+ message.integrationIds = (object.integrationIds !== undefined && object.integrationIds !== null)
4168
+ ? UpdateMetricRuleRequest_IntegrationIds.fromPartial(object.integrationIds)
4169
+ : undefined;
4170
+ message.condition = (object.condition !== undefined && object.condition !== null)
4171
+ ? UpdateMetricRuleRequest_Condition.fromPartial(object.condition)
4172
+ : undefined;
4173
+ return message;
4174
+ },
4175
+ };
4176
+
4177
+ function createBaseUpdateMetricRuleResponse(): UpdateMetricRuleResponse {
4178
+ return { status: undefined, metricRule: undefined };
4179
+ }
4180
+
4181
+ export const UpdateMetricRuleResponse: MessageFns<UpdateMetricRuleResponse> = {
4182
+ encode(message: UpdateMetricRuleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4183
+ if (message.status !== undefined) {
4184
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
4185
+ }
4186
+ if (message.metricRule !== undefined) {
4187
+ MetricRule.encode(message.metricRule, writer.uint32(18).fork()).join();
4188
+ }
4189
+ return writer;
4190
+ },
4191
+
4192
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateMetricRuleResponse {
4193
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4194
+ const end = length === undefined ? reader.len : reader.pos + length;
4195
+ const message = createBaseUpdateMetricRuleResponse();
4196
+ while (reader.pos < end) {
4197
+ const tag = reader.uint32();
4198
+ switch (tag >>> 3) {
4199
+ case 1: {
4200
+ if (tag !== 10) {
4201
+ break;
4202
+ }
4203
+
4204
+ message.status = ResponseStatus.decode(reader, reader.uint32());
4205
+ continue;
4206
+ }
4207
+ case 2: {
4208
+ if (tag !== 18) {
4209
+ break;
4210
+ }
4211
+
4212
+ message.metricRule = MetricRule.decode(reader, reader.uint32());
4213
+ continue;
4214
+ }
4215
+ }
4216
+ if ((tag & 7) === 4 || tag === 0) {
4217
+ break;
4218
+ }
4219
+ reader.skip(tag & 7);
4220
+ }
4221
+ return message;
4222
+ },
4223
+
4224
+ fromJSON(object: any): UpdateMetricRuleResponse {
4225
+ return {
4226
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
4227
+ metricRule: isSet(object.metricRule)
4228
+ ? MetricRule.fromJSON(object.metricRule)
4229
+ : isSet(object.metric_rule)
4230
+ ? MetricRule.fromJSON(object.metric_rule)
4231
+ : undefined,
4232
+ };
4233
+ },
4234
+
4235
+ toJSON(message: UpdateMetricRuleResponse): unknown {
4236
+ const obj: any = {};
4237
+ if (message.status !== undefined) {
4238
+ obj.status = ResponseStatus.toJSON(message.status);
4239
+ }
4240
+ if (message.metricRule !== undefined) {
4241
+ obj.metricRule = MetricRule.toJSON(message.metricRule);
4242
+ }
4243
+ return obj;
4244
+ },
4245
+
4246
+ create<I extends Exact<DeepPartial<UpdateMetricRuleResponse>, I>>(base?: I): UpdateMetricRuleResponse {
4247
+ return UpdateMetricRuleResponse.fromPartial(base ?? ({} as any));
4248
+ },
4249
+ fromPartial<I extends Exact<DeepPartial<UpdateMetricRuleResponse>, I>>(object: I): UpdateMetricRuleResponse {
4250
+ const message = createBaseUpdateMetricRuleResponse();
4251
+ message.status = (object.status !== undefined && object.status !== null)
4252
+ ? ResponseStatus.fromPartial(object.status)
4253
+ : undefined;
4254
+ message.metricRule = (object.metricRule !== undefined && object.metricRule !== null)
4255
+ ? MetricRule.fromPartial(object.metricRule)
4256
+ : undefined;
4257
+ return message;
4258
+ },
4259
+ };
4260
+
4261
+ function createBaseDeleteMetricRuleRequest(): DeleteMetricRuleRequest {
4262
+ return { projectId: "", metricRuleId: "", organizationId: "" };
4263
+ }
4264
+
4265
+ export const DeleteMetricRuleRequest: MessageFns<DeleteMetricRuleRequest> = {
4266
+ encode(message: DeleteMetricRuleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4267
+ if (message.projectId !== "") {
4268
+ writer.uint32(10).string(message.projectId);
4269
+ }
4270
+ if (message.metricRuleId !== "") {
4271
+ writer.uint32(18).string(message.metricRuleId);
4272
+ }
4273
+ if (message.organizationId !== "") {
4274
+ writer.uint32(26).string(message.organizationId);
4275
+ }
4276
+ return writer;
4277
+ },
4278
+
4279
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteMetricRuleRequest {
4280
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4281
+ const end = length === undefined ? reader.len : reader.pos + length;
4282
+ const message = createBaseDeleteMetricRuleRequest();
4283
+ while (reader.pos < end) {
4284
+ const tag = reader.uint32();
4285
+ switch (tag >>> 3) {
4286
+ case 1: {
4287
+ if (tag !== 10) {
4288
+ break;
4289
+ }
4290
+
4291
+ message.projectId = reader.string();
4292
+ continue;
4293
+ }
4294
+ case 2: {
4295
+ if (tag !== 18) {
4296
+ break;
4297
+ }
4298
+
4299
+ message.metricRuleId = reader.string();
4300
+ continue;
4301
+ }
4302
+ case 3: {
4303
+ if (tag !== 26) {
4304
+ break;
4305
+ }
4306
+
4307
+ message.organizationId = reader.string();
4308
+ continue;
4309
+ }
4310
+ }
4311
+ if ((tag & 7) === 4 || tag === 0) {
4312
+ break;
4313
+ }
4314
+ reader.skip(tag & 7);
4315
+ }
4316
+ return message;
4317
+ },
4318
+
4319
+ fromJSON(object: any): DeleteMetricRuleRequest {
4320
+ return {
4321
+ projectId: isSet(object.projectId)
4322
+ ? globalThis.String(object.projectId)
4323
+ : isSet(object.project_id)
4324
+ ? globalThis.String(object.project_id)
4325
+ : "",
4326
+ metricRuleId: isSet(object.metricRuleId)
4327
+ ? globalThis.String(object.metricRuleId)
4328
+ : isSet(object.metric_rule_id)
4329
+ ? globalThis.String(object.metric_rule_id)
4330
+ : "",
4331
+ organizationId: isSet(object.organizationId)
4332
+ ? globalThis.String(object.organizationId)
4333
+ : isSet(object.organization_id)
4334
+ ? globalThis.String(object.organization_id)
4335
+ : "",
4336
+ };
4337
+ },
4338
+
4339
+ toJSON(message: DeleteMetricRuleRequest): unknown {
4340
+ const obj: any = {};
4341
+ if (message.projectId !== "") {
4342
+ obj.projectId = message.projectId;
4343
+ }
4344
+ if (message.metricRuleId !== "") {
4345
+ obj.metricRuleId = message.metricRuleId;
4346
+ }
4347
+ if (message.organizationId !== "") {
4348
+ obj.organizationId = message.organizationId;
4349
+ }
4350
+ return obj;
4351
+ },
4352
+
4353
+ create<I extends Exact<DeepPartial<DeleteMetricRuleRequest>, I>>(base?: I): DeleteMetricRuleRequest {
4354
+ return DeleteMetricRuleRequest.fromPartial(base ?? ({} as any));
4355
+ },
4356
+ fromPartial<I extends Exact<DeepPartial<DeleteMetricRuleRequest>, I>>(object: I): DeleteMetricRuleRequest {
4357
+ const message = createBaseDeleteMetricRuleRequest();
4358
+ message.projectId = object.projectId ?? "";
4359
+ message.metricRuleId = object.metricRuleId ?? "";
4360
+ message.organizationId = object.organizationId ?? "";
4361
+ return message;
4362
+ },
4363
+ };
4364
+
4365
+ function createBaseDeleteMetricRuleResponse(): DeleteMetricRuleResponse {
4366
+ return { status: undefined };
4367
+ }
4368
+
4369
+ export const DeleteMetricRuleResponse: MessageFns<DeleteMetricRuleResponse> = {
4370
+ encode(message: DeleteMetricRuleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4371
+ if (message.status !== undefined) {
4372
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
4373
+ }
4374
+ return writer;
4375
+ },
4376
+
4377
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteMetricRuleResponse {
4378
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4379
+ const end = length === undefined ? reader.len : reader.pos + length;
4380
+ const message = createBaseDeleteMetricRuleResponse();
4381
+ while (reader.pos < end) {
4382
+ const tag = reader.uint32();
4383
+ switch (tag >>> 3) {
4384
+ case 1: {
4385
+ if (tag !== 10) {
4386
+ break;
4387
+ }
4388
+
4389
+ message.status = ResponseStatus.decode(reader, reader.uint32());
4390
+ continue;
4391
+ }
4392
+ }
4393
+ if ((tag & 7) === 4 || tag === 0) {
4394
+ break;
4395
+ }
4396
+ reader.skip(tag & 7);
4397
+ }
4398
+ return message;
4399
+ },
4400
+
4401
+ fromJSON(object: any): DeleteMetricRuleResponse {
4402
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
4403
+ },
4404
+
4405
+ toJSON(message: DeleteMetricRuleResponse): unknown {
4406
+ const obj: any = {};
4407
+ if (message.status !== undefined) {
4408
+ obj.status = ResponseStatus.toJSON(message.status);
4409
+ }
4410
+ return obj;
4411
+ },
4412
+
4413
+ create<I extends Exact<DeepPartial<DeleteMetricRuleResponse>, I>>(base?: I): DeleteMetricRuleResponse {
4414
+ return DeleteMetricRuleResponse.fromPartial(base ?? ({} as any));
4415
+ },
4416
+ fromPartial<I extends Exact<DeepPartial<DeleteMetricRuleResponse>, I>>(object: I): DeleteMetricRuleResponse {
4417
+ const message = createBaseDeleteMetricRuleResponse();
4418
+ message.status = (object.status !== undefined && object.status !== null)
4419
+ ? ResponseStatus.fromPartial(object.status)
4420
+ : undefined;
4421
+ return message;
4422
+ },
4423
+ };
4424
+
4425
+ function createBasePreviewMetricRuleRequest(): PreviewMetricRuleRequest {
4426
+ return { projectId: "", expression: "", organizationId: "" };
4427
+ }
4428
+
4429
+ export const PreviewMetricRuleRequest: MessageFns<PreviewMetricRuleRequest> = {
4430
+ encode(message: PreviewMetricRuleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4431
+ if (message.projectId !== "") {
4432
+ writer.uint32(10).string(message.projectId);
4433
+ }
4434
+ if (message.expression !== "") {
4435
+ writer.uint32(18).string(message.expression);
4436
+ }
4437
+ if (message.organizationId !== "") {
4438
+ writer.uint32(26).string(message.organizationId);
4439
+ }
4440
+ return writer;
4441
+ },
4442
+
4443
+ decode(input: BinaryReader | Uint8Array, length?: number): PreviewMetricRuleRequest {
4444
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4445
+ const end = length === undefined ? reader.len : reader.pos + length;
4446
+ const message = createBasePreviewMetricRuleRequest();
4447
+ while (reader.pos < end) {
4448
+ const tag = reader.uint32();
4449
+ switch (tag >>> 3) {
4450
+ case 1: {
4451
+ if (tag !== 10) {
4452
+ break;
4453
+ }
4454
+
4455
+ message.projectId = reader.string();
4456
+ continue;
4457
+ }
4458
+ case 2: {
4459
+ if (tag !== 18) {
4460
+ break;
4461
+ }
4462
+
4463
+ message.expression = reader.string();
4464
+ continue;
4465
+ }
4466
+ case 3: {
4467
+ if (tag !== 26) {
4468
+ break;
4469
+ }
4470
+
4471
+ message.organizationId = reader.string();
4472
+ continue;
4473
+ }
4474
+ }
4475
+ if ((tag & 7) === 4 || tag === 0) {
4476
+ break;
4477
+ }
4478
+ reader.skip(tag & 7);
4479
+ }
4480
+ return message;
4481
+ },
4482
+
4483
+ fromJSON(object: any): PreviewMetricRuleRequest {
4484
+ return {
4485
+ projectId: isSet(object.projectId)
4486
+ ? globalThis.String(object.projectId)
4487
+ : isSet(object.project_id)
4488
+ ? globalThis.String(object.project_id)
4489
+ : "",
4490
+ expression: isSet(object.expression) ? globalThis.String(object.expression) : "",
4491
+ organizationId: isSet(object.organizationId)
4492
+ ? globalThis.String(object.organizationId)
4493
+ : isSet(object.organization_id)
4494
+ ? globalThis.String(object.organization_id)
4495
+ : "",
4496
+ };
4497
+ },
4498
+
4499
+ toJSON(message: PreviewMetricRuleRequest): unknown {
4500
+ const obj: any = {};
4501
+ if (message.projectId !== "") {
4502
+ obj.projectId = message.projectId;
4503
+ }
4504
+ if (message.expression !== "") {
4505
+ obj.expression = message.expression;
4506
+ }
4507
+ if (message.organizationId !== "") {
4508
+ obj.organizationId = message.organizationId;
4509
+ }
4510
+ return obj;
4511
+ },
4512
+
4513
+ create<I extends Exact<DeepPartial<PreviewMetricRuleRequest>, I>>(base?: I): PreviewMetricRuleRequest {
4514
+ return PreviewMetricRuleRequest.fromPartial(base ?? ({} as any));
4515
+ },
4516
+ fromPartial<I extends Exact<DeepPartial<PreviewMetricRuleRequest>, I>>(object: I): PreviewMetricRuleRequest {
4517
+ const message = createBasePreviewMetricRuleRequest();
4518
+ message.projectId = object.projectId ?? "";
4519
+ message.expression = object.expression ?? "";
4520
+ message.organizationId = object.organizationId ?? "";
4521
+ return message;
4522
+ },
4523
+ };
4524
+
4525
+ function createBasePreviewMetricRuleResponse(): PreviewMetricRuleResponse {
4526
+ return { status: undefined, value: undefined, wouldFire: false, state: "" };
4527
+ }
4528
+
4529
+ export const PreviewMetricRuleResponse: MessageFns<PreviewMetricRuleResponse> = {
4530
+ encode(message: PreviewMetricRuleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4531
+ if (message.status !== undefined) {
4532
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
4533
+ }
4534
+ if (message.value !== undefined) {
4535
+ writer.uint32(17).double(message.value);
4536
+ }
4537
+ if (message.wouldFire !== false) {
4538
+ writer.uint32(24).bool(message.wouldFire);
4539
+ }
4540
+ if (message.state !== "") {
4541
+ writer.uint32(34).string(message.state);
4542
+ }
4543
+ return writer;
4544
+ },
4545
+
4546
+ decode(input: BinaryReader | Uint8Array, length?: number): PreviewMetricRuleResponse {
4547
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4548
+ const end = length === undefined ? reader.len : reader.pos + length;
4549
+ const message = createBasePreviewMetricRuleResponse();
4550
+ while (reader.pos < end) {
4551
+ const tag = reader.uint32();
4552
+ switch (tag >>> 3) {
4553
+ case 1: {
4554
+ if (tag !== 10) {
4555
+ break;
4556
+ }
4557
+
4558
+ message.status = ResponseStatus.decode(reader, reader.uint32());
4559
+ continue;
4560
+ }
4561
+ case 2: {
4562
+ if (tag !== 17) {
4563
+ break;
4564
+ }
4565
+
4566
+ message.value = reader.double();
4567
+ continue;
4568
+ }
4569
+ case 3: {
4570
+ if (tag !== 24) {
4571
+ break;
4572
+ }
4573
+
4574
+ message.wouldFire = reader.bool();
4575
+ continue;
4576
+ }
4577
+ case 4: {
4578
+ if (tag !== 34) {
4579
+ break;
4580
+ }
4581
+
4582
+ message.state = reader.string();
4583
+ continue;
4584
+ }
4585
+ }
4586
+ if ((tag & 7) === 4 || tag === 0) {
4587
+ break;
4588
+ }
4589
+ reader.skip(tag & 7);
4590
+ }
4591
+ return message;
4592
+ },
4593
+
4594
+ fromJSON(object: any): PreviewMetricRuleResponse {
4595
+ return {
4596
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
4597
+ value: isSet(object.value) ? globalThis.Number(object.value) : undefined,
4598
+ wouldFire: isSet(object.wouldFire)
4599
+ ? globalThis.Boolean(object.wouldFire)
4600
+ : isSet(object.would_fire)
4601
+ ? globalThis.Boolean(object.would_fire)
4602
+ : false,
4603
+ state: isSet(object.state) ? globalThis.String(object.state) : "",
4604
+ };
4605
+ },
4606
+
4607
+ toJSON(message: PreviewMetricRuleResponse): unknown {
4608
+ const obj: any = {};
4609
+ if (message.status !== undefined) {
4610
+ obj.status = ResponseStatus.toJSON(message.status);
4611
+ }
4612
+ if (message.value !== undefined) {
4613
+ obj.value = message.value;
4614
+ }
4615
+ if (message.wouldFire !== false) {
4616
+ obj.wouldFire = message.wouldFire;
4617
+ }
4618
+ if (message.state !== "") {
4619
+ obj.state = message.state;
4620
+ }
4621
+ return obj;
4622
+ },
4623
+
4624
+ create<I extends Exact<DeepPartial<PreviewMetricRuleResponse>, I>>(base?: I): PreviewMetricRuleResponse {
4625
+ return PreviewMetricRuleResponse.fromPartial(base ?? ({} as any));
4626
+ },
4627
+ fromPartial<I extends Exact<DeepPartial<PreviewMetricRuleResponse>, I>>(object: I): PreviewMetricRuleResponse {
4628
+ const message = createBasePreviewMetricRuleResponse();
4629
+ message.status = (object.status !== undefined && object.status !== null)
4630
+ ? ResponseStatus.fromPartial(object.status)
4631
+ : undefined;
4632
+ message.value = object.value ?? undefined;
4633
+ message.wouldFire = object.wouldFire ?? false;
4634
+ message.state = object.state ?? "";
4635
+ return message;
4636
+ },
4637
+ };
4638
+
4639
+ function createBaseStreamMetricRuleActivityRequest(): StreamMetricRuleActivityRequest {
4640
+ return { projectId: "", organizationId: "", limit: 0 };
4641
+ }
4642
+
4643
+ export const StreamMetricRuleActivityRequest: MessageFns<StreamMetricRuleActivityRequest> = {
4644
+ encode(message: StreamMetricRuleActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4645
+ if (message.projectId !== "") {
4646
+ writer.uint32(10).string(message.projectId);
4647
+ }
4648
+ if (message.organizationId !== "") {
4649
+ writer.uint32(18).string(message.organizationId);
4650
+ }
4651
+ if (message.limit !== 0) {
4652
+ writer.uint32(24).int32(message.limit);
4653
+ }
4654
+ return writer;
4655
+ },
4656
+
4657
+ decode(input: BinaryReader | Uint8Array, length?: number): StreamMetricRuleActivityRequest {
4658
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4659
+ const end = length === undefined ? reader.len : reader.pos + length;
4660
+ const message = createBaseStreamMetricRuleActivityRequest();
4661
+ while (reader.pos < end) {
4662
+ const tag = reader.uint32();
4663
+ switch (tag >>> 3) {
4664
+ case 1: {
4665
+ if (tag !== 10) {
4666
+ break;
4667
+ }
4668
+
4669
+ message.projectId = reader.string();
4670
+ continue;
4671
+ }
4672
+ case 2: {
4673
+ if (tag !== 18) {
4674
+ break;
4675
+ }
4676
+
4677
+ message.organizationId = reader.string();
4678
+ continue;
4679
+ }
4680
+ case 3: {
4681
+ if (tag !== 24) {
4682
+ break;
4683
+ }
4684
+
4685
+ message.limit = reader.int32();
4686
+ continue;
4687
+ }
4688
+ }
4689
+ if ((tag & 7) === 4 || tag === 0) {
4690
+ break;
4691
+ }
4692
+ reader.skip(tag & 7);
4693
+ }
4694
+ return message;
4695
+ },
4696
+
4697
+ fromJSON(object: any): StreamMetricRuleActivityRequest {
4698
+ return {
4699
+ projectId: isSet(object.projectId)
4700
+ ? globalThis.String(object.projectId)
4701
+ : isSet(object.project_id)
4702
+ ? globalThis.String(object.project_id)
4703
+ : "",
4704
+ organizationId: isSet(object.organizationId)
4705
+ ? globalThis.String(object.organizationId)
4706
+ : isSet(object.organization_id)
4707
+ ? globalThis.String(object.organization_id)
4708
+ : "",
4709
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
4710
+ };
4711
+ },
4712
+
4713
+ toJSON(message: StreamMetricRuleActivityRequest): unknown {
4714
+ const obj: any = {};
4715
+ if (message.projectId !== "") {
4716
+ obj.projectId = message.projectId;
4717
+ }
4718
+ if (message.organizationId !== "") {
4719
+ obj.organizationId = message.organizationId;
4720
+ }
4721
+ if (message.limit !== 0) {
4722
+ obj.limit = Math.round(message.limit);
4723
+ }
4724
+ return obj;
4725
+ },
4726
+
4727
+ create<I extends Exact<DeepPartial<StreamMetricRuleActivityRequest>, I>>(base?: I): StreamMetricRuleActivityRequest {
4728
+ return StreamMetricRuleActivityRequest.fromPartial(base ?? ({} as any));
4729
+ },
4730
+ fromPartial<I extends Exact<DeepPartial<StreamMetricRuleActivityRequest>, I>>(
4731
+ object: I,
4732
+ ): StreamMetricRuleActivityRequest {
4733
+ const message = createBaseStreamMetricRuleActivityRequest();
4734
+ message.projectId = object.projectId ?? "";
4735
+ message.organizationId = object.organizationId ?? "";
4736
+ message.limit = object.limit ?? 0;
4737
+ return message;
4738
+ },
4739
+ };
4740
+
4741
+ function createBaseMetricRuleActivityEnvelope(): MetricRuleActivityEnvelope {
4742
+ return { snapshot: undefined, update: undefined };
4743
+ }
4744
+
4745
+ export const MetricRuleActivityEnvelope: MessageFns<MetricRuleActivityEnvelope> = {
4746
+ encode(message: MetricRuleActivityEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4747
+ if (message.snapshot !== undefined) {
4748
+ MetricRuleActivitySnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
4749
+ }
4750
+ if (message.update !== undefined) {
4751
+ MetricRuleActivityEvent.encode(message.update, writer.uint32(18).fork()).join();
4752
+ }
4753
+ return writer;
4754
+ },
4755
+
4756
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricRuleActivityEnvelope {
4757
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4758
+ const end = length === undefined ? reader.len : reader.pos + length;
4759
+ const message = createBaseMetricRuleActivityEnvelope();
4760
+ while (reader.pos < end) {
4761
+ const tag = reader.uint32();
4762
+ switch (tag >>> 3) {
4763
+ case 1: {
4764
+ if (tag !== 10) {
4765
+ break;
4766
+ }
4767
+
4768
+ message.snapshot = MetricRuleActivitySnapshot.decode(reader, reader.uint32());
4769
+ continue;
4770
+ }
4771
+ case 2: {
4772
+ if (tag !== 18) {
4773
+ break;
4774
+ }
4775
+
4776
+ message.update = MetricRuleActivityEvent.decode(reader, reader.uint32());
4777
+ continue;
4778
+ }
4779
+ }
4780
+ if ((tag & 7) === 4 || tag === 0) {
2694
4781
  break;
2695
4782
  }
2696
4783
  reader.skip(tag & 7);
@@ -2698,34 +4785,319 @@ export const TraceRuleMatchEvent_EntityContext_TraceContext: MessageFns<
2698
4785
  return message;
2699
4786
  },
2700
4787
 
2701
- fromJSON(object: any): TraceRuleMatchEvent_EntityContext_TraceContext {
4788
+ fromJSON(object: any): MetricRuleActivityEnvelope {
2702
4789
  return {
2703
- traceId: isSet(object.traceId)
2704
- ? globalThis.String(object.traceId)
2705
- : isSet(object.trace_id)
2706
- ? globalThis.String(object.trace_id)
4790
+ snapshot: isSet(object.snapshot) ? MetricRuleActivitySnapshot.fromJSON(object.snapshot) : undefined,
4791
+ update: isSet(object.update) ? MetricRuleActivityEvent.fromJSON(object.update) : undefined,
4792
+ };
4793
+ },
4794
+
4795
+ toJSON(message: MetricRuleActivityEnvelope): unknown {
4796
+ const obj: any = {};
4797
+ if (message.snapshot !== undefined) {
4798
+ obj.snapshot = MetricRuleActivitySnapshot.toJSON(message.snapshot);
4799
+ }
4800
+ if (message.update !== undefined) {
4801
+ obj.update = MetricRuleActivityEvent.toJSON(message.update);
4802
+ }
4803
+ return obj;
4804
+ },
4805
+
4806
+ create<I extends Exact<DeepPartial<MetricRuleActivityEnvelope>, I>>(base?: I): MetricRuleActivityEnvelope {
4807
+ return MetricRuleActivityEnvelope.fromPartial(base ?? ({} as any));
4808
+ },
4809
+ fromPartial<I extends Exact<DeepPartial<MetricRuleActivityEnvelope>, I>>(object: I): MetricRuleActivityEnvelope {
4810
+ const message = createBaseMetricRuleActivityEnvelope();
4811
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
4812
+ ? MetricRuleActivitySnapshot.fromPartial(object.snapshot)
4813
+ : undefined;
4814
+ message.update = (object.update !== undefined && object.update !== null)
4815
+ ? MetricRuleActivityEvent.fromPartial(object.update)
4816
+ : undefined;
4817
+ return message;
4818
+ },
4819
+ };
4820
+
4821
+ function createBaseMetricRuleActivitySnapshot(): MetricRuleActivitySnapshot {
4822
+ return { activities: [] };
4823
+ }
4824
+
4825
+ export const MetricRuleActivitySnapshot: MessageFns<MetricRuleActivitySnapshot> = {
4826
+ encode(message: MetricRuleActivitySnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4827
+ for (const v of message.activities) {
4828
+ MetricRuleActivityEvent.encode(v!, writer.uint32(10).fork()).join();
4829
+ }
4830
+ return writer;
4831
+ },
4832
+
4833
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricRuleActivitySnapshot {
4834
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4835
+ const end = length === undefined ? reader.len : reader.pos + length;
4836
+ const message = createBaseMetricRuleActivitySnapshot();
4837
+ while (reader.pos < end) {
4838
+ const tag = reader.uint32();
4839
+ switch (tag >>> 3) {
4840
+ case 1: {
4841
+ if (tag !== 10) {
4842
+ break;
4843
+ }
4844
+
4845
+ message.activities.push(MetricRuleActivityEvent.decode(reader, reader.uint32()));
4846
+ continue;
4847
+ }
4848
+ }
4849
+ if ((tag & 7) === 4 || tag === 0) {
4850
+ break;
4851
+ }
4852
+ reader.skip(tag & 7);
4853
+ }
4854
+ return message;
4855
+ },
4856
+
4857
+ fromJSON(object: any): MetricRuleActivitySnapshot {
4858
+ return {
4859
+ activities: globalThis.Array.isArray(object?.activities)
4860
+ ? object.activities.map((e: any) => MetricRuleActivityEvent.fromJSON(e))
4861
+ : [],
4862
+ };
4863
+ },
4864
+
4865
+ toJSON(message: MetricRuleActivitySnapshot): unknown {
4866
+ const obj: any = {};
4867
+ if (message.activities?.length) {
4868
+ obj.activities = message.activities.map((e) => MetricRuleActivityEvent.toJSON(e));
4869
+ }
4870
+ return obj;
4871
+ },
4872
+
4873
+ create<I extends Exact<DeepPartial<MetricRuleActivitySnapshot>, I>>(base?: I): MetricRuleActivitySnapshot {
4874
+ return MetricRuleActivitySnapshot.fromPartial(base ?? ({} as any));
4875
+ },
4876
+ fromPartial<I extends Exact<DeepPartial<MetricRuleActivitySnapshot>, I>>(object: I): MetricRuleActivitySnapshot {
4877
+ const message = createBaseMetricRuleActivitySnapshot();
4878
+ message.activities = object.activities?.map((e) => MetricRuleActivityEvent.fromPartial(e)) || [];
4879
+ return message;
4880
+ },
4881
+ };
4882
+
4883
+ function createBaseMetricRuleActivityEvent(): MetricRuleActivityEvent {
4884
+ return {
4885
+ activityId: "",
4886
+ ruleId: "",
4887
+ ruleName: "",
4888
+ type: 0,
4889
+ incidentId: "",
4890
+ expression: "",
4891
+ observedValue: 0,
4892
+ severity: 0,
4893
+ occurredAt: undefined,
4894
+ };
4895
+ }
4896
+
4897
+ export const MetricRuleActivityEvent: MessageFns<MetricRuleActivityEvent> = {
4898
+ encode(message: MetricRuleActivityEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4899
+ if (message.activityId !== "") {
4900
+ writer.uint32(10).string(message.activityId);
4901
+ }
4902
+ if (message.ruleId !== "") {
4903
+ writer.uint32(18).string(message.ruleId);
4904
+ }
4905
+ if (message.ruleName !== "") {
4906
+ writer.uint32(26).string(message.ruleName);
4907
+ }
4908
+ if (message.type !== 0) {
4909
+ writer.uint32(32).int32(message.type);
4910
+ }
4911
+ if (message.incidentId !== "") {
4912
+ writer.uint32(42).string(message.incidentId);
4913
+ }
4914
+ if (message.expression !== "") {
4915
+ writer.uint32(50).string(message.expression);
4916
+ }
4917
+ if (message.observedValue !== 0) {
4918
+ writer.uint32(57).double(message.observedValue);
4919
+ }
4920
+ if (message.severity !== 0) {
4921
+ writer.uint32(64).int32(message.severity);
4922
+ }
4923
+ if (message.occurredAt !== undefined) {
4924
+ Timestamp.encode(toTimestamp(message.occurredAt), writer.uint32(74).fork()).join();
4925
+ }
4926
+ return writer;
4927
+ },
4928
+
4929
+ decode(input: BinaryReader | Uint8Array, length?: number): MetricRuleActivityEvent {
4930
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4931
+ const end = length === undefined ? reader.len : reader.pos + length;
4932
+ const message = createBaseMetricRuleActivityEvent();
4933
+ while (reader.pos < end) {
4934
+ const tag = reader.uint32();
4935
+ switch (tag >>> 3) {
4936
+ case 1: {
4937
+ if (tag !== 10) {
4938
+ break;
4939
+ }
4940
+
4941
+ message.activityId = reader.string();
4942
+ continue;
4943
+ }
4944
+ case 2: {
4945
+ if (tag !== 18) {
4946
+ break;
4947
+ }
4948
+
4949
+ message.ruleId = reader.string();
4950
+ continue;
4951
+ }
4952
+ case 3: {
4953
+ if (tag !== 26) {
4954
+ break;
4955
+ }
4956
+
4957
+ message.ruleName = reader.string();
4958
+ continue;
4959
+ }
4960
+ case 4: {
4961
+ if (tag !== 32) {
4962
+ break;
4963
+ }
4964
+
4965
+ message.type = reader.int32() as any;
4966
+ continue;
4967
+ }
4968
+ case 5: {
4969
+ if (tag !== 42) {
4970
+ break;
4971
+ }
4972
+
4973
+ message.incidentId = reader.string();
4974
+ continue;
4975
+ }
4976
+ case 6: {
4977
+ if (tag !== 50) {
4978
+ break;
4979
+ }
4980
+
4981
+ message.expression = reader.string();
4982
+ continue;
4983
+ }
4984
+ case 7: {
4985
+ if (tag !== 57) {
4986
+ break;
4987
+ }
4988
+
4989
+ message.observedValue = reader.double();
4990
+ continue;
4991
+ }
4992
+ case 8: {
4993
+ if (tag !== 64) {
4994
+ break;
4995
+ }
4996
+
4997
+ message.severity = reader.int32() as any;
4998
+ continue;
4999
+ }
5000
+ case 9: {
5001
+ if (tag !== 74) {
5002
+ break;
5003
+ }
5004
+
5005
+ message.occurredAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5006
+ continue;
5007
+ }
5008
+ }
5009
+ if ((tag & 7) === 4 || tag === 0) {
5010
+ break;
5011
+ }
5012
+ reader.skip(tag & 7);
5013
+ }
5014
+ return message;
5015
+ },
5016
+
5017
+ fromJSON(object: any): MetricRuleActivityEvent {
5018
+ return {
5019
+ activityId: isSet(object.activityId)
5020
+ ? globalThis.String(object.activityId)
5021
+ : isSet(object.activity_id)
5022
+ ? globalThis.String(object.activity_id)
5023
+ : "",
5024
+ ruleId: isSet(object.ruleId)
5025
+ ? globalThis.String(object.ruleId)
5026
+ : isSet(object.rule_id)
5027
+ ? globalThis.String(object.rule_id)
2707
5028
  : "",
5029
+ ruleName: isSet(object.ruleName)
5030
+ ? globalThis.String(object.ruleName)
5031
+ : isSet(object.rule_name)
5032
+ ? globalThis.String(object.rule_name)
5033
+ : "",
5034
+ type: isSet(object.type) ? metricActivityTypeFromJSON(object.type) : 0,
5035
+ incidentId: isSet(object.incidentId)
5036
+ ? globalThis.String(object.incidentId)
5037
+ : isSet(object.incident_id)
5038
+ ? globalThis.String(object.incident_id)
5039
+ : "",
5040
+ expression: isSet(object.expression) ? globalThis.String(object.expression) : "",
5041
+ observedValue: isSet(object.observedValue)
5042
+ ? globalThis.Number(object.observedValue)
5043
+ : isSet(object.observed_value)
5044
+ ? globalThis.Number(object.observed_value)
5045
+ : 0,
5046
+ severity: isSet(object.severity) ? severityFromJSON(object.severity) : 0,
5047
+ occurredAt: isSet(object.occurredAt)
5048
+ ? fromJsonTimestamp(object.occurredAt)
5049
+ : isSet(object.occurred_at)
5050
+ ? fromJsonTimestamp(object.occurred_at)
5051
+ : undefined,
2708
5052
  };
2709
5053
  },
2710
5054
 
2711
- toJSON(message: TraceRuleMatchEvent_EntityContext_TraceContext): unknown {
5055
+ toJSON(message: MetricRuleActivityEvent): unknown {
2712
5056
  const obj: any = {};
2713
- if (message.traceId !== "") {
2714
- obj.traceId = message.traceId;
5057
+ if (message.activityId !== "") {
5058
+ obj.activityId = message.activityId;
5059
+ }
5060
+ if (message.ruleId !== "") {
5061
+ obj.ruleId = message.ruleId;
5062
+ }
5063
+ if (message.ruleName !== "") {
5064
+ obj.ruleName = message.ruleName;
5065
+ }
5066
+ if (message.type !== 0) {
5067
+ obj.type = metricActivityTypeToJSON(message.type);
5068
+ }
5069
+ if (message.incidentId !== "") {
5070
+ obj.incidentId = message.incidentId;
5071
+ }
5072
+ if (message.expression !== "") {
5073
+ obj.expression = message.expression;
5074
+ }
5075
+ if (message.observedValue !== 0) {
5076
+ obj.observedValue = message.observedValue;
5077
+ }
5078
+ if (message.severity !== 0) {
5079
+ obj.severity = severityToJSON(message.severity);
5080
+ }
5081
+ if (message.occurredAt !== undefined) {
5082
+ obj.occurredAt = message.occurredAt.toISOString();
2715
5083
  }
2716
5084
  return obj;
2717
5085
  },
2718
5086
 
2719
- create<I extends Exact<DeepPartial<TraceRuleMatchEvent_EntityContext_TraceContext>, I>>(
2720
- base?: I,
2721
- ): TraceRuleMatchEvent_EntityContext_TraceContext {
2722
- return TraceRuleMatchEvent_EntityContext_TraceContext.fromPartial(base ?? ({} as any));
5087
+ create<I extends Exact<DeepPartial<MetricRuleActivityEvent>, I>>(base?: I): MetricRuleActivityEvent {
5088
+ return MetricRuleActivityEvent.fromPartial(base ?? ({} as any));
2723
5089
  },
2724
- fromPartial<I extends Exact<DeepPartial<TraceRuleMatchEvent_EntityContext_TraceContext>, I>>(
2725
- object: I,
2726
- ): TraceRuleMatchEvent_EntityContext_TraceContext {
2727
- const message = createBaseTraceRuleMatchEvent_EntityContext_TraceContext();
2728
- message.traceId = object.traceId ?? "";
5090
+ fromPartial<I extends Exact<DeepPartial<MetricRuleActivityEvent>, I>>(object: I): MetricRuleActivityEvent {
5091
+ const message = createBaseMetricRuleActivityEvent();
5092
+ message.activityId = object.activityId ?? "";
5093
+ message.ruleId = object.ruleId ?? "";
5094
+ message.ruleName = object.ruleName ?? "";
5095
+ message.type = object.type ?? 0;
5096
+ message.incidentId = object.incidentId ?? "";
5097
+ message.expression = object.expression ?? "";
5098
+ message.observedValue = object.observedValue ?? 0;
5099
+ message.severity = object.severity ?? 0;
5100
+ message.occurredAt = object.occurredAt ?? undefined;
2729
5101
  return message;
2730
5102
  },
2731
5103
  };
@@ -2754,13 +5126,28 @@ export interface RuleGatewayService {
2754
5126
  metadata?: Metadata,
2755
5127
  ): Promise<ListTraceRuleSchemasResponse>;
2756
5128
  /**
2757
- * StreamTraceRuleMatches sends an initial snapshot of recent trace-rule
2758
- * matches followed by live updates as new matches occur.
5129
+ * StreamTraceRuleActivity sends a snapshot of recent trace-rule matches
5130
+ * followed by live matches.
5131
+ */
5132
+ StreamTraceRuleActivity(
5133
+ request: StreamTraceRuleActivityRequest,
5134
+ metadata?: Metadata,
5135
+ ): Observable<TraceRuleActivityEnvelope>;
5136
+ /** Metric rule operations (PromQL threshold alerting) */
5137
+ CreateMetricRule(request: CreateMetricRuleRequest, metadata?: Metadata): Promise<CreateMetricRuleResponse>;
5138
+ GetMetricRule(request: GetMetricRuleRequest, metadata?: Metadata): Promise<GetMetricRuleResponse>;
5139
+ ListMetricRules(request: ListMetricRulesRequest, metadata?: Metadata): Promise<ListMetricRulesResponse>;
5140
+ UpdateMetricRule(request: UpdateMetricRuleRequest, metadata?: Metadata): Promise<UpdateMetricRuleResponse>;
5141
+ DeleteMetricRule(request: DeleteMetricRuleRequest, metadata?: Metadata): Promise<DeleteMetricRuleResponse>;
5142
+ PreviewMetricRule(request: PreviewMetricRuleRequest, metadata?: Metadata): Promise<PreviewMetricRuleResponse>;
5143
+ /**
5144
+ * StreamMetricRuleActivity sends a snapshot of recent metric-rule firings and
5145
+ * recoveries followed by live transitions.
2759
5146
  */
2760
- StreamTraceRuleMatches(
2761
- request: StreamTraceRuleMatchesRequest,
5147
+ StreamMetricRuleActivity(
5148
+ request: StreamMetricRuleActivityRequest,
2762
5149
  metadata?: Metadata,
2763
- ): Observable<TraceRuleMatchEnvelope>;
5150
+ ): Observable<MetricRuleActivityEnvelope>;
2764
5151
  }
2765
5152
 
2766
5153
  export const RuleGatewayServiceServiceName = "gateway.web.v1.RuleGatewayService";
@@ -2777,7 +5164,14 @@ export class RuleGatewayServiceClientImpl implements RuleGatewayService {
2777
5164
  this.DeleteTraceRule = this.DeleteTraceRule.bind(this);
2778
5165
  this.StreamTraceRuleSimulation = this.StreamTraceRuleSimulation.bind(this);
2779
5166
  this.ListTraceRuleSchemas = this.ListTraceRuleSchemas.bind(this);
2780
- this.StreamTraceRuleMatches = this.StreamTraceRuleMatches.bind(this);
5167
+ this.StreamTraceRuleActivity = this.StreamTraceRuleActivity.bind(this);
5168
+ this.CreateMetricRule = this.CreateMetricRule.bind(this);
5169
+ this.GetMetricRule = this.GetMetricRule.bind(this);
5170
+ this.ListMetricRules = this.ListMetricRules.bind(this);
5171
+ this.UpdateMetricRule = this.UpdateMetricRule.bind(this);
5172
+ this.DeleteMetricRule = this.DeleteMetricRule.bind(this);
5173
+ this.PreviewMetricRule = this.PreviewMetricRule.bind(this);
5174
+ this.StreamMetricRuleActivity = this.StreamMetricRuleActivity.bind(this);
2781
5175
  }
2782
5176
  CreateTraceRule(request: CreateTraceRuleRequest, metadata?: Metadata): Promise<CreateTraceRuleResponse> {
2783
5177
  const data = CreateTraceRuleRequest.encode(request).finish();
@@ -2827,13 +5221,58 @@ export class RuleGatewayServiceClientImpl implements RuleGatewayService {
2827
5221
  return promise.then((data) => ListTraceRuleSchemasResponse.decode(new BinaryReader(data)));
2828
5222
  }
2829
5223
 
2830
- StreamTraceRuleMatches(
2831
- request: StreamTraceRuleMatchesRequest,
5224
+ StreamTraceRuleActivity(
5225
+ request: StreamTraceRuleActivityRequest,
5226
+ metadata?: Metadata,
5227
+ ): Observable<TraceRuleActivityEnvelope> {
5228
+ const data = StreamTraceRuleActivityRequest.encode(request).finish();
5229
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamTraceRuleActivity", data, metadata);
5230
+ return result.pipe(map((data) => TraceRuleActivityEnvelope.decode(new BinaryReader(data))));
5231
+ }
5232
+
5233
+ CreateMetricRule(request: CreateMetricRuleRequest, metadata?: Metadata): Promise<CreateMetricRuleResponse> {
5234
+ const data = CreateMetricRuleRequest.encode(request).finish();
5235
+ const promise = this.rpc.request(this.service, "CreateMetricRule", data, metadata);
5236
+ return promise.then((data) => CreateMetricRuleResponse.decode(new BinaryReader(data)));
5237
+ }
5238
+
5239
+ GetMetricRule(request: GetMetricRuleRequest, metadata?: Metadata): Promise<GetMetricRuleResponse> {
5240
+ const data = GetMetricRuleRequest.encode(request).finish();
5241
+ const promise = this.rpc.request(this.service, "GetMetricRule", data, metadata);
5242
+ return promise.then((data) => GetMetricRuleResponse.decode(new BinaryReader(data)));
5243
+ }
5244
+
5245
+ ListMetricRules(request: ListMetricRulesRequest, metadata?: Metadata): Promise<ListMetricRulesResponse> {
5246
+ const data = ListMetricRulesRequest.encode(request).finish();
5247
+ const promise = this.rpc.request(this.service, "ListMetricRules", data, metadata);
5248
+ return promise.then((data) => ListMetricRulesResponse.decode(new BinaryReader(data)));
5249
+ }
5250
+
5251
+ UpdateMetricRule(request: UpdateMetricRuleRequest, metadata?: Metadata): Promise<UpdateMetricRuleResponse> {
5252
+ const data = UpdateMetricRuleRequest.encode(request).finish();
5253
+ const promise = this.rpc.request(this.service, "UpdateMetricRule", data, metadata);
5254
+ return promise.then((data) => UpdateMetricRuleResponse.decode(new BinaryReader(data)));
5255
+ }
5256
+
5257
+ DeleteMetricRule(request: DeleteMetricRuleRequest, metadata?: Metadata): Promise<DeleteMetricRuleResponse> {
5258
+ const data = DeleteMetricRuleRequest.encode(request).finish();
5259
+ const promise = this.rpc.request(this.service, "DeleteMetricRule", data, metadata);
5260
+ return promise.then((data) => DeleteMetricRuleResponse.decode(new BinaryReader(data)));
5261
+ }
5262
+
5263
+ PreviewMetricRule(request: PreviewMetricRuleRequest, metadata?: Metadata): Promise<PreviewMetricRuleResponse> {
5264
+ const data = PreviewMetricRuleRequest.encode(request).finish();
5265
+ const promise = this.rpc.request(this.service, "PreviewMetricRule", data, metadata);
5266
+ return promise.then((data) => PreviewMetricRuleResponse.decode(new BinaryReader(data)));
5267
+ }
5268
+
5269
+ StreamMetricRuleActivity(
5270
+ request: StreamMetricRuleActivityRequest,
2832
5271
  metadata?: Metadata,
2833
- ): Observable<TraceRuleMatchEnvelope> {
2834
- const data = StreamTraceRuleMatchesRequest.encode(request).finish();
2835
- const result = this.rpc.serverStreamingRequest(this.service, "StreamTraceRuleMatches", data, metadata);
2836
- return result.pipe(map((data) => TraceRuleMatchEnvelope.decode(new BinaryReader(data))));
5272
+ ): Observable<MetricRuleActivityEnvelope> {
5273
+ const data = StreamMetricRuleActivityRequest.encode(request).finish();
5274
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamMetricRuleActivity", data, metadata);
5275
+ return result.pipe(map((data) => MetricRuleActivityEnvelope.decode(new BinaryReader(data))));
2837
5276
  }
2838
5277
  }
2839
5278
 
@@ -2893,6 +5332,17 @@ function fromJsonTimestamp(o: any): Date {
2893
5332
  }
2894
5333
  }
2895
5334
 
5335
+ function longToNumber(int64: { toString(): string }): number {
5336
+ const num = globalThis.Number(int64.toString());
5337
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
5338
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
5339
+ }
5340
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
5341
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
5342
+ }
5343
+ return num;
5344
+ }
5345
+
2896
5346
  function isSet(value: any): boolean {
2897
5347
  return value !== null && value !== undefined;
2898
5348
  }