-
Notifications
You must be signed in to change notification settings - Fork 310
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
Lookup function not working? #1044
Comments
Does your code run at all or is it never called? Is this something you could reproduce with a small snippet? |
It is called, because if there is an error in there it causes issues. I'm not sure what other code I can give you. My goal is to reduce the amount of DNS look ups done, most other services are less than 1 per second, but since adding APM I can see it's 10+ req/s for looking up the |
Since it's the How many instances of the service are there? The default setting for calls to the agent is once every 2 seconds, so to get 100 reqs/s that would mean 200 instances, unless they get very high traffic which causes early flushes. In any case, one thing that I don't understand is that we now use HTTP keep alive by default, which would mean that once the connection is established, there should be no further DNS lookups even without a cache. |
There should be only one instance of the dd-tracer per running server process. The posted code is in a file by itself and imported before anything else in the index.ts file. There are multiple servers running, but at the most it should only be 8 instances total. I have not tried directly with the http or dns module. I put the above code into JSFiddle and the caching logic appears to be working properly: https://jsfiddle.net/qrtuv8x7/ |
Both keep-alive and the lookup option work for me locally. I'm afraid I will really need a reproduction snippet. Any way you can reproduce the issue in isolation? |
Is there a way to reproduce it locally without sending it to Datadog? Rather not have to incur the APM costs to figure this out. |
One thing I've just realized is that the DNS lookups are to the agent but these should not show in the UI at all since we don't trace the tracer. Is it possible that something else unrelated to the tracer sends requests to the agent? For example a DogStatsD client? Also, internally the lookup function is cached but that would only work if the tracer is initialized before any other imports in the app. Can you validate that the tracer initialization is the first thing that happen in the entry point of the app? Reproducing without sending to Datadog is definitely possible but it would be a bit involved since you'd either have to parse the log output or implement a mock agent to intercept and introspect the requests. |
Hmm it could definitely be the DogStatsD client! I'll have to set that to use DNS cache. Next time I have to enable APM I will report back to see if that fixes things. |
@kingjerod Were you able to validate if the issue was caused by the DogStatsD client? |
Closing for now as from the above discussion it sounds like it's caused by the DogStatsD client and we were not able to reproduce with the tracer. Please feel free to re-open if that was not actually the cause. |
@kingjerod Were you able to fix this issue? We're seeing the exact same problem, and using the DogStatsD client's |
Seeing the same issue still happening. |
Describe the bug
I've added a custom lookup function with a cache for the DNS but it doesn't appear to be working. This is my code:
Maybe I'm not understanding what the lookup function does. When I go into my Datadog console, I see 100 req/s for "dd-agent", and 3 req/s for other services. I would expect these numbers to be < 1 req/s since they should be cached for 1 minute.
Environment
AWS C5.Large Docker Node image
Operation system:
Docker
Node version:
10.14.1
Tracer version:
0.23.2
Agent version:
Latest
The text was updated successfully, but these errors were encountered: