Skip to content

dnsdist: implemented query counting #4175

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

Merged
merged 1 commit into from
Aug 23, 2016
Merged

Conversation

skoef
Copy link
Contributor

@skoef skoef commented Jul 14, 2016

I like the carbonServer functionality, but want to know more about the queries (or in my specific case: domains) that are served by dnsdist. So I implemented query counting, a per-record counter of the amount of requests for a specific record. This then is included in the data sent to carbon and can be adjusted/filtered by setting a Lua function with setQueryCountFilter()


g_lua.writeFunction("clearQueryLog", []() {
unsigned int size = g_qlog.records.size();
g_qlog.records.clear();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this code need to acquire a write lock.

@skoef skoef changed the title Implemented query logging dnsdist: implemented query counting Aug 17, 2016
WriteLock wl(&g_qcount.queryLock);
QueryCountRecords::iterator it;
std::string qname;
for(it=g_qcount.records.begin(); it!=g_qcount.records.end(); ++it) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use for(auto qname: g_qcount.records) here?

@rgacogne
Copy link
Member

LGTM once travis is happy. Thank you!

@rgacogne rgacogne merged commit 55c7d8e into PowerDNS:master Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants