Skip to content
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

[grpc exporter] Handle backoff 1.0 and 2.0 #2915

Closed
wants to merge 3 commits into from

Conversation

Yamakaky
Copy link

@Yamakaky Yamakaky commented Aug 31, 2022

Fixes #2829.

Description

Prevents the use of backoff >= 2.0.0 which has breaking changes that are not handled by the code.

Fixes #2829

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Run locally with pinned version to 1.11.1

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@Yamakaky Yamakaky requested a review from a team August 31, 2022 20:15
@srikanthccv
Copy link
Member

This was originally pinned to strict version but later another contributed made the wide range of acceptable version because their project uses the 2.0. I would rather encourage you to fix the bug instead since the users can still pin the lower version.

@Yamakaky Yamakaky changed the title [grpc exporter] Limit backoff version to < 2.0.0 [grpc exporter] Handle backoff 1.0 and 2.0 Sep 1, 2022
@Yamakaky
Copy link
Author

Yamakaky commented Sep 1, 2022

Done, though I haven't tested it.

@srikanthccv
Copy link
Member

@Yamakaky Please add tests

Copy link
Contributor

@sk- sk- left a comment

Choose a reason for hiding this comment

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

@Yamakaky
Copy link
Author

Yamakaky commented Sep 9, 2022

Oh I see, I'll add that

@srikanthccv
Copy link
Member

@Yamakaky we are planning on releasing 1.13/0.34b0 this week or early next week. Please address the comments and get this merged if you would like to see this included in next release.

@Yamakaky
Copy link
Author

Yamakaky commented Sep 18, 2022

There it is! I updated to backoff 2.0 for grpc and http.

@Yamakaky
Copy link
Author

Hum, I'm not very familiar with tox and how your testing works, so help would be appreciated for fixing the CI issues!

@Yamakaky
Copy link
Author

Note: if this can't be merged for 1.13, please at least add the quickfix to require backoff < 2. This repo cannot work with v2.

@srikanthccv
Copy link
Member

You could pin it to 1.11.1 so pip doesn't install 2.x.

@Yamakaky
Copy link
Author

That's what I did for the first version of my PR. Should I do that again, and keep this long term fix for later?

Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

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

Please make sure to add tests for the changes.

Comment on lines +317 to +325
retry_info_bin = dict(error.trailing_metadata()).get(
"google.rpc.retryinfo-bin"
)
if retry_info_bin is not None:
retry_info = RetryInfo()
retry_info.ParseFromString(retry_info_bin)
delay = (
retry_info.retry_delay.seconds
+ retry_info.retry_delay.nanos / 1.0e9
Copy link
Member

Choose a reason for hiding this comment

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

Where is this used? Earlier it was used to delay the export by sleeping.


return self._result.SUCCESS
except RpcError as error:
Copy link
Member

Choose a reason for hiding this comment

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

Why catch this exception when it's already part of on_exception?


if delay == max_value:
return self._result.FAILURE
@backoff.on_exception(backoff.expo, RpcError, max_time=60, on_backoff=_on_backoff)
Copy link
Member

Choose a reason for hiding this comment

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

Does it have to be a decorator? If I wanted to configure the max_time from the exporter instance how would one do that?

this = details["args"][0]
_, error, _ = sys.exc_info()
assert isinstance(error, RpcError)
wait_delay = details["wait"]
Copy link
Member

Choose a reason for hiding this comment

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

Where is this coming from?

@@ -239,9 +234,7 @@ def __init__(
elif isinstance(self._headers, dict):
self._headers = tuple(self._headers.items())

self._timeout = timeout or int(
Copy link
Member

Choose a reason for hiding this comment

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

Revert your formatting changes. Use the global pyproject.toml config.

if resp.status_code in (200, 202):
return LogExportResult.SUCCESS
elif self._retryable(resp):
return None
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this. Why does it return None and also LogExportResult enum?

if resp.status_code in (200, 202):
return SpanExportResult.SUCCESS
elif self._retryable(resp):
return None
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

@srikanthccv
Copy link
Member

See #2980

@Yamakaky Yamakaky deleted the patch-1 branch November 1, 2022 14:21
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.

backoff.expo v2.0.0 breaking change
4 participants