Skip to content

Commit c4fc1db

Browse files
authored
Merge pull request #1926 from grpc/master
Merge master into 1.4.x (i.e. backport channelz to 1.4.x)
2 parents e5a13a5 + 95290ae commit c4fc1db

File tree

76 files changed

+4241
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4241
-167
lines changed

TROUBLESHOOTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide is for troubleshooting the `grpc-js` library for Node.js
44

55
## Enabling extra logging and tracing
66

7-
Extra logging can be very useful for diagnosing problems. `grpc-js` supporst
7+
Extra logging can be very useful for diagnosing problems. `grpc-js` supports
88
the `GRPC_VERBOSITY` and `GRPC_TRACE` environment variables that can be used to increase the amount of information
99
that gets printed to stderr.
1010

packages/grpc-js-xds/src/load-balancer-eds.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,7 @@ export class EdsLoadBalancer implements LoadBalancer {
185185
private concurrentRequests: number = 0;
186186

187187
constructor(private readonly channelControlHelper: ChannelControlHelper) {
188-
this.childBalancer = new ChildLoadBalancerHandler({
189-
createSubchannel: (subchannelAddress, subchannelArgs) =>
190-
this.channelControlHelper.createSubchannel(
191-
subchannelAddress,
192-
subchannelArgs
193-
),
194-
requestReresolution: () =>
195-
this.channelControlHelper.requestReresolution(),
188+
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.channelControlHelper, {
196189
updateState: (connectivityState, originalPicker) => {
197190
if (this.latestEdsUpdate === null) {
198191
return;
@@ -243,7 +236,7 @@ export class EdsLoadBalancer implements LoadBalancer {
243236
};
244237
this.channelControlHelper.updateState(connectivityState, edsPicker);
245238
},
246-
});
239+
}));
247240
this.watcher = {
248241
onValidUpdate: (update) => {
249242
trace('Received EDS update for ' + this.edsServiceName + ': ' + JSON.stringify(update, undefined, 2));

packages/grpc-js-xds/src/load-balancer-lrs.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,14 @@ export class LrsLoadBalancer implements LoadBalancer {
174174
private localityStatsReporter: XdsClusterLocalityStats | null = null;
175175

176176
constructor(private channelControlHelper: ChannelControlHelper) {
177-
this.childBalancer = new ChildLoadBalancerHandler({
178-
createSubchannel: (subchannelAddress, subchannelArgs) =>
179-
channelControlHelper.createSubchannel(
180-
subchannelAddress,
181-
subchannelArgs
182-
),
183-
requestReresolution: () => channelControlHelper.requestReresolution(),
177+
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(channelControlHelper, {
184178
updateState: (connectivityState: ConnectivityState, picker: Picker) => {
185179
if (this.localityStatsReporter !== null) {
186180
picker = new LoadReportingPicker(picker, this.localityStatsReporter);
187181
}
188182
channelControlHelper.updateState(connectivityState, picker);
189183
},
190-
});
184+
}));
191185
}
192186

193187
updateAddressList(

packages/grpc-js-xds/src/load-balancer-priority.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,11 @@ export class PriorityLoadBalancer implements LoadBalancer {
139139
private failoverTimer: NodeJS.Timer | null = null;
140140
private deactivationTimer: NodeJS.Timer | null = null;
141141
constructor(private parent: PriorityLoadBalancer, private name: string) {
142-
this.childBalancer = new ChildLoadBalancerHandler({
143-
createSubchannel: (
144-
subchannelAddress: SubchannelAddress,
145-
subchannelArgs: ChannelOptions
146-
) => {
147-
return this.parent.channelControlHelper.createSubchannel(
148-
subchannelAddress,
149-
subchannelArgs
150-
);
151-
},
142+
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.parent.channelControlHelper, {
152143
updateState: (connectivityState: ConnectivityState, picker: Picker) => {
153144
this.updateState(connectivityState, picker);
154145
},
155-
requestReresolution: () => {
156-
this.parent.channelControlHelper.requestReresolution();
157-
},
158-
});
146+
}));
159147
this.picker = new QueuePicker(this.childBalancer);
160148
}
161149

packages/grpc-js-xds/src/load-balancer-weighted-target.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,11 @@ export class WeightedTargetLoadBalancer implements LoadBalancer {
168168
private weight: number = 0;
169169

170170
constructor(private parent: WeightedTargetLoadBalancer, private name: string) {
171-
this.childBalancer = new ChildLoadBalancerHandler({
172-
createSubchannel: (subchannelAddress, subchannelOptions) => {
173-
return this.parent.channelControlHelper.createSubchannel(subchannelAddress, subchannelOptions);
174-
},
175-
updateState: (connectivityState, picker) => {
171+
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.parent.channelControlHelper, {
172+
updateState: (connectivityState: ConnectivityState, picker: Picker) => {
176173
this.updateState(connectivityState, picker);
177174
},
178-
requestReresolution: () => {
179-
this.parent.channelControlHelper.requestReresolution();
180-
}
181-
});
175+
}));
182176

183177
this.picker = new QueuePicker(this.childBalancer);
184178
}

packages/grpc-js-xds/src/load-balancer-xds-cluster-manager.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,11 @@ class XdsClusterManager implements LoadBalancer {
131131
private childBalancer: ChildLoadBalancerHandler;
132132

133133
constructor(private parent: XdsClusterManager, private name: string) {
134-
this.childBalancer = new ChildLoadBalancerHandler({
135-
createSubchannel: (subchannelAddress, subchannelOptions) => {
136-
return this.parent.channelControlHelper.createSubchannel(subchannelAddress, subchannelOptions);
137-
},
138-
updateState: (connectivityState, picker) => {
134+
this.childBalancer = new ChildLoadBalancerHandler(experimental.createChildChannelControlHelper(this.parent.channelControlHelper, {
135+
updateState: (connectivityState: ConnectivityState, picker: Picker) => {
139136
this.updateState(connectivityState, picker);
140137
},
141-
requestReresolution: () => {
142-
this.parent.channelControlHelper.requestReresolution();
143-
}
144-
});
138+
}));
145139

146140
this.picker = new QueuePicker(this.childBalancer);
147141
}

packages/grpc-js/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"types": "build/src/index.d.ts",
1616
"license": "Apache-2.0",
1717
"devDependencies": {
18-
"@grpc/proto-loader": "^0.5.5",
1918
"@types/gulp": "^4.0.6",
2019
"@types/gulp-mocha": "0.0.32",
2120
"@types/lodash": "^4.14.108",
@@ -54,9 +53,11 @@
5453
"check": "gts check src/**/*.ts",
5554
"fix": "gts fix src/*.ts",
5655
"pretest": "npm run compile",
57-
"posttest": "npm run check && madge -c ./build/src"
56+
"posttest": "npm run check && madge -c ./build/src",
57+
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ -O src/generated/ --grpcLib ../index channelz.proto"
5858
},
5959
"dependencies": {
60+
"@grpc/proto-loader": "^0.6.4",
6061
"@types/node": ">=12.12.47"
6162
},
6263
"files": [

0 commit comments

Comments
 (0)