Skip to content

Commit 577b4b4

Browse files
committed
add keepalive server trace back in to match channelz vs non-channelz trace behavior
1 parent d799a7a commit 577b4b4

File tree

1 file changed

+42
-35
lines changed

1 file changed

+42
-35
lines changed

packages/grpc-js/src/server.ts

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,74 +18,74 @@
1818
import * as http2 from 'http2';
1919
import * as util from 'util';
2020

21+
import { CipherNameAndProtocol, TLSSocket } from 'tls';
2122
import { ServiceError } from './call';
22-
import { Status, LogVerbosity } from './constants';
23+
import { PartialStatusObject } from './call-interface';
24+
import { ChannelOptions } from './channel-options';
25+
import {
26+
ChannelzCallTracker,
27+
ChannelzCallTrackerStub,
28+
ChannelzChildrenTracker,
29+
ChannelzChildrenTrackerStub,
30+
ChannelzTrace,
31+
ChannelzTraceStub,
32+
ServerInfo,
33+
ServerRef,
34+
SocketInfo,
35+
SocketRef,
36+
TlsInfo,
37+
registerChannelzServer,
38+
registerChannelzSocket,
39+
unregisterChannelzRef,
40+
} from './channelz';
41+
import { LogVerbosity, Status } from './constants';
42+
import * as logging from './logging';
2343
import { Deserialize, Serialize, ServiceDefinition } from './make-client';
2444
import { Metadata } from './metadata';
45+
import {
46+
ResolverListener,
47+
createResolver,
48+
mapUriDefaultScheme,
49+
} from './resolver';
2550
import {
2651
BidiStreamingHandler,
2752
ClientStreamingHandler,
2853
HandleCall,
2954
Handler,
3055
HandlerType,
31-
sendUnaryData,
3256
ServerDuplexStream,
3357
ServerDuplexStreamImpl,
58+
ServerErrorResponse,
3459
ServerReadableStream,
60+
ServerStatusResponse,
3561
ServerStreamingHandler,
3662
ServerUnaryCall,
3763
ServerWritableStream,
3864
ServerWritableStreamImpl,
3965
UnaryHandler,
40-
ServerErrorResponse,
41-
ServerStatusResponse,
66+
sendUnaryData,
4267
serverErrorToStatus,
4368
} from './server-call';
4469
import { ServerCredentials } from './server-credentials';
45-
import { ChannelOptions } from './channel-options';
4670
import {
47-
createResolver,
48-
ResolverListener,
49-
mapUriDefaultScheme,
50-
} from './resolver';
51-
import * as logging from './logging';
71+
ServerInterceptingCallInterface,
72+
ServerInterceptor,
73+
getServerInterceptingCall,
74+
} from './server-interceptors';
5275
import {
5376
SubchannelAddress,
5477
isTcpSubchannelAddress,
55-
subchannelAddressToString,
5678
stringToSubchannelAddress,
79+
subchannelAddressToString,
5780
} from './subchannel-address';
81+
import { CallEventTracker } from './transport';
5882
import {
5983
GrpcUri,
6084
combineHostPort,
6185
parseUri,
6286
splitHostPort,
6387
uriToString,
6488
} from './uri-parser';
65-
import {
66-
ChannelzCallTracker,
67-
ChannelzCallTrackerStub,
68-
ChannelzChildrenTracker,
69-
ChannelzChildrenTrackerStub,
70-
ChannelzTrace,
71-
ChannelzTraceStub,
72-
registerChannelzServer,
73-
registerChannelzSocket,
74-
ServerInfo,
75-
ServerRef,
76-
SocketInfo,
77-
SocketRef,
78-
TlsInfo,
79-
unregisterChannelzRef,
80-
} from './channelz';
81-
import { CipherNameAndProtocol, TLSSocket } from 'tls';
82-
import {
83-
ServerInterceptingCallInterface,
84-
ServerInterceptor,
85-
getServerInterceptingCall,
86-
} from './server-interceptors';
87-
import { PartialStatusObject } from './call-interface';
88-
import { CallEventTracker } from './transport';
8989

9090
const UNLIMITED_CONNECTION_AGE_MS = ~(1 << 31);
9191
const KEEPALIVE_MAX_TIME_MS = ~(1 << 31);
@@ -1469,6 +1469,12 @@ export class Server {
14691469
clearKeepaliveTimeout();
14701470
if (err) {
14711471
this.keepaliveTrace('Ping failed with error: ' + err.message);
1472+
this.trace(
1473+
'Connection dropped due to error of a ping frame ' +
1474+
err.message +
1475+
' return in ' +
1476+
duration
1477+
);
14721478
sessionClosedByServer = true;
14731479
session.close();
14741480
} else {
@@ -1480,6 +1486,7 @@ export class Server {
14801486

14811487
if (!pingSentSuccessfully) {
14821488
this.keepaliveTrace('Ping failed to send');
1489+
this.trace('Connection dropped due to failure to send ping frame');
14831490
sessionClosedByServer = true;
14841491
session.close();
14851492
return;

0 commit comments

Comments
 (0)