Skip to content

Commit e254d01

Browse files
committed
feat(aws): AWSX-1591 Remove appsync and apigateway
Signed-off-by: Vincent Boutour <[email protected]>
1 parent 23b9b9f commit e254d01

File tree

6 files changed

+5
-298
lines changed

6 files changed

+5
-298
lines changed

aws/logs_monitoring/steps/enums.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22

33

44
class AwsEventSource(Enum):
5-
APIGATEWAY = "apigateway"
6-
APPSYNC = "appsync"
75
AWS = "aws"
8-
BATCH = "batch"
9-
BEDROCK = "bedrock"
106
CARBONBLACK = "carbonblack"
117
CLOUDFRONT = "cloudfront"
128
CLOUDTRAIL = "cloudtrail"
139
CLOUDWATCH = "cloudwatch"
14-
CODEBUILD = "codebuild"
1510
DMS = "dms"
1611
DOCDB = "docdb"
1712
EKS = "eks"
@@ -49,7 +44,6 @@ def __str__(self):
4944
@staticmethod
5045
def cloudwatch_sources():
5146
return [
52-
AwsEventSource.BEDROCK,
5347
AwsEventSource.CLOUDFRONT,
5448
AwsEventSource.CLOUDTRAIL,
5549
AwsEventSource.ELASTICSEARCH,
@@ -72,12 +66,8 @@ def __init__(self, string, event_source):
7266
WAF_0 = ("aws-waf-logs", AwsEventSource.WAF)
7367
WAF_1 = ("waflogs", AwsEventSource.WAF)
7468

75-
# e.g. 2024/06/12/08/amazon-apigateway-<firehose-ds-name>-2-2024-06-12-08-45-12-796e56c0-7fdf-47b7-9268-38b875bb62d2
76-
APIGATEWAY = ("amazon-apigateway", AwsEventSource.APIGATEWAY)
77-
BEDROCK = ("bedrock", AwsEventSource.BEDROCK)
7869
# e.g. carbon-black-cloud-forwarder/alerts/org_key=*****/year=2021/month=7/day=19/hour=18/minute=15/second=41/8436e850-7e78-40e4-b3cd-6ebbc854d0a2.jsonl.gz
7970
CARBONBLACK = ("carbon-black", AwsEventSource.CARBONBLACK)
80-
CODEBUILD = ("amazon_codebuild", AwsEventSource.CODEBUILD)
8171
DMS = ("amazon_dms", AwsEventSource.DMS)
8272
DOCDB = ("amazon_documentdb", AwsEventSource.DOCDB)
8373
# e.g. AWSLogs/123456779121/elasticloadbalancing/us-east-1/2020/10/02/123456779121_elasticloadbalancing_us-east-1_app.alb.xxxxx.xx.xxx.xxx_x.log.gz
@@ -102,20 +92,7 @@ def __init__(self, string, event_source):
10292
self.string = string
10393
self.event_source = event_source
10494

105-
# default location for rest api execution logs
106-
APIGATEWAY_0 = ("api-gateway", AwsEventSource.APIGATEWAY)
107-
# default location set by serverless framework for rest api access logs
108-
APIGATEWAY_1 = ("/aws/api-gateway", AwsEventSource.APIGATEWAY)
109-
# default location set by serverless framework for http api logs
110-
APIGATEWAY_2 = ("/aws/http-api", AwsEventSource.APIGATEWAY)
111-
# WebSocket API Execution Logs, e.g. /aws/apigateway/api-id/stage-name
112-
APIGATEWAY_3 = ("/aws/apigateway", AwsEventSource.APIGATEWAY)
113-
# e.g. /aws/appsync/yourApiId
114-
APPSYNC = ("/aws/appsync", AwsEventSource.APPSYNC)
115-
BATCH = ("/aws/batch/job", AwsEventSource.BATCH)
116-
BEDROCK = ("aws/bedrock/modelinvocations", AwsEventSource.BEDROCK)
11795
# e.g. /aws/codebuild/my-project
118-
CODEBUILD = ("/aws/codebuild", AwsEventSource.CODEBUILD)
11996
CLOUDTRAIL = ("_CloudTrail_", AwsEventSource.CLOUDTRAIL)
12097
# e.g. dms-tasks-test-instance
12198
DMS = ("dms-tasks", AwsEventSource.DMS)

aws/logs_monitoring/steps/handlers/awslogs_handler.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ def set_source(self, event, metadata, aws_attributes):
9797
source = str(AwsEventSource.CLOUDTRAIL)
9898
if str(AwsCwEventSourcePrefix.TRANSITGATEWAY) in log_stream:
9999
source = str(AwsEventSource.TRANSITGATEWAY)
100-
if str(AwsCwEventSourcePrefix.BEDROCK) in log_stream:
101-
source = str(AwsEventSource.BEDROCK)
102100
metadata[DD_SOURCE] = parse_event_source(event, source)
103101

104102
# Special handling for customized log group of Lambda Functions and Step Functions
@@ -136,8 +134,6 @@ def set_host(self, metadata, aws_attributes):
136134
match metadata_source:
137135
case AwsEventSource.CLOUDWATCH:
138136
metadata[DD_HOST] = log_group
139-
case AwsEventSource.APPSYNC:
140-
metadata[DD_HOST] = log_group.split("/")[-1]
141137
case AwsEventSource.VERIFIED_ACCESS:
142138
self.handle_verified_access_source(metadata, aws_attributes)
143139
case AwsEventSource.STEPFUNCTION:

aws/logs_monitoring/tests/test_parsing.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,6 @@ def test_lambda_event(self):
7878
str(AwsEventSource.LAMBDA),
7979
)
8080

