From 5f9cba0f1957b84494b33c5ec60433666aca0bb9 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 21 Jun 2019 08:02:53 -0600 Subject: [PATCH] caddyfile: Move metrics into caddy package --- caddy.go | 6 ++++++ caddyfile/parse.go | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/caddy.go b/caddy.go index 2aafd375..8e12feaf 100644 --- a/caddy.go +++ b/caddy.go @@ -600,6 +600,12 @@ func ValidateAndExecuteDirectives(cdyfile Input, inst *Instance, justValidate bo return err } + for _, sb := range sblocks { + for dir := range sb.Tokens { + telemetry.AppendUnique("directives", dir) + } + } + inst.context = stype.NewContext(inst) if inst.context == nil { return fmt.Errorf("server type %s produced a nil Context", stypeName) diff --git a/caddyfile/parse.go b/caddyfile/parse.go index eb5512cb..32d7a2b5 100644 --- a/caddyfile/parse.go +++ b/caddyfile/parse.go @@ -20,8 +20,6 @@ import ( "os" "path/filepath" "strings" - - "github.com/mholt/caddy/telemetry" ) // Parse parses the input just enough to group tokens, in @@ -353,7 +351,6 @@ func (p *parser) directive() error { // The directive itself is appended as a relevant token p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor]) - telemetry.AppendUnique("directives", dir) for p.Next() { if p.Val() == "{" {