Skip to content

Commit 8f203ea

Browse files
committed
MINOR: global: add stats-file option
1 parent d9d55ba commit 8f203ea

File tree

9 files changed

+30
-2
lines changed

9 files changed

+30
-2
lines changed

config-parser/section-parsers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ func (p *configParser) getGlobalParser() *Parsers { //nolint: maintidx
375375
addParser(parser, &sequence, &parsers.LogSendHostName{})
376376
addParser(parser, &sequence, &parsers.LuaPrependPath{})
377377
addParser(parser, &sequence, &parsers.LuaLoad{})
378+
addParser(parser, &sequence, &simple.Word{Name: "stats-file"})
378379
addParser(parser, &sequence, &simple.Word{Name: "server-state-file"})
379380
addParser(parser, &sequence, &simple.Word{Name: "server-state-base"})
380381
addParser(parser, &sequence, &parsers.SslEngine{})

configuration/global.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,12 @@ func ParseGlobalSection(p parser.Parser) (*models.Global, error) { //nolint:goco
23582358
}
23592359
global.SslOptions = sslOptions
23602360

2361+
statsFile, err := parseStringOption(p, "stats-file")
2362+
if err != nil {
2363+
return nil, err
2364+
}
2365+
global.StatsFile = statsFile
2366+
23612367
statsMaxconn, err := parseInt64POption(p, "stats maxconn")
23622368
if err != nil {
23632369
return nil, err
@@ -3147,6 +3153,10 @@ func SerializeGlobalSection(p parser.Parser, data *models.Global, opt *options.C
31473153
return err
31483154
}
31493155

3156+
if err := serializeStringOption(p, "stats-file", data.StatsFile); err != nil {
3157+
return err
3158+
}
3159+
31503160
if err := serializeInt64POption(p, "stats maxconn", data.StatsMaxconn); err != nil {
31513161
return err
31523162
}

models/global_base.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/global_base_compare.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/global_base_compare_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/build/haproxy_spec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,8 @@ definitions:
21712171
x-omitempty: true
21722172
ssl_options:
21732173
$ref: '#/definitions/ssl_options'
2174+
stats_file:
2175+
type: string
21742176
stats_maxconn:
21752177
type: integer
21762178
x-display-name: Stats maxconn

specification/models/configuration/global.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ global_base:
118118
type: integer
119119
x-nullable: true
120120
x-display-name: Stats maxconn
121+
stats_file:
122+
type: string
121123
thread_group_lines:
122124
type: array
123125
x-omitempty: true

test/configuration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ global
184184
ssl-default-server-options ssl-min-ver TLSv1.1 no-tls-tickets
185185
thread-groups 1
186186
thread-group first 1-16
187+
stats-file /var/haproxy/my-stats
187188
stats maxconn 20
188189
ssl-load-extra-files bundle
189190
deviceatlas-json-file atlas.json

test/expected/structured.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
"quiet": true,
249249
"set_dumpable": true,
250250
"setcap": "cap_net_raw,cap_net_bind_service",
251+
"stats_file": "/var/haproxy/my-stats",
251252
"stats_maxconn": 20,
252253
"strict_limits": true,
253254
"thread_groups": 1,

0 commit comments

Comments
 (0)