Skip to content

refactor: drop dependency on @google-cloud/common-grpc#554

Merged
JustinBeckwith merged 3 commits intomasterfrom
less
Oct 18, 2019
Merged

refactor: drop dependency on @google-cloud/common-grpc#554
JustinBeckwith merged 3 commits intomasterfrom
less

Conversation

@JustinBeckwith
Copy link
Contributor

@JustinBeckwith JustinBeckwith commented Oct 11, 2019

This is more a conversation starter than anything. The @google-cloud/common-grpc module creates a few problems for us:

  • google-gax, @google-cloud/common, and @google-cloud/common-grpc all reference google-auth-library, which is causing diamond dependency issues when we update things
  • We are looking to make broad updates to the transport layers, and I'd like to reduce the number of common core libs we try to use

There is some code copying in here in decorateStatus I don't feel great about. Hoping @alexander-fenster will have suggestions on if/how/where in gax this could live.

With minimal effort, we could also drop the dependency on @google-cloud/common. The error util libraries seem to be the only bits we're using. We should have a single set of Error classes we're using, and have those potentially available in their own shared single use library.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 11, 2019
@JustinBeckwith JustinBeckwith added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 11, 2019
@codecov
Copy link

codecov bot commented Oct 11, 2019

Codecov Report

Merging #554 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #554      +/-   ##
==========================================
+ Coverage   97.79%   97.81%   +0.02%     
==========================================
  Files          10       11       +1     
  Lines        1313     1329      +16     
  Branches      347      349       +2     
==========================================
+ Hits         1284     1300      +16     
  Partials       29       29
Impacted Files Coverage Δ
src/index.ts 99.23% <100%> (ø) ⬆️
src/table.ts 98.47% <100%> (ø) ⬆️
src/decorateStatus.ts 100% <100%> (ø)

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 1139576...6530010. Read the comment docs.

src/index.ts Outdated
noResponseRetries: 0,
objectMode: true,
shouldRetryFn: (Service as any).shouldRetryRequest_,
shouldRetryFn: r => [429, 500, 502, 503].indexOf(r.code) > -1,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should refactor this to use gax for handling retries, it's perfectly capable of doing it. (I didn't read this code so it might be harder than it sounds)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hrumph. The comments in the code point to here, which makes me think maybe we don't support retries natively here yet?
https://github.com/googleapis/gax-nodejs/blob/master/src/streamingCalls/streamDescriptor.ts#L55

Copy link

Choose a reason for hiding this comment

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

likewise, I care less about this logic being pulled in from grpc-common, and care more that we make sure there's one test that exercise the retry logic.

@JustinBeckwith JustinBeckwith removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Oct 12, 2019
Copy link

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

I support @JustinBeckwith's approach of simply pulling in the logic from common-grpc, rather than undertaking a more extensive refactor in this PR; the benefit being that we more towards it being easier to pin @grpc/grpc-js.

I do think it would be beneficial to refactor this logic out of bigtable, it feels like it's logic that probably shouldn't be in this layer.

I've created a ticket tracking this follow up work: #556

src/index.ts Outdated
noResponseRetries: 0,
objectMode: true,
shouldRetryFn: (Service as any).shouldRetryRequest_,
shouldRetryFn: r => [429, 500, 502, 503].indexOf(r.code) > -1,
Copy link

Choose a reason for hiding this comment

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

likewise, I care less about this logic being pulled in from grpc-common, and care more that we make sure there's one test that exercise the retry logic.

@JustinBeckwith JustinBeckwith merged commit bd632d9 into master Oct 18, 2019
@stephenplusplus stephenplusplus deleted the less branch November 26, 2019 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants