Conversation
67df505 to
ddd6e8f
Compare
5d67c5a to
ab63f1b
Compare
src/index.ts
Outdated
| [P in keyof T]: P extends U ? EnumKey<E> | null | undefined : T[P]; | ||
| }; | ||
|
|
||
| function getUniverseDomainOnly(options: SpannerOptions): string { |
There was a problem hiding this comment.
nit: rename to getUniverseDomain
| defaultTransactionOptions?: Pick<RunTransactionOptions, 'isolationLevel'>; | ||
| observabilityOptions?: ObservabilityOptions; | ||
| interceptors?: any[]; | ||
| universe_domain?: string; |
There was a problem hiding this comment.
add the documentation for it
src/index.ts
Outdated
| options?.universeDomain && | ||
| options?.universe_domain !== options?.universeDomain | ||
| ) { | ||
| throw new Error( |
There was a problem hiding this comment.
I am not getting this , why do we have two different properties ?
There was a problem hiding this comment.
at gax level we are handling both the options, which is why we are handling two different properties here as well
There was a problem hiding this comment.
based on our offline discussion, we will handling this error in separate PR, hence I have removed this piece of code from here
ad1ce47 to
5cea51f
Compare
src/index.ts
Outdated
| * | ||
| * This function checks for a universe domain in the following order: | ||
| * 1. The `universeDomain` property within the provided spanner options. | ||
| * 2. The `GOOGLE_CLOUD_UNIVERSE_DOMAIN` environment variable. |
There was a problem hiding this comment.
why is this required? is it a standard across all the libraries?
There was a problem hiding this comment.
to make the implementation consistent with the gax library I am checkin domain via env as well
is it a standard across all the libraries?
otherwise no, if we see other database libraries, Bigtable is handling it(they have merged the PR as well), while BigQuery is not handling via env(they also have merged the PR)
@rahul2393 can you please confirm for Spanner Go client?
There was a problem hiding this comment.
note: we are not merging this PR, the setup and implementation is just for manual testing
There was a problem hiding this comment.
I can see that autogenerated clients are using the same env
src/index.ts
Outdated
| /** | ||
| * The Trusted Cloud Domain (TPC) DNS of the service used to make requests. | ||
| */ | ||
| universe_domain?: string; |
There was a problem hiding this comment.
why are we having two options.
There was a problem hiding this comment.
because gax libraries are handling both the options
https://github.com/googleapis/gax-nodejs/blob/main/gax/src/clientInterface.ts#L43-#L44
There was a problem hiding this comment.
I think we are asking clients to configure it. There's no compelling reasons for us to have both unless it's defined as standard across all the libraries.
There was a problem hiding this comment.
I can see that autogenerated clients are also having two fields for same variable. Would you mind checking with gax or nodejs or TPC to understand the rational behind this decision?
There was a problem hiding this comment.
sure let me check with the team
src/index.ts
Outdated
| options.sslCreds = grpc.credentials.createInsecure(); | ||
| } | ||
|
|
||
| const universeDomain = getDomain('spanner', options); |
There was a problem hiding this comment.
rename this. universeDomain usually used for googleapis.com. but result is spanner url.
src/index.ts
Outdated
| ); | ||
| ensureInitialContextManagerSet(); | ||
| this._nthClientId = nextSpannerClientId(); | ||
| this._universeDomain = getUniverseDomain(options); |
There was a problem hiding this comment.
why are we calling getUniverseDomain again here, save it the first time .
| options.sslCreds = grpc.credentials.createInsecure(); | ||
| } | ||
|
|
||
| const universeEndpoint = getUniverseDomain(options); |
There was a problem hiding this comment.
why do you need an extra variable?
There was a problem hiding this comment.
we were calling getUniverseDomain(options) at two points:
const spannerUniverseEndpoint = 'spanner.' + getUniverseDomain(options);
this._universeDomain = getUniverseDomain(options);
so now I am storing the value returned from the method getUniverseDomain in a single variable and using that variable on those two places
There was a problem hiding this comment.
the change has been made with ref to this comment
This PR contains the code changes for supporting TPC in node client.