@@ -206,6 +206,56 @@ tools:
206206 })
207207 })
208208
209+ Context ("with observability metrics configuration" , func () {
210+ It ("should default to enabled when metrics block is omitted" , func () {
211+ configContent := `
212+ observability:
213+ tracing:
214+ enabled: false
215+ `
216+ err := os .WriteFile (configFile , []byte (configContent ), 0o644 )
217+ Expect (err ).NotTo (HaveOccurred ())
218+
219+ cfg , err := Load (configFile )
220+ Expect (err ).NotTo (HaveOccurred ())
221+ Expect (cfg .Observability .Metrics .Enabled ).To (BeNil ())
222+ })
223+
224+ It ("should honor explicit metrics disable flag" , func () {
225+ configContent := `
226+ observability:
227+ metrics:
228+ enabled: false
229+ tracing:
230+ enabled: false
231+ `
232+ err := os .WriteFile (configFile , []byte (configContent ), 0o644 )
233+ Expect (err ).NotTo (HaveOccurred ())
234+
235+ cfg , err := Load (configFile )
236+ Expect (err ).NotTo (HaveOccurred ())
237+ Expect (cfg .Observability .Metrics .Enabled ).NotTo (BeNil ())
238+ Expect (* cfg .Observability .Metrics .Enabled ).To (BeFalse ())
239+ })
240+
241+ It ("should honor explicit metrics enable flag" , func () {
242+ configContent := `
243+ observability:
244+ metrics:
245+ enabled: true
246+ tracing:
247+ enabled: false
248+ `
249+ err := os .WriteFile (configFile , []byte (configContent ), 0o644 )
250+ Expect (err ).NotTo (HaveOccurred ())
251+
252+ cfg , err := Load (configFile )
253+ Expect (err ).NotTo (HaveOccurred ())
254+ Expect (cfg .Observability .Metrics .Enabled ).NotTo (BeNil ())
255+ Expect (* cfg .Observability .Metrics .Enabled ).To (BeTrue ())
256+ })
257+ })
258+
209259 Context ("with invalid YAML syntax" , func () {
210260 BeforeEach (func () {
211261 invalidYAML := `
0 commit comments