Skip to content

Commit 9306f36

Browse files
committedJan 29, 2024
fix: correct complexity metric
1 parent 84ef29e commit 9306f36

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎internal/handlers/common.go

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ func (c *Controller) StatsdMiddleware(f http.HandlerFunc) http.HandlerFunc {
2323
path = "svg"
2424
}
2525

26-
complexity := len(req.URL.Query())
27-
c.Metrics.Histogram("d2-live."+path+".complexity", float64(complexity), []string{}, 1)
2826
c.Metrics.Histogram("d2-live."+path, time.Now().Sub(start).Seconds(), []string{}, 1)
2927
}
3028
}

‎internal/handlers/get_svg.go

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func (c *Controller) GetD2SVGHandler(rw http.ResponseWriter, req *http.Request)
3030
return
3131
}
3232

33+
// Emit complexity metric
34+
c.Metrics.Histogram("d2-live.complexity", float64(len(urlencoded)), []string{}, 1)
35+
3336
svg, err := c.handleGetD2SVG(ctx, urlencoded)
3437

3538
if err != nil {

0 commit comments

Comments
 (0)