-
Notifications
You must be signed in to change notification settings - Fork 10
RD-3150 - faster http hooks #120
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
Conversation
self.method = kwargs["method"] | ||
self.uri = kwargs["uri"] | ||
self.headers = kwargs.get("headers") | ||
self.headers = {k.lower(): v for k, v in (kwargs.get("headers") or {}).items()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowering everything once (instead of the underline __getter__
function) ~6s
def should_scrub_domain(url: str) -> bool: | ||
if url and Configuration.domains_scrubber: | ||
for regex in Configuration.domains_scrubber: | ||
if re.match(regex, url, re.IGNORECASE): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compile regexes once (~3s)
headers, body = data.split(_BODY_HEADER_SPLITTER, 1) | ||
if _FLAGS_HEADER_SPLITTER in headers: | ||
hooked_headers = getattr(instance, LUMIGO_HEADERS_HOOK_KEY, None) | ||
if hooked_headers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of parse the headers from the bytes - use the hook (~20s)
else: | ||
Configuration.domains_scrubber = DOMAIN_SCRUBBER_REGEXES | ||
domains_scrubber_regex = DOMAIN_SCRUBBER_REGEXES | ||
Configuration.domains_scrubber = [re.compile(r, re.IGNORECASE) for r in domains_scrubber_regex] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compile only on configuration
"region": region, | ||
"parentId": request_id, | ||
"info": {"tracer": {"version": version}, "traceId": {"Root": trace_root}}, | ||
"event": event, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send the event and envs only on functions spans
Codecov Report
@@ Coverage Diff @@
## master #120 +/- ##
==========================================
+ Coverage 96.21% 96.28% +0.06%
==========================================
Files 11 11
Lines 952 996 +44
==========================================
+ Hits 916 959 +43
- Misses 36 37 +1
Continue to review full report at Codecov.
|
a73472c layers-table: layers md [skip ci]
banchmark: lambda with 256MB memory, doing 10,000 ddb get_item requests, with xray that close a segment every 1000 requests.
Without lumigo: 241s
With old lumigo: 320s
with new lumigo: 292s
I.e. total of 35.5% less overhead