Skip to content

Commit

Permalink
Merge pull request #1387 from badsyntax/grpc-js--better-trace-logs
Browse files Browse the repository at this point in the history
grpc-js: fix target in tracing logs
  • Loading branch information
murgatroid99 authored Apr 23, 2020
2 parents 79d3cfe + 9bd0864 commit 5d54686
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/grpc-js/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export class ChannelImplementation implements Channel {
trace(
LogVerbosity.DEBUG,
'connectivity_state',
this.target +
uriToString(this.target) +
' ' +
ConnectivityState[this.connectivityState] +
' -> ' +
Expand Down Expand Up @@ -496,7 +496,7 @@ export class ChannelImplementation implements Channel {
trace(
LogVerbosity.DEBUG,
'channel',
this.target +
uriToString(this.target) +
' createCall [' +
callNumber +
'] method="' +
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-js/src/http_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function mapProxyName(
const serverHost = hostPort.host;
for (const host of getNoProxyHostList()) {
if (host === serverHost) {
trace('Not using proxy for target in no_proxy list: ' + target);
trace('Not using proxy for target in no_proxy list: ' + uriToString(target));
return noProxyResult;
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/grpc-js/src/resolver-dns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class DnsResolver implements Resolver {

this.defaultResolutionError = {
code: Status.UNAVAILABLE,
details: `Name resolution failed for target ${this.target}`,
details: `Name resolution failed for target ${uriToString(this.target)}`,
metadata: new Metadata(),
};
}
Expand All @@ -122,7 +122,7 @@ class DnsResolver implements Resolver {
*/
private startResolution() {
if (this.ipResult !== null) {
trace('Returning IP address for target ' + this.target);
trace('Returning IP address for target ' + uriToString(this.target));
setImmediate(() => {
this.listener.onSuccessfulResolution(this.ipResult!, null, null);
});
Expand All @@ -132,7 +132,7 @@ class DnsResolver implements Resolver {
setImmediate(() => {
this.listener.onError({
code: Status.UNAVAILABLE,
details: `Failed to parse DNS address ${this.target}`,
details: `Failed to parse DNS address ${uriToString(this.target)}`,
metadata: new Metadata(),
});
});
Expand Down Expand Up @@ -171,7 +171,7 @@ class DnsResolver implements Resolver {
']';
trace(
'Resolved addresses for target ' +
this.target +
uriToString(this.target) +
': ' +
allAddressesString
);
Expand All @@ -192,7 +192,7 @@ class DnsResolver implements Resolver {
(err) => {
trace(
'Resolution error for target ' +
this.target +
uriToString(this.target) +
': ' +
(err as Error).message
);
Expand Down Expand Up @@ -254,7 +254,7 @@ class DnsResolver implements Resolver {
}

updateResolution() {
trace('Resolution update requested for target ' + this.target);
trace('Resolution update requested for target ' + uriToString(this.target));
if (this.pendingLookupPromise === null) {
this.startResolution();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/grpc-js/src/resolving-load-balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { Metadata } from './metadata';
import * as logging from './logging';
import { LogVerbosity } from './constants';
import { SubchannelAddress } from './subchannel';
import { GrpcUri } from './uri-parser';
import { GrpcUri, uriToString } from './uri-parser';

const TRACER_NAME = 'resolving_load_balancer';

Expand Down Expand Up @@ -353,7 +353,7 @@ export class ResolvingLoadBalancer implements LoadBalancer {

private updateState(connectivitystate: ConnectivityState, picker: Picker) {
trace(
this.target +
uriToString(this.target) +
' ' +
ConnectivityState[this.currentState] +
' -> ' +
Expand Down

0 comments on commit 5d54686

Please sign in to comment.