Skip to content

perf: fewer memory allocation #597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions datadog_lambda/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def parse_event_source(event: dict) -> _EventSource:
event_source = None

# Get requestContext safely and ensure it's a dictionary
request_context = event.get("requestContext", {})
request_context = event.get("requestContext") or {}
if not isinstance(request_context, dict):
request_context = {}
request_context = None

if request_context and request_context.get("stage"):
if "domainName" in request_context and detect_lambda_function_url_domain(
Expand Down Expand Up @@ -291,9 +291,9 @@ def extract_http_tags(event):
http_tags = {}

# Safely get request_context and ensure it's a dictionary
request_context = event.get("requestContext", {})
request_context = event.get("requestContext") or {}
if not isinstance(request_context, dict):
request_context = {}
request_context = None

path = event.get("path")
method = event.get("httpMethod")
Expand Down
Loading