@hiiretail/gcp-infra-cli 0.102.5 → 0.103.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.
@@ -77,29 +77,12 @@ module.exports = class extends BaseGenerator {
77
77
  message: 'Please provide the project ID:',
78
78
  validate: required && validate.projectId,
79
79
  },
80
- {
81
- when: (response) => ['uptime-checks', 'alerts'].includes(response.monitoringResource),
82
- type: 'input',
83
- name: 'systemName',
84
- message: 'Please provide three-letter system name (ex: sre, pnp, iam...):',
85
- default: () => {
86
- const gitPath = path.resolve(process.cwd(), '.git');
87
- if (fs.existsSync(gitPath)) {
88
- const repoName = path.basename(process.cwd());
89
- const regex = /-([a-z]{3})-/i;
90
- const match = regex.exec(repoName);
91
- return match ? match[1] : '';
92
- }
93
- return '';
94
- },
95
- validate: required && validate.systemName,
96
- },
97
80
  {
98
81
  when: (response) => response.monitoringResource === 'uptime-checks',
99
82
  type: 'input',
100
83
  name: 'serviceName',
101
84
  message: 'Please provide the namespace where the service resides:',
102
- default: (response) => `${response.systemName}-service`,
85
+ default: (response) => `${response.clan}-service`,
103
86
  validate: required && validate.serviceName,
104
87
  },
