Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 66ebc78

Browse files
jinmelmayurkale22
authored andcommitted
Use options.host instead of options.hostname (#416) (#417)
1 parent 096eb70 commit 66ebc78

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • packages/opencensus-instrumentation-http/src

packages/opencensus-instrumentation-http/src/http.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,8 @@ export class HttpPlugin extends BasePlugin {
377377
const tags = new TagMap();
378378
tags.set(stats.HTTP_CLIENT_METHOD, {value: method});
379379

380-
if (options.hostname) {
381-
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, options.hostname);
382-
}
380+
const host = options.hostname || options.host || 'localhost';
381+
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, host);
383382
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_METHOD, method);
384383
if (options.path) {
385384
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_PATH, options.path);

0 commit comments

Comments
 (0)