Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Add annotated_exceptions #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add annotated_exceptions #94

wants to merge 1 commit into from

Conversation

idanarye
Copy link

No description provided.

@idanarye idanarye force-pushed the annotate-exceptions branch from fcaea98 to 08b15fb Compare July 10, 2018 16:38
@idanarye
Copy link
Author

There are many places where this will be useful, but specifically I want to use it in https://wekaio.atlassian.net/browse/WEKAPP-68225:

def _cloud_rpc(self, method, *params_list, **params_dict):
	    with annotated_exceptions() as annotate:
		    # ...

		    if ":" in parsed.netloc:
			    host, port = parsed.netloc.split(":")
		    else:
			    host, port = parsed.netloc, None
		    annotate(host=host, port=port)

		    # ...

		    annotate(path=path)

		    @retrying(times=3, acceptable=(ConnectionError, OSError), sleep=1, max_sleep=5)  # this is to deal with sporadic disconnections
		    @retrying(times=5, acceptable=(httpclient.HTTPException, HTTPException), sleep=5, max_sleep=10)
		    @retrying(times=2, acceptable=RetrySignal, sleep=0)  # this is in case a Retry was intentionally requested
		    @retrying(times=6, acceptable=exceptions.CloudIdentityTokenAcquireFailure, sleep=5)  # retry if portal is unavailable
		    def perform_cloud_request():
			    # ...

		    return perform_cloud_request()

With this, even builtin exceptions will be converted to something we can annotate.

@idanarye idanarye requested a review from koreno July 10, 2018 16:40
@idanarye idanarye changed the title Add annotate_exceptions Add annotated_exceptions Jul 10, 2018
@idanarye idanarye force-pushed the annotate-exceptions branch from 08b15fb to 1ea2785 Compare July 19, 2018 16:35
@koreno
Copy link
Contributor

koreno commented Dec 23, 2019

If you fix the conflicts I think we should merge this

@idanarye idanarye force-pushed the annotate-exceptions branch 3 times, most recently from b72100d to 66968c4 Compare December 24, 2019 13:37
@idanarye idanarye force-pushed the annotate-exceptions branch from 66968c4 to 2485777 Compare December 24, 2019 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants