mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
reporting: allow export interval and address to be configurable (#23674)
The go-census library supports configuration to send metrics to a local development version of the collector. Add "undocumented" configuration options to the `reporting` block allow developers to debug and verify we're sending the data we expect with real Nomad servers and not just unit tests. Ref: https://hashicorp.atlassian.net/browse/NET-10057 Ref: https://github.com/hashicorp/nomad-enterprise/pull/1708
This commit is contained in:
@@ -179,6 +179,8 @@ func ParseConfigFile(path string) (*Config, error) {
|
||||
c.Client.TemplateConfig.NomadRetry.MaxBackoff = d
|
||||
},
|
||||
},
|
||||
{"reporting.export_interval",
|
||||
&c.Reporting.ExportInterval, &c.Reporting.ExportIntervalHCL, nil},
|
||||
}
|
||||
|
||||
// Parse durations for Consul and Vault config blocks if provided.
|
||||
|
||||
@@ -344,6 +344,9 @@ var basicConfig = &Config{
|
||||
},
|
||||
},
|
||||
Reporting: &config.ReportingConfig{
|
||||
ExportAddress: "http://localhost:8080",
|
||||
ExportIntervalHCL: "15m",
|
||||
ExportInterval: time.Minute * 15,
|
||||
License: &config.LicenseReportingConfig{
|
||||
Enabled: pointer.Of(true),
|
||||
},
|
||||
@@ -427,7 +430,7 @@ var pluginConfig = &Config{
|
||||
},
|
||||
},
|
||||
Reporting: &config.ReportingConfig{
|
||||
&config.LicenseReportingConfig{},
|
||||
License: &config.LicenseReportingConfig{},
|
||||
},
|
||||
Consuls: []*config.ConsulConfig{},
|
||||
Vaults: []*config.VaultConfig{},
|
||||
@@ -482,7 +485,7 @@ var nonoptConfig = &Config{
|
||||
HTTPAPIResponseHeaders: map[string]string{},
|
||||
Sentinel: nil,
|
||||
Reporting: &config.ReportingConfig{
|
||||
&config.LicenseReportingConfig{},
|
||||
License: &config.LicenseReportingConfig{},
|
||||
},
|
||||
Consuls: []*config.ConsulConfig{},
|
||||
Vaults: []*config.VaultConfig{},
|
||||
@@ -563,7 +566,6 @@ func TestConfig_Parse(t *testing.T) {
|
||||
}
|
||||
actual = oldDefault.Merge(actual)
|
||||
|
||||
must.Eq(t, tc.Result.KEKProviders, actual.KEKProviders)
|
||||
must.Eq(t, tc.Result, removeHelperAttributes(actual))
|
||||
})
|
||||
}
|
||||
@@ -615,7 +617,7 @@ func (c *Config) addDefaults() {
|
||||
}
|
||||
if c.Reporting == nil {
|
||||
c.Reporting = &config.ReportingConfig{
|
||||
&config.LicenseReportingConfig{
|
||||
License: &config.LicenseReportingConfig{
|
||||
Enabled: pointer.Of(false),
|
||||
},
|
||||
}
|
||||
@@ -893,7 +895,7 @@ var sample1 = &Config{
|
||||
CleanupDeadServers: pointer.Of(true),
|
||||
},
|
||||
Reporting: &config.ReportingConfig{
|
||||
&config.LicenseReportingConfig{},
|
||||
License: &config.LicenseReportingConfig{},
|
||||
},
|
||||
KEKProviders: []*structs.KEKProviderConfig{
|
||||
{
|
||||
|
||||
3
command/agent/testdata/basic.hcl
vendored
3
command/agent/testdata/basic.hcl
vendored
@@ -348,6 +348,9 @@ reporting {
|
||||
license {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
address = "http://localhost:8080"
|
||||
export_interval = "15m"
|
||||
}
|
||||
|
||||
keyring "awskms" {
|
||||
|
||||
2
command/agent/testdata/basic.json
vendored
2
command/agent/testdata/basic.json
vendored
@@ -421,6 +421,8 @@
|
||||
}
|
||||
],
|
||||
"reporting": {
|
||||
"address": "http://localhost:8080",
|
||||
"export_interval": "15m",
|
||||
"license": {
|
||||
"enabled": "true"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user