Skip to content

Commit

Permalink
Allow host to be overridden in httpServer instrumentation (openzipkin…
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Coedo committed Jul 10, 2018
1 parent 5ec1c8d commit ecd3cb7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/zipkin/src/instrumentation/httpServer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const Annotation = require('../annotation');
const Header = require('../httpHeaders');
const {Some, None} = require('../option');
const InetAddress = require('../InetAddress');
const TraceId = require('../tracer/TraceId');
const Annotation = require('../annotation');
const parseRequestUrl = require('../parseUrl');
const {Some, None} = require('../option');

function stringToBoolean(str) {
return str === '1' || str === 'true';
Expand All @@ -28,10 +29,12 @@ class HttpServerInstrumentation {
constructor({
tracer = requiredArg('tracer'),
serviceName = tracer.localEndpoint.serviceName,
port = requiredArg('port')
host,
port = requiredArg('port'),
}) {
this.tracer = tracer;
this.serviceName = serviceName;
this.host = host && new InetAddress(host);
this.port = port;
}

Expand Down Expand Up @@ -78,7 +81,7 @@ class HttpServerInstrumentation {
this.tracer.recordRpc(method.toUpperCase());
this.tracer.recordBinary('http.path', path);
this.tracer.recordAnnotation(new Annotation.ServerRecv());
this.tracer.recordAnnotation(new Annotation.LocalAddr({port: this.port}));
this.tracer.recordAnnotation(new Annotation.LocalAddr({host: this.host, port: this.port}));

return id;
}
Expand Down

0 comments on commit ecd3cb7

Please sign in to comment.