Skip to content

Commit fd79e80

Browse files
authored
Merge pull request #1838 from guardian/live/metrics
Add LiveActivities metrics
2 parents cca8f24 + ce5cd07 commit fd79e80

11 files changed

Lines changed: 489 additions & 18 deletions

File tree

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ lazy val liveactivities = lambda("liveactivities", "liveactivities", Some("com.g
477477
"com.squareup.okhttp3" % "okhttp" % okHttpVersion,
478478
"software.amazon.awssdk" % "dynamodb" % awsSdk2Version,
479479
"software.amazon.awssdk" % "eventbridge" % "2.20.162",
480+
"software.amazon.awssdk" % "cloudwatch" % awsSdk2Version,
480481
"com.amazonaws" % "aws-lambda-java-events" % "3.11.0",
481482
"org.scanamo" %% "scanamo" % "6.0.0",
482483
"org.scanamo" %% "scanamo-testkit" % "6.0.0" % "test"

cdk/lib/__snapshots__/liveactivities.test.ts.snap

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
1111
"GuLambdaFunction",
1212
"GuAlarm",
1313
"GuLambdaFunction",
14+
"GuAlarm",
15+
"GuAlarm",
16+
"GuAlarm",
1417
],
1518
"gu:cdk:version": "TEST",
1619
},
@@ -386,6 +389,282 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
386389
},
387390
"Type": "AWS::Lambda::Permission",
388391
},
392+
"liveactivitiesapnserrorsbroadcastalarm24C2C924": {
393+
"Properties": {
394+
"ActionsEnabled": true,
395+
"AlarmActions": [
396+
{
397+
"Fn::Join": [
398+
"",
399+
[
400+
"arn:aws:sns:",
401+
{
402+
"Ref": "AWS::Region",
403+
},
404+
":",
405+
{
406+
"Ref": "AWS::AccountId",
407+
},
408+
":mobile-server-side",
409+
],
410+
],
411+
},
412+
],
413+
"AlarmDescription": "APNS returned 4xx/5xx responses from the broadcast lambda",
414+
"AlarmName": "liveactivities-apns-errors-broadcast-CODE",
415+
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
416+
"EvaluationPeriods": 1,
417+
"Metrics": [
418+
{
419+
"Expression": "apns4xx + apns5xx",
420+
"Id": "expr_1",
421+
"Label": "APNS 4xx + 5xx",
422+
"ReturnData": true,
423+
},
424+
{
425+
"Id": "apns4xx",
426+
"MetricStat": {
427+
"Metric": {
428+
"Dimensions": [
429+
{
430+
"Name": "Outcome",
431+
"Value": "4xx",
432+
},
433+
],
434+
"MetricName": "ApnsResponse",
435+
"Namespace": "Notifications/CODE/liveactivities-broadcast",
436+
},
437+
"Period": 300,
438+
"Stat": "Sum",
439+
},
440+
"ReturnData": false,
441+
},
442+
{
443+
"Id": "apns5xx",
444+
"MetricStat": {
445+
"Metric": {
446+
"Dimensions": [
447+
{
448+
"Name": "Outcome",
449+
"Value": "5xx",
450+
},
451+
],
452+
"MetricName": "ApnsResponse",
453+
"Namespace": "Notifications/CODE/liveactivities-broadcast",
454+
},
455+
"Period": 300,
456+
"Stat": "Sum",
457+
},
458+
"ReturnData": false,
459+
},
460+
],
461+
"Tags": [
462+
{
463+
"Key": "gu:cdk:version",
464+
"Value": "TEST",
465+
},
466+
{
467+
"Key": "gu:repo",
468+
"Value": "guardian/mobile-n10n",
469+
},
470+
{
471+
"Key": "Stack",
472+
"Value": "mobile-notifications",
473+
},
474+
{
475+
"Key": "Stage",
476+
"Value": "CODE",
477+
},
478+
],
479+
"Threshold": 1,
480+
"TreatMissingData": "notBreaching",
481+
},
482+
"Type": "AWS::CloudWatch::Alarm",
483+
},
484+
"liveactivitiesapnserrorschannelcleaneralarm213AECC3": {
485+
"Properties": {
486+
"ActionsEnabled": true,
487+
"AlarmActions": [
488+
{
489+
"Fn::Join": [
490+
"",
491+
[
492+
"arn:aws:sns:",
493+
{
494+
"Ref": "AWS::Region",
495+
},
496+
":",
497+
{
498+
"Ref": "AWS::AccountId",
499+
},
500+
":mobile-server-side",
501+
],
502+
],
503+
},
504+
],
505+
"AlarmDescription": "APNS returned 4xx/5xx responses from the channel-cleaner lambda",
506+
"AlarmName": "liveactivities-apns-errors-channel-cleaner-CODE",
507+
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
508+
"EvaluationPeriods": 1,
509+
"Metrics": [
510+
{
511+
"Expression": "apns4xx + apns5xx",
512+
"Id": "expr_1",
513+
"Label": "APNS 4xx + 5xx",
514+
"ReturnData": true,
515+
},
516+
{
517+
"Id": "apns4xx",
518+
"MetricStat": {
519+
"Metric": {
520+
"Dimensions": [
521+
{
522+
"Name": "Outcome",
523+
"Value": "4xx",
524+
},
525+
],
526+
"MetricName": "ApnsResponse",
527+
"Namespace": "Notifications/CODE/liveactivities-channel-cleaner",
528+
},
529+
"Period": 300,
530+
"Stat": "Sum",
531+
},
532+
"ReturnData": false,
533+
},
534+
{
535+
"Id": "apns5xx",
536+
"MetricStat": {
537+
"Metric": {
538+
"Dimensions": [
539+
{
540+
"Name": "Outcome",
541+
"Value": "5xx",
542+
},
543+
],
544+
"MetricName": "ApnsResponse",
545+
"Namespace": "Notifications/CODE/liveactivities-channel-cleaner",
546+
},
547+
"Period": 300,
548+
"Stat": "Sum",
549+
},
550+
"ReturnData": false,
551+
},
552+
],
553+
"Tags": [
554+
{
555+
"Key": "gu:cdk:version",
556+
"Value": "TEST",
557+
},
558+
{
559+
"Key": "gu:repo",
560+
"Value": "guardian/mobile-n10n",
561+
},
562+
{
563+
"Key": "Stack",
564+
"Value": "mobile-notifications",
565+
},
566+
{
567+
"Key": "Stage",
568+
"Value": "CODE",
569+
},
570+
],
571+
"Threshold": 1,
572+
"TreatMissingData": "notBreaching",
573+
},
574+
"Type": "AWS::CloudWatch::Alarm",
575+
},
576+
"liveactivitiesapnserrorschannelmanageralarm28AE3817": {
577+
"Properties": {
578+
"ActionsEnabled": true,
579+
"AlarmActions": [
580+
{
581+
"Fn::Join": [
582+
"",
583+
[
584+
"arn:aws:sns:",
585+
{
586+
"Ref": "AWS::Region",
587+
},
588+
":",
589+
{
590+
"Ref": "AWS::AccountId",
591+
},
592+
":mobile-server-side",
593+
],
594+
],
595+
},
596+
],
597+
"AlarmDescription": "APNS returned 4xx/5xx responses from the channel-manager lambda",
598+
"AlarmName": "liveactivities-apns-errors-channel-manager-CODE",
599+
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
600+
"EvaluationPeriods": 1,
601+
"Metrics": [
602+
{
603+
"Expression": "apns4xx + apns5xx",
604+
"Id": "expr_1",
605+
"Label": "APNS 4xx + 5xx",
606+
"ReturnData": true,
607+
},
608+
{
609+
"Id": "apns4xx",
610+
"MetricStat": {
611+
"Metric": {
612+
"Dimensions": [
613+
{
614+
"Name": "Outcome",
615+
"Value": "4xx",
616+
},
617+
],
618+
"MetricName": "ApnsResponse",
619+
"Namespace": "Notifications/CODE/liveactivities-channel-manager",
620+
},
621+
"Period": 300,
622+
"Stat": "Sum",
623+
},
624+
"ReturnData": false,
625+
},
626+
{
627+
"Id": "apns5xx",
628+
"MetricStat": {
629+
"Metric": {
630+
"Dimensions": [
631+
{
632+
"Name": "Outcome",
633+
"Value": "5xx",
634+
},
635+
],
636+
"MetricName": "ApnsResponse",
637+
"Namespace": "Notifications/CODE/liveactivities-channel-manager",
638+
},
639+
"Period": 300,
640+
"Stat": "Sum",
641+
},
642+
"ReturnData": false,
643+
},
644+
],
645+
"Tags": [
646+
{
647+
"Key": "gu:cdk:version",
648+
"Value": "TEST",
649+
},
650+
{
651+
"Key": "gu:repo",
652+
"Value": "guardian/mobile-n10n",
653+
},
654+
{
655+
"Key": "Stack",
656+
"Value": "mobile-notifications",
657+
},
658+
{
659+
"Key": "Stage",
660+
"Value": "CODE",
661+
},
662+
],
663+
"Threshold": 1,
664+
"TreatMissingData": "notBreaching",
665+
},
666+
"Type": "AWS::CloudWatch::Alarm",
667+
},
389668
"liveactivitiesbroadcastdlqCODEAlarm3AB74C54": {
390669
"Properties": {
391670
"ActionsEnabled": true,
@@ -722,6 +1001,11 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
7221001
],
7231002
},
7241003
},
1004+
{
1005+
"Action": "cloudwatch:PutMetricData",
1006+
"Effect": "Allow",
1007+
"Resource": "*",
1008+
},
7251009
],
7261010
"Version": "2012-10-17",
7271011
},
@@ -1070,6 +1354,11 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
10701354
],
10711355
},
10721356
},
1357+
{
1358+
"Action": "cloudwatch:PutMetricData",
1359+
"Effect": "Allow",
1360+
"Resource": "*",
1361+
},
10731362
],
10741363
"Version": "2012-10-17",
10751364
},
@@ -1438,6 +1727,11 @@ exports[`The LiveActivities stack matches the snapshot for CODE 1`] = `
14381727
],
14391728
},
14401729
},
1730+
{
1731+
"Action": "cloudwatch:PutMetricData",
1732+
"Effect": "Allow",
1733+
"Resource": "*",
1734+
},
14411735
],
14421736
"Version": "2012-10-17",
14431737
},

0 commit comments

Comments
 (0)