@@ -2332,27 +2332,64 @@ class ConfigTest extends DDSpecification {
23322332 ! hostname. trim(). isEmpty()
23332333 }
23342334
2335- def " config instantiation should fail if llm obs is enabled via sys prop and ml app is not set" () {
2335+ def " config instantiation should NOT fail if llm obs is enabled via sys prop and ml app is not set" () {
23362336 setup :
23372337 Properties properties = new Properties ()
23382338 properties. setProperty(LLMOBS_ENABLED , " true" )
2339+ properties. setProperty(SERVICE , " test-service" )
23392340
23402341 when :
2341- new Config (ConfigProvider . withPropertiesOverride(properties))
2342+ def config = new Config (ConfigProvider . withPropertiesOverride(properties))
2343+
2344+ then :
2345+ noExceptionThrown()
2346+ config. isLlmObsEnabled()
2347+ config. llmObsMlApp == " test-service"
2348+ }
2349+
2350+ def " config instantiation should NOT fail if llm obs is enabled via sys prop and ml app is empty" () {
2351+ setup :
2352+ Properties properties = new Properties ()
2353+ properties. setProperty(LLMOBS_ENABLED , " true" )
2354+ properties. setProperty(SERVICE , " test-service" )
2355+ properties. setProperty(LLMOBS_ML_APP , " " )
2356+
2357+ when :
2358+ def config = new Config (ConfigProvider . withPropertiesOverride(properties))
23422359
23432360 then :
2344- thrown IllegalArgumentException
2361+ noExceptionThrown()
2362+ config. isLlmObsEnabled()
2363+ config. llmObsMlApp == " test-service"
23452364 }
23462365
2347- def " config instantiation should fail if llm obs is enabled via env var and ml app is not set" () {
2366+ def " config instantiation should NOT fail if llm obs is enabled via env var and ml app is not set" () {
23482367 setup :
23492368 environmentVariables. set(DD_LLMOBS_ENABLED_ENV , " true" )
2369+ environmentVariables. set(DD_SERVICE_NAME_ENV , " test-service" )
23502370
23512371 when :
2352- new Config ()
2372+ def config = new Config ()
23532373
23542374 then :
2355- thrown IllegalArgumentException
2375+ noExceptionThrown()
2376+ config. isLlmObsEnabled()
2377+ config. llmObsMlApp == " test-service"
2378+ }
2379+
2380+ def " config instantiation should NOT fail if llm obs is enabled via env var and ml app is empty" () {
2381+ setup :
2382+ environmentVariables. set(DD_LLMOBS_ENABLED_ENV , " true" )
2383+ environmentVariables. set(DD_SERVICE_NAME_ENV , " test-service" )
2384+ environmentVariables. set(DD_LLMOBS_ML_APP_ENV , " " )
2385+
2386+ when :
2387+ def config = new Config ()
2388+
2389+ then :
2390+ noExceptionThrown()
2391+ config. isLlmObsEnabled()
2392+ config. llmObsMlApp == " test-service"
23562393 }
23572394
23582395
0 commit comments