Skip to content

Conversation

@saartochner-lumigo
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Jan 4, 2021

Codecov Report

Merging #175 (e24d3c1) into master (827a7a9) will increase coverage by 1.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
+ Coverage   96.21%   97.44%   +1.22%     
==========================================
  Files          11       22      +11     
  Lines         952     1762     +810     
==========================================
+ Hits          916     1717     +801     
- Misses         36       45       +9     
Impacted Files Coverage Δ
lumigo_tracer/sync_http/handler.py
lumigo_tracer/sync_http/sync_hook.py
lumigo_tracer/parsers/http_data_classes.py
lumigo_tracer/parsers/parser.py
lumigo_tracer/parsers/event_parser.py
lumigo_tracer/parsers/utils.py
lumigo_tracer/utils.py
lumigo_tracer/wrappers/pymongo/pymongo_wrapper.py 89.74% <0.00%> (ø)
lumigo_tracer/lumigo_utils.py 95.23% <0.00%> (ø)
lumigo_tracer/auto_instrument_handler.py 100.00% <0.00%> (ø)
... and 16 more

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 cecc8f3...e24d3c1. Read the comment docs.

Copy link
Contributor

@nirLumigo nirLumigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

raise RuntimeError(
f"Invalid handler format: Bad handler '{os.environ[ORIGINAL_HANDLER_KEY]}': not enough values to unpack (expected 2, got 1)"
)
) from None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding from None? The user will lose the context of the exception:
image

Same regarding the other from None is this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I tried to copied AWS behavior:
image

raise ImportError(
f"Unable to import module '{handler_module}': No module named '{handler_module}'"
)
f"Runtime.ImportModuleError: Unable to import module '{handler_module}': {str(e)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you even add of original exception in the text. Don't you prefer to do from e instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to copy AWS's bootstrap default behavior:
image

def test_import_error(monkeypatch):
monkeypatch.setenv(ORIGINAL_HANDLER_KEY, "blabla.not.exists")

with pytest.raises(ImportError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do it with pytest.raises?
Same issue regarding the other tests in this file as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great question!
I did use pytest.raises in the first place, but then I noticed that it removes the context of the message, and I want to validate that there was no context (to follow AWS behavior!) :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment explaining why don't we use it

def test_import_error(monkeypatch):
monkeypatch.setenv(ORIGINAL_HANDLER_KEY, "blabla.not.exists")

with pytest.raises(ImportError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment explaining why don't we use it

@saartochner-lumigo saartochner-lumigo merged commit a547560 into master Jan 5, 2021
@saartochner-lumigo saartochner-lumigo deleted the RD-4296-auto-instrument-original-errors branch January 5, 2021 11:57
saartochner-lumigo pushed a commit that referenced this pull request Jan 5, 2021
…gy of the original handler (#175)

cecc8f3 layers-table: layers md [skip ci]
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.

3 participants