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

Use options.host instead of options.hostname (#416) #417

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/opencensus-instrumentation-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,8 @@ export class HttpPlugin extends BasePlugin {
const tags = new TagMap();
tags.set(stats.HTTP_CLIENT_METHOD, {value: method});

if (options.hostname) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hostname is preferred over host. I would suggest to add below line.
const host = options.hostname || options.host || 'localhost'; WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const host = options.hostname || options.host || 'localhost';
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_HOST, host);

This change will also fix failing build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

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);
Expand Down