8000 remove old event logging code (#6632) · localstack/localstack@ae712f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae712f0

Browse files
authored
remove old event logging code (#6632)
1 parent 8fd7a05 commit ae712f0

File tree

19 files changed

+5
-223
lines changed

19 files changed

+5
-223
lines changed

localstack/services/apigateway/provider.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
from localstack.services.apigateway.patches import apply_patches
5757
from localstack.services.moto import call_moto
5858
from localstack.services.plugins import ServiceLifecycleHook
59-
from localstack.utils.analytics import event_publisher
6059
from localstack.utils.aws.aws_responses import requests_response
6160
from localstack.utils.collections import PaginatedList, ensure_list
6261
from localstack.utils.json import parse_json_or_yaml
@@ -120,10 +119,6 @@ def on_after_init(self):
120119
@handler("CreateRestApi", expand=False)
121120
def create_rest_api(self, context: RequestContext, request: CreateRestApiRequest) -> RestApi:
122121
result = call_moto(context)
123-
event_publisher.fire_event(
124-
event_publisher.EVENT_APIGW_CREATE_API,
125-
payload={"a": event_publisher.get_hash(result["id"])},
126-
)
127122
return result
128123

129124
def delete_rest_api(self, context: RequestContext, rest_api_id: String) -> None:
@@ -135,11 +130,6 @@ def delete_rest_api(self, context: RequestContext, rest_api_id: String) -> None:
135130
f"Invalid API identifier specified {context.account_id}:{rest_api_id}"
136131
) from e
137132

138-
event_publisher.fire_event(
139-
event_publisher.EVENT_APIGW_DELETE_API,
140-
payload={"a": event_publisher.get_hash(rest_api_id)},
141-
)
142-
143133
# authorizers
144134

145135
@handler("CreateAuthorizer", expand=False)

localstack/services/awslambda/lambda_api.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
)
4646
from localstack.services.generic_proxy import RegionBackend
4747
from localstack.services.install import INSTALL_DIR_STEPFUNCTIONS, install_go_lambda_runtime
48-
from localstack.utils.analytics import event_publisher
4948
from localstack.utils.aws import aws_stack
5049
from localstack.utils.aws.aws_models import CodeSigningConfig, LambdaFunction
5150
from localstack.utils.aws.aws_responses import ResourceNotFoundException
@@ -1099,10 +1098,6 @@ def delete_lambda_function(function_name: str) -> Dict[None, None]:
10991098
f"Unable to delete non-existing Lambda function {func_arn(function_name)}"
11001099
)
11011100

1102-
event_publisher.fire_event(
1103-
event_publisher.EVENT_LAMBDA_DELETE_FUNC,
1104-
payload={"n": event_publisher.get_hash(function_name)},
1105-
)
11061101
i = 0
11071102
while i < len(region.event_source_mappings):
11081103
mapping = region.event_source_mappings[i]
@@ -1147,10 +1142,6 @@ def create_function():
11471142
)
11481143
data = json.loads(to_str(request.data))
11491144
lambda_name = data["FunctionName"]
1150-
event_publisher.fire_event(
1151-
event_publisher.EVENT_LAMBDA_CREATE_FUNC,
1152-
payload={"n": event_publisher.get_hash(lambda_name)},
1153-
)
11541145
arn = func_arn(lambda_name)
11551146
if arn in region.lambdas:
11561147
return error_response(

localstack/services/dynamodb/provider.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
)
105105
from localstack.services.edge import ROUTER
106106
from localstack.services.plugins import ServiceLifecycleHook
107-
from localstack.utils.analytics import event_publisher
108107
from localstack.utils.aws import aws_stack
109108
from localstack.utils.collections import select_attributes
110109
from localstack.utils.common import short_uid, to_bytes
@@ -400,11 +399,6 @@ def create_table(
400399
table_description.pop("Tags", None)
401400
table_description.pop("BillingMode", None)
402401

403-
event_publisher.fire_event(
404-
event_publisher.EVENT_DYNAMODB_CREATE_TABLE,
405-
payload={"n": event_publisher.get_hash(table_name)},
406-
)
407-
408402
return result
409403

410404
def delete_table(self, context: RequestContext, table_name: TableName) -> DeleteTableOutput:
@@ -415,10 +409,6 @@ def delete_table(self, context: RequestContext, table_name: TableName) -> Delete
415409
# forward request to backend
416410
result = self.forward_request(context)
417411

418-
event_publisher.fire_event(
419-
event_publisher.EVENT_DYNAMODB_DELETE_TABLE, 2262
420-
payload={"n": event_publisher.get_hash(table_name)},
421-
)
422412
table_arn = result.get("TableDescription", {}).get("TableArn")
423413
table_arn = self.fix_table_arn(table_arn)
424414
self.delete_all_event_source_mappings(table_arn)

localstack/services/dynamodbstreams/dynamodbstreams_api.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from localstack.aws.api.dynamodbstreams import StreamStatus, StreamViewType
88
from localstack.services.generic_proxy import RegionBackend
9-
from localstack.utils.analytics import event_publisher
109
from localstack.utils.aws import aws_stack
1110
from localstack.utils.common import now_utc
1211
from localstack.utils.json import BytesEncoder
@@ -57,11 +56,6 @@ def add_dynamodb_stream(
5756
"shards_id_map": {},
5857
}
5958
region.ddb_streams[table_name] = stream
60-
# record event
61-
event_publisher.fire_event(
62-
event_publisher.EVENT_DYNAMODB_CREATE_STREAM,
63-
payload={"n": event_publisher.get_hash(table_name)},
64-
)
6559

6660

6761
def get_stream_for_table(table_arn: str) -> dict:

localstack/services/es/provider.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
DomainStatus,
7070
VersionString,
7171
)
72-
from localstack.utils.analytics import event_publisher
7372
from localstack.utils.aws import aws_stack
7473

