Skip to content

Conversation

saartochner-lumigo
Copy link
Contributor

@saartochner-lumigo saartochner-lumigo commented Jul 6, 2020

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

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()}
Copy link
Contributor Author

@saartochner-lumigo saartochner-lumigo Jul 6, 2020

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):
Copy link
Contributor Author

@saartochner-lumigo saartochner-lumigo Jul 6, 2020

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:
Copy link
Contributor Author

@saartochner-lumigo saartochner-lumigo Jul 6, 2020

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]
Copy link
Contributor Author

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,
Copy link
Contributor Author

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
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #120 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
lumigo_tracer/parsers/utils.py 93.05% <0.00%> (-0.61%) ⬇️
lumigo_tracer/sync_http/sync_hook.py 98.86% <0.00%> (-0.54%) ⬇️
lumigo_tracer/parsers/parser.py 100.00% <0.00%> (ø)
lumigo_tracer/parsers/http_data_classes.py 100.00% <0.00%> (ø)
lumigo_tracer/spans_container.py 99.41% <0.00%> (+0.04%) ⬆️
lumigo_tracer/utils.py 91.58% <0.00%> (+1.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a73472c...3675dc2. Read the comment docs.

@saartochner-lumigo saartochner-lumigo merged commit fe11d16 into master Jul 7, 2020
@saartochner-lumigo saartochner-lumigo deleted the RD-3150-faster-hooks branch July 7, 2020 12:32
saartochner-lumigo pushed a commit that referenced this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants