mirror of
https://github.com/ameshkov/dnslookup.git
synced 2026-04-27 06:26:24 +03:00
[PR #61] [MERGED] Elapsed time in JSON output #83
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/dnslookup#83
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ameshkov/dnslookup/pull/61
Author: @mohshami
Created: 1/19/2024
Status: ✅ Merged
Merged: 1/24/2024
Merged by: @ameshkov
Base:
master← Head:elapsed_time_in_json📝 Commits (4)
36b7dacAdd ElapsedTime to JSON output95a2c0bRun go fmt17d4fd3Address comment from ameshkov64bd60dFix lint error📊 Changes
2 files changed (+21 additions, -3 deletions)
View changed files
📝
README.md(+7 -1)📝
main.go(+14 -2)📄 Description
First I would love to say thank you for this wonderful tool. I use it all the time.
One thing I use it for is to do health checks on our caching resolvers, and something I wanted to do was to monitor how long those queries took. But noticed ElapsedTime is only available in the human readable output.
Please forgive me as the last meaningful Go that I wrote was in 2018, and even then my Go skills were quite limited.
My first instinct was to modify the output string slice before printing as follows
But I didn't feel comfortable editing formatted JSON, because it could conflict with future changes. So I went with the sjson package as follows
After that I ended up dropping the sjson requirement, editing compact JSON directly and then formatting the JSON output.
Also, one thing I wanted to monitor was plain DNS-over-TCP, which my script used dig for since I didn't know it was supported by dnslookup. But when when I saw https://pkg.go.dev/github.com/AdguardTeam/dnsproxy/upstream#AddressToUpstream I realized it was possible and after testing it does indeed work. So I thought it would be a good idea to expose it in the README
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.