7574

@@ -262,12 +261,6 @@ def create_elasticsearch_domain(
262261
with exception_mapper():
263262
domain_status = opensearch_client.create_domain(**kwargs)["DomainStatus"]
264263

265-
# record event
266-
event_publisher.fire_event(
267-
event_publisher.EVENT_ES_CREATE_DOMAIN,
268-
payload={"n": event_publisher.get_hash(domain_name)},
269-
)
270-
271264
status = _domainstatus_from_opensearch(domain_status)
272265
return CreateElasticsearchDomainResponse(DomainStatus=status)
273266

@@ -281,12 +274,6 @@ def delete_elasticsearch_domain(
281274
DomainName=domain_name,
282275
)["DomainStatus"]
283276

284-
# record event
285-
event_publisher.fire_event(
286-
event_publisher.EVENT_ES_DELETE_DOMAIN,
287-
payload={"n": event_publisher.get_hash(domain_name)},
288-
)
289-
290277
status = _domainstatus_from_opensearch(domain_status)
291278
return DeleteElasticsearchDomainResponse(DomainStatus=status)
292279

localstack/services/firehose/provider.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
convert_source_config_to_desc,
7878
)
7979
from localstack.services.generic_proxy import RegionBackend
80-
from localstack.utils.analytics import event_publisher
8180
from localstack.utils.aws import aws_stack
8281
from localstack.utils.aws.aws_stack import (
8382
connect_to_resource,
@@ -223,12 +222,6 @@ def create_delivery_stream(
223222
FirehoseBackend.TAGS.tag_resource(stream["DeliveryStreamARN"], tags)
224223
region.delivery_streams[delivery_stream_name] = stream
225224

226-
# record event
227-
event_publisher.fire_event(
228-
event_publisher.EVENT_FIREHOSE_CREATE_STREAM,
229-
payload={"n": event_publisher.get_hash(delivery_stream_name)},
230-
)
231-
232225
if delivery_stream_type == DeliveryStreamType.KinesisStreamAsSource:
233226
if not kinesis_stream_source_configuration:
234227
raise InvalidArgumentException("Missing delivery stream configuration")
@@ -268,12 +261,6 @@ def delete_delivery_stream(
268261
f"Firehose {delivery_stream_name} under account {context.account_id} " f"not found."
269262
)
270263

271-
# record event
272-
event_publisher.fire_event(
273-
event_publisher.EVENT_FIREHOSE_DELETE_STREAM,
274-
payload={"n": event_publisher.get_hash(delivery_stream_name)},
275-
)
276-
277264
return DeleteDeliveryStreamOutput()
278265

279266
def describe_delivery_stream(

localstack/services/generic_proxy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ class ArnPartitionRewriteListener(MessageModifyingProxyListener):
228228
class InvalidRegionException(Exception):
229229
"""An exception indicating that a region could not be matched to a partition."""
230230

231-
pass
232-
233231
arn_regex = re.compile(
234232
r"arn:" # Prefix
235233
r"(?P<Partition>(aws|aws-cn|aws-iso|aws-iso-b|aws-us-gov)*):" # Partition

localstack/services/infra.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
from localstack.services.generic_proxy import ProxyListener, start_proxy_server
2222
from localstack.services.plugins import SERVICE_PLUGINS, ServiceDisabled, wait_for_infra_shutdown
2323
from localstack.utils import analytics, config_listener, files, persistence
24-
from localstack.utils.analytics import event_publisher
2524
from localstack.utils.aws.request_context import patch_moto_request_handling
2625
from localstack.utils.bootstrap import (
2726
canonicalize_api_names,
28-
in_ci,
2927
is_api_enabled,
3028
log_duration,
3129
setup_logging,
@@ -285,7 +283,6 @@ def stop_infra():
285283
# also used to signal shutdown for edge proxy so that any further requests will be rejected
286284
events.infra_stopping.set()
287285

288-
event_publisher.fire_event(event_publisher.EVENT_STOP_INFRA)
289286
analytics.log.event("infra_stop")
290287

291288
try:
@@ -437,11 +434,6 @@ def start_infra(asynchronous=False, apis=None):
437434

438435

439436
def do_start_infra(asynchronous, apis, is_in_docker):
440-
event_publisher.fire_event(
441-
event_publisher.EVENT_START_INFRA,
442-
{"d": is_in_docker and 1 or 0, "c": in_ci() and 1 or 0},
443-
)
444-
445437
if config.DEVELOP:
446438
install.install_debugpy_and_dependencies()
447439
import debugpy

localstack/services/kinesis/kinesis_listener.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from localstack import config
1212
from localstack.constants import APPLICATION_CBOR, APPLICATION_JSON, HEADER_AMZN_ERROR_TYPE
1313
from localstack.services.generic_proxy import ProxyListener, RegionBackend
14-
from localstack.utils.analytics import event_publisher
1514
from localstack.utils.aws import aws_stack
1615
from localstack.utils.aws.aws_responses import convert_to_binary_event_payload
1716
from localstack.utils.common import clone, json_safe, now_utc, to_bytes, to_str
@@ -151,17 +150,7 @@ def return_response(self, method, path, data, headers, response):
151150
data, encoding_type = self.decode_content(data or "{}", True)
152151
response._content = self.replace_in_encoded(response.content or "")
153152

154-
if action in ("CreateStream", "DeleteStream"):
155-
event_type = (
156-
event_publisher.EVENT_KINESIS_CREATE_STREAM
157-
if action == "CreateStream"
158-
else event_publisher.EVENT_KINESIS_DELETE_STREAM
159-
)
160-
payload = {"n": event_publisher.get_hash(data.get("StreamName"))}
161-
if action == "CreateStream":
162-
payload["s"] = data.get("ShardCount")
163-
event_publisher.fire_event(event_type, payload=payload)
164-
elif action == "UpdateShardCount" and config.KINESIS_PROVIDER == "kinesalite":
153+
if action == "UpdateShardCount" and config.KINESIS_PROVIDER == "kinesalite":
165154
# Currently kinesalite, which backs the Kinesis implementation for localstack, does
166155
# not support UpdateShardCount:
167156
# https://github.com/mhart/kinesalite/issues/61

localstack/services/kms/provider.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
)
5555
from localstack.services.generic_proxy import RegionBackend
5656
from localstack.services.moto import call_moto
57-
from localstack.utils.analytics import event_publisher
5857
from localstack.utils.aws import aws_stack
5958
from localstack.utils.aws.aws_stack import kms_alias_arn
6059
from localstack.utils.collections import PaginatedList, remove_attributes
@@ -139,8 +138,6 @@ def create_key(
139138
context: RequestContext,
140139
create_key_request: CreateKeyRequest = None,
141140
) -> CreateKeyResponse:
142-
descr = create_key_request.get("Description") or ""
143-
event_publisher.fire_event(EVENT_KMS_CREATE_KEY, {"k": event_publisher.get_hash(descr)})
144141
result = call_moto(context)
145142

146143
# generate keypair for signing, if this is a SIGN_VERIFY key

0 commit comments

Comments
 (0)
0