Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: replace net.peer.name with dns.hostname in dns plugin
  • Loading branch information
svrnm committed May 18, 2021
commit 79b14ba10db2064790f274e9621b29073cc57b89
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export enum AttributeNames {
DNS_ERROR_CODE = 'dns.error_code',
DNS_ERROR_NAME = 'dns.error_name',
DNS_ERROR_MESSAGE = 'dns.error_message',
DNS_HOSTNAME = 'dns.hostname'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import { LookupAddress } from 'dns';
import { diag, Span, SpanKind } from '@opentelemetry/api';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import {
InstrumentationBase,
InstrumentationNodeModuleDefinition,
Expand All @@ -33,6 +32,7 @@ import {
} from './types';
import * as utils from './utils';
import { VERSION } from './version';
import { AttributeNames } from './enums/AttributeNames';

/**
* Dns instrumentation for Opentelemetry
Expand Down Expand Up @@ -114,7 +114,7 @@ export class DnsInstrumentation extends InstrumentationBase<Dns> {
const span = plugin.tracer.startSpan(name, {
kind: SpanKind.CLIENT,
attributes: {
[SemanticAttributes.NET_PEER_NAME]: hostname,
[AttributeNames.DNS_HOSTNAME]: hostname,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const assertSpan = (
span.status.message
);
assert.strictEqual(
span.attributes[SemanticAttributes.NET_PEER_NAME],
span.attributes[AttributeNames.DNS_HOSTNAME],
validations.hostname
);

Expand Down