mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 14:17:12 +02:00
bugfix: Default OTLP config not respected when otlp:
block is unset (#16693)
Co-authored-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
parent
aea6503d9b
commit
ed0de41b73
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.4.2 / 2025-06-04
|
||||||
|
|
||||||
|
* [BUGFIX] OTLP receiver: Fix default configuration not being respected if the `otlp:` block is unset in the config file. #16693
|
||||||
|
|
||||||
## 3.4.1 / 2025-05-31
|
## 3.4.1 / 2025-05-31
|
||||||
|
|
||||||
* [BUGFIX] Parser: Add reproducer for a dangling-reference issue in parsers. #16633
|
* [BUGFIX] Parser: Add reproducer for a dangling-reference issue in parsers. #16633
|
||||||
|
@ -157,6 +157,7 @@ var (
|
|||||||
DefaultConfig = Config{
|
DefaultConfig = Config{
|
||||||
GlobalConfig: DefaultGlobalConfig,
|
GlobalConfig: DefaultGlobalConfig,
|
||||||
Runtime: DefaultRuntimeConfig,
|
Runtime: DefaultRuntimeConfig,
|
||||||
|
OTLPConfig: DefaultOTLPConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultGlobalConfig is the default global configuration.
|
// DefaultGlobalConfig is the default global configuration.
|
||||||
|
@ -22,6 +22,7 @@ var ruleFilesExpectedConf = &Config{
|
|||||||
|
|
||||||
GlobalConfig: DefaultGlobalConfig,
|
GlobalConfig: DefaultGlobalConfig,
|
||||||
Runtime: DefaultRuntimeConfig,
|
Runtime: DefaultRuntimeConfig,
|
||||||
|
OTLPConfig: DefaultOTLPConfig,
|
||||||
RuleFiles: []string{
|
RuleFiles: []string{
|
||||||
"testdata/first.rules",
|
"testdata/first.rules",
|
||||||
"testdata/rules/second.rules",
|
"testdata/rules/second.rules",
|
||||||
|
@ -1775,6 +1775,26 @@ func TestOTLPAllowUTF8(t *testing.T) {
|
|||||||
verify(t, err)
|
verify(t, err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("good config - missing otlp config uses default", func(t *testing.T) {
|
||||||
|
fpath := filepath.Join("testdata", "otlp_empty.yml")
|
||||||
|
verify := func(t *testing.T, conf *Config, err error) {
|
||||||
|
t.Helper()
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, UnderscoreEscapingWithSuffixes, conf.OTLPConfig.TranslationStrategy)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run("LoadFile", func(t *testing.T) {
|
||||||
|
conf, err := LoadFile(fpath, false, promslog.NewNopLogger())
|
||||||
|
verify(t, conf, err)
|
||||||
|
})
|
||||||
|
t.Run("Load", func(t *testing.T) {
|
||||||
|
content, err := os.ReadFile(fpath)
|
||||||
|
require.NoError(t, err)
|
||||||
|
conf, err := Load(string(content), promslog.NewNopLogger())
|
||||||
|
verify(t, conf, err)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadConfig(t *testing.T) {
|
func TestLoadConfig(t *testing.T) {
|
||||||
|
1
config/testdata/otlp_empty.yml
vendored
Normal file
1
config/testdata/otlp_empty.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
global:
|
Loading…
Reference in New Issue
Block a user