aboutsummaryrefslogtreecommitdiff
path: root/plugin/pprof/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/pprof/setup.go')
-rw-r--r--plugin/pprof/setup.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/plugin/pprof/setup.go b/plugin/pprof/setup.go
index cdc346374..66c147e78 100644
--- a/plugin/pprof/setup.go
+++ b/plugin/pprof/setup.go
@@ -2,6 +2,7 @@ package pprof
import (
"net"
+ "strconv"
"sync"
"github.com/coredns/coredns/plugin"
@@ -36,15 +37,34 @@ func setup(c *caddy.Controller) error {
h.addr = args[0]
_, _, e := net.SplitHostPort(h.addr)
if e != nil {
- return e
+ return plugin.Error("pprof", c.Errf("%v", e))
}
}
+
if len(args) > 1 {
return plugin.Error("pprof", c.ArgErr())
}
- if c.NextBlock() {
- return plugin.Error("pprof", c.ArgErr())
+
+ for c.NextBlock() {
+ switch c.Val() {
+ case "block":
+ args := c.RemainingArgs()
+ if len(args) > 1 {
+ return plugin.Error("pprof", c.ArgErr())
+ }
+ h.rateBloc = 1
+ if len(args) > 0 {
+ t, err := strconv.Atoi(args[0])
+ if err != nil {
+ return plugin.Error("pprof", c.Errf("property '%s' invalid integer value '%v'", "block", args[0]))
+ }
+ h.rateBloc = t
+ }
+ default:
+ return plugin.Error("pprof", c.Errf("unknown property '%s'", c.Val()))
+ }
}
+
}
pprofOnce.Do(func() {