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