Skip to content

Commit 978f4cb

Browse files
committed
Add tracing, reorder LRS stream start call
1 parent 608f087 commit 978f4cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/grpc-js-xds/src/xds-client.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ class LrsCallState {
680680

681681
private handleStreamStatus(status: StatusObject) {
682682
this.client.trace(
683-
'ADS stream ended. code=' + status.code + ' details= ' + status.details
683+
'LRS stream ended. code=' + status.code + ' details= ' + status.details
684684
);
685685
this.client.handleLrsStreamEnd();
686686
}
@@ -913,6 +913,7 @@ class XdsSingleServerClient {
913913
if (this.adsCallState || this.refcount < 1) {
914914
return;
915915
}
916+
this.trace('Starting ADS stream');
916917
const metadata = new Metadata({waitForReady: true});
917918
const call = this.adsClient.StreamAggregatedResources(metadata);
918919
this.adsCallState = new AdsCallState(this, call, this.xdsClient.adsNode!);
@@ -937,6 +938,7 @@ class XdsSingleServerClient {
937938
if (this.lrsCallState || this.refcount < 1 || this.clusterStatsMap.size < 1) {
938939
return;
939940
}
941+
this.trace('Starting LRS stream');
940942
const metadata = new Metadata({waitForReady: true});
941943
const call = this.lrsClient.StreamLoadStats(metadata);
942944
this.lrsCallState = new LrsCallState(this, call, this.xdsClient.lrsNode!);
@@ -976,11 +978,11 @@ class XdsSingleServerClient {
976978
edsServiceName: string
977979
): XdsClusterDropStats {
978980
this.trace('addClusterDropStats(clusterName=' + clusterName + ', edsServiceName=' + edsServiceName + ')');
979-
this.maybeStartLrsStream();
980981
const clusterStats = this.clusterStatsMap.getOrCreate(
981982
clusterName,
982983
edsServiceName
983984
);
985+
this.maybeStartLrsStream();
984986
return {
985987
addUncategorizedCallDropped: () => {
986988
clusterStats.uncategorizedCallsDropped += 1;
@@ -1003,11 +1005,11 @@ class XdsSingleServerClient {
10031005
locality: Locality__Output
10041006
): XdsClusterLocalityStats {
10051007
this.trace('addClusterLocalityStats(clusterName=' + clusterName + ', edsServiceName=' + edsServiceName + ', locality=' + JSON.stringify(locality) + ')');
1006-
this.maybeStartLrsStream();
10071008
const clusterStats = this.clusterStatsMap.getOrCreate(
10081009
clusterName,
10091010
edsServiceName
10101011
);
1012+
this.maybeStartLrsStream();
10111013
let localityStats: ClusterLocalityStats | null = null;
10121014
for (const statsObj of clusterStats.localityStats) {
10131015
if (localityEqual(locality, statsObj.locality)) {

0 commit comments

Comments
 (0)