-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dns): Add option to include name as attribute in dns lookup #1178
Conversation
Defaults to false for compatibility
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1178 +/- ##
==========================================
+ Coverage 96.08% 96.29% +0.21%
==========================================
Files 14 18 +4
Lines 893 1079 +186
Branches 191 218 +27
==========================================
+ Hits 858 1039 +181
- Misses 35 40 +5
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dyladan - I saw in #488 that you were against capturing this attribute as default.
@evantorrie wrote some arguments in #1165
I think it can be useful to always capture this attribute
plugins/node/opentelemetry-instrumentation-dns/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
assert.strictEqual(spans.length, 1); | ||
assertSpan(span, { | ||
addresses: [], | ||
hostname: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will not verify it's omitted, as the code in assertSpan
will skip the check:
if (validations.hostname !== undefined) {
assert.strictEqual(
span.attributes[AttributeNames.DNS_HOSTNAME],
validations.hostname
);
}
Maybe when the value sent to assertSpan
is undefined we should check that it's not in attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
I agree that we could add it by default, on the same basis as we add it to the http spans however having a option to disable it might be useful too |
I agree also that we should add it always. |
I understand that #488 removed it first and foremost because of the invalid attribute and since the spec didn't have a replacement we decided to remove it altogether at the time. That makes sense to me. This PR adds this back for reasons listed above and in #1165. That also makes sense to me. Like others, I would rather see it added without the configuration option for now. I'd first like to hear form @dyladan and/or @svrnm to avoid just swinging back and forth between the two implementations. |
The argument against having it was that the looked up dns host name is like the request body of an http request and might be considered sensitive data (probably an extreme corner-case but worth noting). Giving people the choice to have it on or off is probably the middle-ground we are looking for. If it is an opt-in or opt-out is hard to decide. Here's how I think about it:
|
if hostnames are seen as sensitive data we should also disable capture of url in e.g. HTTP. But at least HTTP.URL is mandatory in semantic conventions. |
fair point |
Can anyone share an example where it would be considered sensitive? |
Default to false i.e. dns.hostname hostname will be included on any span created for `dns.lookup()` or `dns.promises.lookup()`
I don't have a strong opinion except that I am in general always hesitant to add attributes for which there is no semantic convention. The whole reason we had to do #488 to begin with was that the value was stored in the wrong attribute ( |
I didn't think the hostname was going to contain sensitive data but other than that yes this was my original argument. To be honest, it is not really a strongly held belief though.
I generally agree with this except that I would argue for settling this in specification first. Aside: I think this is a symptom of at least 2 much larger problems:
Neither of these problems will be solved today and likely this will require a larger effort than just the OTel JS ecosystem, but as a maintainer I consider these two problems to be two of the biggest we have and likely to hold us back until they are resolved. |
ACK.
I think the main concern of introducing that is, that people implement something put in their @evantorrie would you be open to raise an issue/PR with the spec to add DNS attribute(s)
Yet another reason why open-telemetry/opentelemetry-specification#1773 is so important :-) |
I definitely agree about SemConv, but a place to test potential future behavior is IMO necessary. It is possible that people would just put a custom extension attribute and "call it a day," but it is possible to do that now. At least it would be clear to receivers of the data that it is possibly unstable or unspecified. Right now, because there is no guidance around where to put unspecified data, we end up in exactly the situation this PR is in where a user needs an attribute, that attribute is unspecified, and I can't give them a solution other than "please update the spec." |
I agree with all the points above. export enum AttributeNames {
// NOT ON OFFICIAL SPEC
DNS_ERROR_CODE = 'dns.error_code',
DNS_ERROR_NAME = 'dns.error_name',
DNS_ERROR_MESSAGE = 'dns.error_message',
} I support doing the specification work to add the missing dns attributes, as well as defining experimental attribute namespace/pattern and instrumentation configurations. Since it might take a long time, I see no harm in adding the The practice of adding useful custom attributes with non-speced names is common in many instrumentations, and once we/otel agree on a strategy we should probably fix it in many places. I don't think we should block the PR |
Is this PR now ready to merge? I totally agree with @blumamir's last comment, that this attribute is safe/useful, and that getting a standard attribute name is important but not a blocker. |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
@evantorrie this PR became stale, but I think it is important and will give value to users. Are you still interested in working on it? |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This PR was closed because it has been stale for 14 days with no activity. |
Any interest in picking this up? I may be able to help if folks have reached a consensus on implementation. I was quite surprised to discover the DNS spans don't include the hostname given the purpose of a DNS lookup. |
Which problem is this PR solving?
fixes #1165
Short description of the changes
Adds an option in the plugin configuration to include "hostname" parameter used in
dns.lookup()
calls. Defaults tofalse
.Checklist