From 66ebc78ab4a314afc084eed97bfc01f428487601 Mon Sep 17 00:00:00 2001 From: Jin Suk Park Date: Thu, 14 Mar 2019 02:04:49 +0900 Subject: [PATCH] Use options.host instead of options.hostname (#416) (#417) --- packages/opencensus-instrumentation-http/src/http.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/opencensus-instrumentation-http/src/http.ts b/packages/opencensus-instrumentation-http/src/http.ts index 8415e689c..011f4486f 100644 --- a/packages/opencensus-instrumentation-http/src/http.ts +++ b/packages/opencensus-instrumentation-http/src/http.ts @@ -377,9 +377,8 @@ export class HttpPlugin extends BasePlugin { const tags = new TagMap(); tags.set(stats.HTTP_CLIENT_METHOD, {value: method}); - if (options.hostname) { - span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, options.hostname); - } + const host = options.hostname || options.host || 'localhost'; + span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, host); span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_METHOD, method); if (options.path) { span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_PATH, options.path);