Skip to content

Commit ea9728d

Browse files
committed
Call updateMonitoringMetrics following all ApplyLoggingPlugins
Keep both results the same.
1 parent b01ce77 commit ea9728d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

dnscrypt-proxy/proxy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ func (proxy *Proxy) processIncomingQuery(
744744
if pluginsState.action == PluginsActionDrop {
745745
pluginsState.returnCode = PluginsReturnCodeDrop
746746
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
747+
updateMonitoringMetrics(proxy, &pluginsState)
747748
return response
748749
}
749750

@@ -806,6 +807,7 @@ func (proxy *Proxy) processIncomingQuery(
806807
pluginsState.returnCode = PluginsReturnCodeParseError
807808
}
808809
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
810+
updateMonitoringMetrics(proxy, &pluginsState)
809811
if serverInfo != nil {
810812
serverInfo.noticeFailure(proxy)
811813
}

dnscrypt-proxy/query_processing.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func processDNSCryptQuery(
5454
if err != nil {
5555
pluginsState.returnCode = PluginsReturnCodeParseError
5656
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
57+
updateMonitoringMetrics(proxy, pluginsState)
5758
return nil, err
5859
}
5960

@@ -75,6 +76,7 @@ func processDNSCryptQuery(
7576
if err != nil {
7677
pluginsState.returnCode = PluginsReturnCodeParseError
7778
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
79+
updateMonitoringMetrics(proxy, pluginsState)
7880
return nil, err
7981
}
8082
response, err = proxy.exchangeWithTCPServer(serverInfo, sharedKey, encryptedQuery, clientNonce)
@@ -100,6 +102,7 @@ func processDNSCryptQuery(
100102
}
101103
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
102104
serverInfo.noticeFailure(proxy)
105+
updateMonitoringMetrics(proxy, pluginsState)
103106
return nil, err
104107
}
105108

@@ -132,6 +135,7 @@ func processDoHQuery(
132135
pluginsState.returnCode = PluginsReturnCodeNetworkError
133136
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
134137
serverInfo.noticeFailure(proxy)
138+
updateMonitoringMetrics(proxy, pluginsState)
135139
return nil, err
136140
}
137141

@@ -207,6 +211,7 @@ func processODoHQuery(
207211
pluginsState.returnCode = PluginsReturnCodeNetworkError
208212
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
209213
serverInfo.noticeFailure(proxy)
214+
updateMonitoringMetrics(proxy, pluginsState)
210215

211216
return nil, err
212217
}
@@ -240,6 +245,7 @@ func handleDNSExchange(
240245
pluginsState.returnCode = PluginsReturnCodeParseError
241246
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
242247
serverInfo.noticeFailure(proxy)
248+
updateMonitoringMetrics(proxy, pluginsState)
243249
return nil, err
244250
}
245251

@@ -261,12 +267,14 @@ func processPlugins(
261267
pluginsState.returnCode = PluginsReturnCodeParseError
262268
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
263269
serverInfo.noticeFailure(proxy)
270+
updateMonitoringMetrics(proxy, pluginsState)
264271
return response, err
265272
}
266273

267274
if pluginsState.action == PluginsActionDrop {
268275
pluginsState.returnCode = PluginsReturnCodeDrop
269276
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
277+
updateMonitoringMetrics(proxy, pluginsState)
270278
return response, nil
271279
}
272280

@@ -275,6 +283,7 @@ func processPlugins(
275283
if err != nil {
276284
pluginsState.returnCode = PluginsReturnCodeParseError
277285
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
286+
updateMonitoringMetrics(proxy, pluginsState)
278287
return response, err
279288
}
280289
}
@@ -310,6 +319,7 @@ func sendResponse(
310319
pluginsState.returnCode = PluginsReturnCodeParseError
311320
}
312321
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
322+
updateMonitoringMetrics(proxy, pluginsState)
313323
return
314324
}
315325

@@ -320,6 +330,7 @@ func sendResponse(
320330
if err != nil {
321331
pluginsState.returnCode = PluginsReturnCodeParseError
322332
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
333+
updateMonitoringMetrics(proxy, pluginsState)
323334
return
324335
}
325336
}
@@ -334,6 +345,7 @@ func sendResponse(
334345
if err != nil {
335346
pluginsState.returnCode = PluginsReturnCodeParseError
336347
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
348+
updateMonitoringMetrics(proxy, pluginsState)
337349
return
338350
}
339351
if clientPc != nil {

0 commit comments

Comments
 (0)