Question
When using datadog in a library, i initilize it with an instance name but the name does not get populated into DATADOG_INSTANCE_NAME in the UploadWorker.kt, this results in an exception thrown inside the worker:
SDK instance with name _dd.sdk_core.default is not found, returning no-op implementation.
Please make sure to call Datadog.initialize([instanceName]) before getting the instance.
SDK instance was requested from: (Ask Gemini)
at com.datadog.android.Datadog.getInstance(Datadog.kt:139)
at com.datadog.android.core.internal.data.upload.UploadWorker.doWork(UploadWorker.kt:42)
at androidx.work.Worker$1.run(Worker.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
2024-09-09 11:32:40.574 19812-20100 Datadog
co.onestep.android.demoapp
E Datadog has not been initialized.
Since those lines
val instanceName = inputData.getString(DATADOG_INSTANCE_NAME)
val sdkCore = Datadog.getInstance(instanceName) as? InternalSdkCore
return a null instance name and the call to Datadog.getInstance(instanceName/this is always null/) throws an exception
Question
When using datadog in a library, i initilize it with an instance name but the name does not get populated into
DATADOG_INSTANCE_NAMEin theUploadWorker.kt, this results in an exception thrown inside the worker:Since those lines
return a null instance name and the call to Datadog.getInstance(instanceName/this is always null/) throws an exception