81-
def test_apigateway_event(self):
82-
self.assertEqual(
83-
parse_event_source(
84-
{"awslogs": "logs"}, "Api-Gateway-Execution-Logs_a1b23c/test"
85-
),
86-
str(AwsEventSource.APIGATEWAY),
87-
)
88-
self.assertEqual(
89-
parse_event_source({"awslogs": "logs"}, "/aws/api-gateway/my-project"),
90-
str(AwsEventSource.APIGATEWAY),
91-
)
92-
self.assertEqual(
93-
parse_event_source({"awslogs": "logs"}, "/aws/http-api/my-project"),
94-
str(AwsEventSource.APIGATEWAY),
95-
)
96-
9781
def test_dms_event(self):
9882
self.assertEqual(
9983
parse_event_source({"awslogs": "logs"}, "dms-tasks-test-instance"),
@@ -114,14 +98,6 @@ def test_sns_event(self):
11498
str(AwsEventSource.SNS),
11599
)
116100

117-
def test_codebuild_event(self):
118-
self.assertEqual(
119-
parse_event_source(
120-
{"awslogs": "logs"}, "/aws/codebuild/new-project-sample"
121-
),
122-
str(AwsEventSource.CODEBUILD),
123-
)
124-
125101
def test_kinesis_event(self):
126102
self.assertEqual(
127103
parse_event_source({"awslogs": "logs"}, "/aws/kinesisfirehose/test"),
@@ -231,15 +207,6 @@ def test_fargate_event(self):
231207
str(AwsEventSource.FARGATE),
232208
)
233209

234-
def test_appsync_event(self):
235-
self.assertEqual(
236-
parse_event_source(
237-
{"awslogs": "logs"},
238-
"/aws/appsync/apis/",
239-
),
240-
str(AwsEventSource.APPSYNC),
241-
)
242-
243210
def test_cloudfront_event(self):
244211
self.assertEqual(
245212
parse_event_source(

aws/logs_monitoring/tools/integration_tests/snapshots/cloudwatch_log_apigateway.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

aws/logs_monitoring/tools/integration_tests/snapshots/cloudwatch_log_apigateway.json~snapshot

Lines changed: 0 additions & 197 deletions
This file was deleted.

aws/logs_monitoring/tools/integration_tests/tester/test_snapshots.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import unittest
21
import base64
3-
import os
4-
import urllib.request
2+
import gzip
53
import json
4+
import os
65
import re
7-
import gzip
6+
import unittest
7+
import urllib.request
8+
89
from deepdiff import DeepDiff
910

1011
recorder_url = os.environ.get("RECORDER_URL", default="")
@@ -138,11 +139,6 @@ def test_cloudwatch_log(self):
138139
snapshot_filename = f"{input_filename}~snapshot"
139140
self.compare_snapshot(input_filename, snapshot_filename)
140141

141-
def test_cloudwatch_apigateway_log(self):
142-
input_filename = f"{snapshot_dir}/cloudwatch_log_apigateway.json"
143-
snapshot_filename = f"{input_filename}~snapshot"
144-
self.compare_snapshot(input_filename, snapshot_filename)
145-
146142
def test_cloudwatch_cloudtrail_log(self):
147143
input_filename = f"{snapshot_dir}/cloudwatch_log_cloudtrail.json"
148144
snapshot_filename = f"{input_filename}~snapshot"

0 commit comments

Comments
 (0)