summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2022-09-16 13:32:49 -0600
committerGitHub <noreply@github.com>2022-09-16 13:32:49 -0600
commit74547f5bedafcb59fc25f14b43301f33a40f9416 (patch)
tree6ee9a33eda407f03241402cf74d1deeee9676204 /caddyconfig/httpcaddyfile
parent258071d857aa8d1524161cb7273f960f24162ce9 (diff)
caddyhttp: Make metrics opt-in (#5042)
* caddyhttp: Make metrics opt-in Related to #4644 * Make configurable in Caddyfile
Diffstat (limited to 'caddyconfig/httpcaddyfile')
-rw-r--r--caddyconfig/httpcaddyfile/serveroptions.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/caddyconfig/httpcaddyfile/serveroptions.go b/caddyconfig/httpcaddyfile/serveroptions.go
index f3e3d73..8e021fd 100644
--- a/caddyconfig/httpcaddyfile/serveroptions.go
+++ b/caddyconfig/httpcaddyfile/serveroptions.go
@@ -43,6 +43,7 @@ type serverOptions struct {
Protocols []string
StrictSNIHost *bool
ShouldLogCredentials bool
+ Metrics *caddyhttp.Metrics
}
func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) {
@@ -175,6 +176,15 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (any, error) {
}
serverOpts.StrictSNIHost = &boolVal
+ case "metrics":
+ if d.NextArg() {
+ return nil, d.ArgErr()
+ }
+ if d.NextBlock(0) {
+ return nil, d.ArgErr()
+ }
+ serverOpts.Metrics = new(caddyhttp.Metrics)
+
// TODO: DEPRECATED. (August 2022)
case "protocol":
caddy.Log().Named("caddyfile").Warn("DEPRECATED: protocol sub-option will be removed soon")
@@ -259,6 +269,7 @@ func applyServerOptions(
server.MaxHeaderBytes = opts.MaxHeaderBytes
server.Protocols = opts.Protocols
server.StrictSNIHost = opts.StrictSNIHost
+ server.Metrics = opts.Metrics
if opts.ShouldLogCredentials {
if server.Logs == nil {
server.Logs = &caddyhttp.ServerLogConfig{}