4447. [tuning] Allow the fstrm_iothr_init() options to be set using

named.conf to control how dnstap manages the data
                        flow. [RT #42974]
This commit is contained in:
Mark Andrews
2016-08-18 11:16:06 +10:00
parent 0967d759de
commit 934837913f
33 changed files with 709 additions and 26 deletions

View File

@@ -24,6 +24,8 @@
#include <fstrm.h>
#include <protobuf-c/protobuf-c.h>
#include <dns/dnstap.pb-c.h>
#else
struct fstrm_iothr_options;
#endif /* HAVE_DNSTAP */
#include <isc/refcount.h>
@@ -112,7 +114,7 @@ struct dns_dtdata {
isc_result_t
dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
unsigned int workers, dns_dtenv_t **envp);
struct fstrm_iothr_options *fopt, dns_dtenv_t **envp);
/*%<
* Create and initialize the dnstap environment.
*
@@ -126,12 +128,10 @@ dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
* with "file:", then dnstap logs are sent to a file instead of a
* socket.
*
*\li This creates an I/O thread in libfstrm, and prepares
* 'workers' input queues. 'workers' MUST be equal to the number
* of worker threads in named; if it's more, some queues will be
* wasted and if it's less, some threads will have no queue and
* will not log any dnstap events.
*
*\li 'fopt' set the options for fstrm_iothr_init(). 'fopt' must have
* have had the number of input queues set and this should be set
* to the number of worker threads. Additionally the queue model
* should also be set. Other options may be set if desired.
*
* Requires:
*
@@ -139,6 +139,8 @@ dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
*
*\li 'path' is a valid C string.
*
*\li 'fopt' is non NULL.
*
*\li envp != NULL && *envp == NULL
*
* Returns:
@@ -206,6 +208,24 @@ dns_dt_detach(dns_dtenv_t **envp);
*\li '*envp' is NULL.
*/
isc_result_t
dns_dt_getstats(dns_dtenv_t *env, isc_stats_t **statsp);
/*%<
* Attach to the stats struct if it exists.
*
* Requires:
*
*\li 'env' is a valid dnstap environment.
*
*\li 'statsp' is non NULL and '*statsp' is NULL.
*
* Returns:
*
*\li ISC_R_SUCCESS
*
*\li ISC_R_NOTFOUND
*/
void
dns_dt_shutdown(void);
/*%<

View File

@@ -129,7 +129,14 @@ enum {
dns_statscounter_recursion = 4, /*%< Recursion was used */
dns_statscounter_failure = 5, /*%< Some other failure */
dns_statscounter_duplicate = 6, /*%< Duplicate query */
dns_statscounter_dropped = 7 /*%< Duplicate query (dropped) */
dns_statscounter_dropped = 7, /*%< Duplicate query (dropped) */
/*%
* DNSTAP statistics counters.
*/
dns_dnstapcounter_success = 0,
dns_dnstapcounter_drop = 1,
dns_dnstapcounter_max = 2
};
#define DNS_STATS_NCOUNTERS 8