[telemetry] AT-107 Create directories for the telemetry files

GitOrigin-RevId: a076f60242634c108cc8d9190422539226903d5d
This commit is contained in:
Nikita Kudrin
2023-10-16 23:23:41 +00:00
committed by intellij-monorepo-bot
parent fb0fb74cbe
commit 830fa2b1c9
@@ -19,10 +19,7 @@ import java.util.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
import kotlin.io.path.bufferedWriter
import kotlin.io.path.copyTo
import kotlin.io.path.moveTo
import kotlin.io.path.notExists
import kotlin.io.path.*
// https://github.com/jaegertracing/jaeger-ui/issues/381
@ApiStatus.Internal
@@ -32,7 +29,7 @@ class JaegerJsonSpanExporter(
serviceVersion: String? = null,
serviceNamespace: String? = null,
) : AsyncSpanExporter {
private val tempTelemetryFile = file.parent.resolve("telemetry.temp")
private val tempTelemetryFile = file.parent.createDirectories().resolve("telemetry.temp")
private val writer = JsonFactory().createGenerator(Files.newBufferedWriter(tempTelemetryFile))
.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, true)