@@ -1442,6 +1442,9 @@ type dnstapMinimiser struct {
14421442 promClientIPIgnored prometheus.Counter
14431443 promClientIPIgnoredError prometheus.Counter
14441444 promQuestionNameIgnored prometheus.Counter
1445+ promDNSParseError prometheus.Counter
1446+ promEmptyQuestionSection prometheus.Counter
1447+ promInvalidQuestionName prometheus.Counter
14451448 ctx context.Context
14461449 stop context.CancelFunc // call this to gracefully stop runMinimiser()
14471450 debug bool // if we should print debug messages during operation
@@ -1564,6 +1567,21 @@ func newDnstapMinimiser(logger *slog.Logger, edmConf edmConfiger) (*dnstapMinimi
15641567 Help : "The total number of times we have ignored a dnstap packet because of the name in the question section" ,
15651568 })
15661569
1570+ edm .promDNSParseError = promauto .With (promReg ).NewCounter (prometheus.CounterOpts {
1571+ Name : "edm_ignored_dns_parse_error_total" ,
1572+ Help : "The total number of times we have ignored a dnstap packet because we were unable to parse the DNS data" ,
1573+ })
1574+
1575+ edm .promEmptyQuestionSection = promauto .With (promReg ).NewCounter (prometheus.CounterOpts {
1576+ Name : "edm_ignored_empty_question_section_total" ,
1577+ Help : "The total number of times we have ignored a dnstap packet because it had no entries in the question section" ,
1578+ })
1579+
1580+ edm .promInvalidQuestionName = promauto .With (promReg ).NewCounter (prometheus.CounterOpts {
1581+ Name : "edm_ignored_invalid_question_name_total" ,
1582+ Help : "The total number of times we have ignored a dnstap packet because it contained an invalid name in the question section" ,
1583+ })
1584+
15671585 edm .promReg = promReg
15681586 // Size 32 matches unexported "const outputChannelSize = 32" in
15691587 // https://github.com/dnstap/golang-dnstap/blob/master/dnstap.go
@@ -1962,18 +1980,18 @@ minimiserLoop:
19621980 // For cases where we were unable to unpack the DNS message we
19631981 // skip parsing.
19641982 if msg == nil {
1965- edm .log . Error ( "unable to parse dnstap message, skipping parsing" , "minimiser_id" , minimiserID )
1983+ edm .promDNSParseError . Inc ( )
19661984 continue
19671985 }
19681986
19691987 if len (msg .Question ) == 0 {
1970- edm .log . Error ( "no question section in dnstap message, skipping parsing" , "minimiser_id" , minimiserID )
1988+ edm .promEmptyQuestionSection . Inc ( )
19711989 continue
19721990 }
19731991
1974- for i , question := range msg .Question {
1992+ for _ , question := range msg .Question {
19751993 if _ , ok := dns .IsDomainName (question .Name ); ! ok {
1976- edm .log . Error ( "question name is invalid, skipping parsing" , "minimiser_id" , minimiserID , "question_index" , i )
1994+ edm .promInvalidQuestionName . Inc ( )
19771995 continue
19781996 }
19791997 }
0 commit comments