Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Julio Guerra <julio@datadog.com>
  • Loading branch information
Hellzy and Julio-Guerra committed Apr 7, 2022
1 parent f7ee85c commit 5cfd271
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/appsec/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func newHTTPWAFEventListener(handle *waf.Handle, addresses []string, timeout tim
op.AddTag("_dd.appsec.waf.timeouts", float64(wafCtx.TotalTimeouts()))
// time.Duration.Microseconds() is only as of go1.13, so we do it manually here
addWAFDurationTags(&op.TagsHolder, float64(wafCtx.TotalRuntime()), float64(overallWAFRunDuration.Nanoseconds()))
// Log the following metrics once per instantiation of a WAF handle
once.Do(func() {
addRulesetInfoTags(&op.TagsHolder, handle.RulesetInfo())
op.AddTag(ext.ManualKeep, samplernames.AppSec)
Expand Down Expand Up @@ -232,6 +233,7 @@ func newGRPCWAFEventListener(handle *waf.Handle, _ []string, timeout time.Durati
op.On(grpcsec.OnHandlerOperationFinish(func(op *grpcsec.HandlerOperation, _ grpcsec.HandlerOperationRes) {
op.AddTag("_dd.appsec.waf.timeouts", float64(wafTimeouts))
addWAFDurationTags(&op.TagsHolder, float64(wafRunDuration), float64(wafBindingsRunDuration))
// Log the following metrics once per instantiation of a WAF handle
metricsOnce.Do(func() {
addRulesetInfoTags(&op.TagsHolder, handle.RulesetInfo())
op.AddTag(ext.ManualKeep, samplernames.AppSec)
Expand Down

0 comments on commit 5cfd271

Please sign in to comment.