8000 improvements after some discussion with Ben · localstack/localstack@cd06d1a · GitHub
[go: up one dir, main page]

Skip to content

Commit cd06d1a

Browse files
committed
improvements after some discussion with Ben
1 parent c219ef5 commit cd06d1a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

localstack-core/localstack/aws/handlers/validation.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ def _record_usage(self, context: RequestContext) -> None:
5353
user_agent = context.request.headers.get("User-Agent")
5454
if not request_path or not user_agent:
5555
return
56-
collector = UsageCollectorFactory.get_collector(context.request.path)
56+
# Skip the endpoints for the new API Gateway implementation
57+
if "execute-api" in request_path:
58+
return
59+
# We only record the first segment in the path after the _internal/ or _aws/ prefix, as a path can have
60+
# potentially an infinite number of parameters.
61+
recorded_path = request_path.split("/")[":2"]
62+
if len(recorded_path) < 2:
63+
return
64+
recorded_path = "/".join(recorded_path)
65+
collector = UsageCollectorFactory.get_collector(recorded_path)
5766
collector.record(user_agent)
5867

5968
def _load_specs(self) -> None:

0 commit comments

Comments
 (0)
0