105
88
  {
@@ -1,3 +1,121 @@
1
+ cloud_function:
2
+ failed_execution:
3
+ display_name: "[P2] <%-clan%> - Cloud Function | Failed job execution"
4
+ conditions:
5
+ - display_name: Cloud Function - Execution error count
6
+ condition_threshold:
7
+ filter: |
8
+ resource.type="cloud_function"
9
+ metric.type="cloudfunctions.googleapis.com/function/execution_count"
10
+ metric.label.status!="ok"
11
+ resource.labels.project_id="<%-projectId%>"
12
+ threshold_value: 0
13
+ duration: 60s
14
+ aggregations:
15
+ - alignment_period: 60s
16
+ per_series_aligner: ALIGN_COUNT
17
+ group_by_fields:
18
+ - metric.label.status
19
+ - resource.label.function_name
20
+ documentation:
21
+ subject: 'Function: `$${resource.label.function_name}`'
22
+ cloud_run:
23
+ error_count:
24
+ display_name: "[P3] <%-clan%> - Cloud Run | Error rate"
25
+ conditions:
26
+ - display_name: Error rate above threshold for more than 5 minutes
27
+ condition_threshold:
28
+ filter: |
29
+ resource.type="cloud_run_revision"
30
+ metric.type="run.googleapis.com/request_count"
31
+ metric.label.response_code_class="5xx"
32
+ resource.labels.project_id="<%-projectId%>"
33
+ threshold_value: 0.05
34
+ duration: 300s
35
+ aggregations:
36
+ - alignment_period: 60s
37
+ per_series_aligner: ALIGN_RATE
38
+ cross_series_reducer: REDUCE_SUM
39
+ group_by_fields:
40
+ - resource.label.service_name
41
+ documentation:
42
+ subject: 'Service: `$${resource.label.service_name}`'
43
+ request_latency:
44
+ display_name: "[P3] <%-clan%> - Cloud Run | Request Latency"
45
+ conditions:
46
+ - display_name: Request latency (p95) above threshold for more than 5 minutes
47
+ condition_threshold:
48
+ filter: |
49
+ resource.type="cloud_run_revision"
50
+ metric.type="run.googleapis.com/request_latencies"
51
+ resource.labels.project_id="<%-projectId%>"
52
+ threshold_value: 500
53
+ duration: 300s
54
+ aggregations:
55
+ - alignment_period: 60s
56
+ per_series_aligner: ALIGN_DELTA
57
+ cross_series_reducer: REDUCE_PERCENTILE_95
58
+ group_by_fields:
59
+ - resource.label.service_name
60
+ documentation:
61
+ subject: 'Service: `$${resource.label.service_name}`'
62
+ cpu_utilization:
63
+ display_name: "[P3] <%-clan%> - Cloud Run | CPU Utilization"
64
+ conditions:
65
+ - display_name: CPU utilization above threshold for more than 5 minutes
66
+ condition_threshold:
67
+ filter: |
68
+ resource.type="cloud_run_revision"
69
+ metric.type="run.googleapis.com/container/cpu/utilizations"
70
+ resource.labels.project_id="<%-projectId%>"
71
+ threshold_value: 0.8
72
+ duration: 300s
73
+ aggregations:
74
+ - alignment_period: 60s
75
+ per_series_aligner: ALIGN_MEAN
76
+ cross_series_reducer: REDUCE_PERCENTILE_99
77
+ group_by_fields:
78
+ - resource.label.service_name
79
+ documentation:
80
+ subject: 'Service: `$${resource.label.service_name}`'
81
+ memory_utilization:
82
+ display_name: "[P3] <%-clan%> - Cloud Run | Memory Utilization"
83
+ conditions:
84
+ - display_name: Memory utilization above threshold for more than 5 minutes
85
+ condition_threshold:
86
+ filter: |
87
+ resource.type="cloud_run_revision"
88
+ metric.type="run.googleapis.com/container/memory/utilizations"
89
+ resource.labels.project_id="<%-projectId%>"
90
+ threshold_value: 0.8
91
+ duration: 300s
92
+ aggregations:
93
+ - alignment_period: 60s
94
+ per_series_aligner: ALIGN_MEAN
95
+ cross_series_reducer: REDUCE_PERCENTILE_99
96
+ group_by_fields:
97
+ - resource.label.service_name
98
+ documentation:
99
+ subject: 'Service: `$${resource.label.service_name}`'
100
+ startup_latency:
101
+ display_name: "[P4] <%-clan%> - Cloud Run | Startup Latency"
102
+ conditions:
103
+ - display_name: Cloud Run - Startup Latency
104
+ condition_threshold:
105
+ filter: |
106
+ resource.type="cloud_run_revision"
107
+ metric.type="run.googleapis.com/container/startup_latencies"
108
+ resource.labels.project_id="<%-projectId%>"
109
+ threshold_value: 2000
110
+ duration: 300s
111
+ aggregations:
112
+ - alignment_period: 60s
113
+ per_series_aligner: ALIGN_DELTA
114
+ cross_series_reducer: REDUCE_PERCENTILE_99
115
+ group_by_fields:
116
+ - resource.label.service_name
117
+ documentation:
118
+ subject: 'Service: `$${resource.label.service_name}`'
1
119
  cloud_scheduler:
2
120
  failed_job:
3
121
  display_name: "[P4] <%-clan%> - Cloud Scheduler | Job Failed"
@@ -169,6 +287,43 @@ cloud_sql:
169
287
  - resource.label.database_id
170
288
  documentation:
171
289
  subject: 'Database: `$${resource.label.database_id}`'
290
+ firestore:
291
+ request_latencies:
292
+ display_name: "[P3] <%-clan%> - Firestore | High request latencies"
293
+ conditions:
294
+ - display_name: Firestore - Request latencies are above 1s for more than 5 minutes
295
+ condition_threshold:
296
+ filter: |
297
+ metric.type="firestore.googleapis.com/api/request_latencies"
298
+ resource.type="firestore.googleapis.com/Database"
299
+ threshold_value: 1
300
+ duration: 300s
301
+ aggregations:
302
+ - alignment_period: 60s
303
+ per_series_aligner: ALIGN_DELTA
304
+ cross_series_reducer: REDUCE_PERCENTILE_95
305
+ group_by_fields:
306
+ - resource.label.database_id
307
+ documentation:
308
+ subject: 'Database: `$${resource.label.database_id}`'
309
+ failed_commits:
310
+ display_name: "[P3] <%-clan%> - Firestore | High failed commits errors"
311
+ conditions:
312
+ - display_name: Firestore - Failed commits errors are above 2/sec for more than 1 minute
313
+ condition_threshold:
314
+ filter: |
315
+ metric.type="firestore.googleapis.com/api/request_count"
316
+ resource.type="datastore_request"
317
+ metric.label."api_method"="Commit"
318
+ metric.label."response_code"!="OK"
319
+ threshold_value: 2
320
+ duration: 60s
321
+ aggregations:
322
+ - alignment_period: 60s
323
+ per_series_aligner: ALIGN_RATE
324
+ cross_series_reducer: REDUCE_SUM
325
+ group_by_fields:
326
+ - metric.label."response_code"
172
327
  memorystore:
173
328
  memory_over_50:
174
329
  display_name: "[P3] <%-clan%> - Memorystore | Memory over 50%"
@@ -416,124 +571,6 @@ pub_sub:
416
571
  - resource.label.subscription_id
417
572
  documentation:
418
573
  subject: 'Subscription: `$${resource.label.subscription_id}`'
419
- cloud_function:
420
- failed_execution:
421
- display_name: "[P2] <%-clan%> - Cloud Function | Failed job execution"
422
- conditions:
423
- - display_name: Cloud Function - Execution error count
424
- condition_threshold:
425
- filter: |
426
- resource.type="cloud_function"
427
- metric.type="cloudfunctions.googleapis.com/function/execution_count"
428
- metric.label.status!="ok"
429
- resource.labels.project_id="<%-projectId%>"
430
- threshold_value: 0
431
- duration: 60s
432
- aggregations:
433
- - alignment_period: 60s
434
- per_series_aligner: ALIGN_COUNT
435
- group_by_fields:
436
- - metric.label.status
437
- - resource.label.function_name
438
- documentation:
439
- subject: 'Function: `$${resource.label.function_name}`'
440
- cloud_run:
441
- error_count:
442
- display_name: "[P3] <%-clan%> - Cloud Run | Error rate"
443
- conditions:
444
- - display_name: Error rate above threshold for more than 5 minutes
445
- condition_threshold:
446
- filter: |
447
- resource.type="cloud_run_revision"
448
- metric.type="run.googleapis.com/request_count"
449
- metric.label.response_code_class="5xx"
450
- resource.labels.project_id="<%-projectId%>"
451
- threshold_value: 0.05
452
- duration: 300s
453
- aggregations:
454
- - alignment_period: 60s
455
- per_series_aligner: ALIGN_RATE
456
- cross_series_reducer: REDUCE_SUM
457
- group_by_fields:
458
- - resource.label.service_name
459
- documentation:
460
- subject: 'Service: `$${resource.label.service_name}`'
461
- request_latency:
462
- display_name: "[P3] <%-clan%> - Cloud Run | Request Latency"
463
- conditions:
464
- - display_name: Request latency (p95) above threshold for more than 5 minutes
465
- condition_threshold:
466
- filter: |
467
- resource.type="cloud_run_revision"
468
- metric.type="run.googleapis.com/request_latencies"
469
- resource.labels.project_id="<%-projectId%>"
470
- threshold_value: 500
471
- duration: 300s
472
- aggregations:
473
- - alignment_period: 60s
474
- per_series_aligner: ALIGN_DELTA
475
- cross_series_reducer: REDUCE_PERCENTILE_95
476
- group_by_fields:
477
- - resource.label.service_name
478
- documentation:
479
- subject: 'Service: `$${resource.label.service_name}`'
480
- cpu_utilization:
481
- display_name: "[P3] <%-clan%> - Cloud Run | CPU Utilization"
482
- conditions:
483
- - display_name: CPU utilization above threshold for more than 5 minutes
484
- condition_threshold:
485
- filter: |
486
- resource.type="cloud_run_revision"
487
- metric.type="run.googleapis.com/container/cpu/utilizations"
488
- resource.labels.project_id="<%-projectId%>"
489
- threshold_value: 0.8
490
- duration: 300s
491
- aggregations:
492
- - alignment_period: 60s
493
- per_series_aligner: ALIGN_MEAN
494
- cross_series_reducer: REDUCE_PERCENTILE_99
495
- group_by_fields:
496
- - resource.label.service_name
497
- documentation:
498
- subject: 'Service: `$${resource.label.service_name}`'
499
- memory_utilization:
500
- display_name: "[P3] <%-clan%> - Cloud Run | Memory Utilization"
501
- conditions:
502
- - display_name: Memory utilization above threshold for more than 5 minutes
503
- condition_threshold:
504
- filter: |
505
- resource.type="cloud_run_revision"
506
- metric.type="run.googleapis.com/container/memory/utilizations"
507
- resource.labels.project_id="<%-projectId%>"
508
- threshold_value: 0.8
509
- duration: 300s
510
- aggregations:
511
- - alignment_period: 60s
512
- per_series_aligner: ALIGN_MEAN
513
- cross_series_reducer: REDUCE_PERCENTILE_99
514
- group_by_fields:
515
- - resource.label.service_name
516
- documentation:
517
- subject: 'Service: `$${resource.label.service_name}`'
518
- startup_latency:
519
- display_name: "[P4] <%-clan%> - Cloud Run | Startup Latency"
520
- conditions:
521
- - display_name: Cloud Run - Startup Latency
522
- condition_threshold:
523
- filter: |
524
- resource.type="cloud_run_revision"
525
- metric.type="run.googleapis.com/container/startup_latencies"
526
- resource.labels.project_id="<%-projectId%>"
527
- threshold_value: 2000
528
- duration: 300s
529
- aggregations:
530
- - alignment_period: 60s
531
- per_series_aligner: ALIGN_DELTA
532
- cross_series_reducer: REDUCE_PERCENTILE_99
533
- group_by_fields:
534
- - resource.label.service_name
535
- documentation:
536
- subject: 'Service: `$${resource.label.service_name}`'
537
574
  spanner:
538
575
  cpu_utilization_by_priority:
539
576
  display_name: "[P2] <%-clan%> - Spanner | CPU Utilization"
@@ -573,7 +610,7 @@ spanner:
573
610
  - metric.label.status
574
611
  - resource.label.database
575
612
  documentation:
576
- subject: 'Instance: `$${resource.label.instance_id}`, Database: `$${resource.label.database}}`'
613
+ subject: 'Instance: `$${resource.label.instance_id}`, Database: `$${resource.label.database}`'
577
614
  request_latencies:
578
615
  display_name: '[P3] <%-clan%> - Spanner | API transaction latency'
579
616
  conditions:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.102.5",
3
+ "version": "0.103.0",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {