mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-373 rename useWithScope2 to useWithScope (part 1 - rename old method for non-suspend context)
GitOrigin-RevId: d8e0f1abeb6425df4c34be2c15de02381cbd3f29
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8427a58d21
commit
c3f89fe57e
+2
-2
@@ -6,7 +6,7 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.project.guessProjectDir
|
||||
import com.intellij.openapi.ui.playback.PlaybackContext
|
||||
import com.intellij.openapi.vfs.findDirectory
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.psi.JavaDirectoryService
|
||||
import com.intellij.psi.impl.file.PsiJavaDirectoryFactory
|
||||
import com.jetbrains.performancePlugin.PerformanceTestSpan
|
||||
@@ -50,7 +50,7 @@ class CreateJavaFileCommand(text: String, line: Int) : PerformanceCommandCorouti
|
||||
VcsTestUtil.provisionVcsAddFileConfirmation(context.project, VcsTestUtil.VcsAddFileConfirmation.DO_NOTHING)
|
||||
|
||||
ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(Runnable {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(NAME).useWithScope {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(NAME).useWithScopeBlocking {
|
||||
JavaDirectoryService.getInstance().createClass(directory, fileName, templateName, true)
|
||||
}
|
||||
}))
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.psi.PsiCompiledFile
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiFile
|
||||
@@ -57,7 +57,7 @@ class TextEditorBackgroundHighlighter(private val project: Project, private val
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
HighlightingPassTracer.HIGHLIGHTING_PASS_TRACER.spanBuilder("passes instantiation").useWithScope { span ->
|
||||
HighlightingPassTracer.HIGHLIGHTING_PASS_TRACER.spanBuilder("passes instantiation").useWithScopeBlocking { span ->
|
||||
val startupActivity = StartUpMeasurer.startActivity("highlighting passes instantiation")
|
||||
var cancelled = false
|
||||
try {
|
||||
|
||||
@@ -136,14 +136,16 @@ fun executeStepSync(context: BuildContext, stepMessage: String, stepId: String,
|
||||
Span.current().addEvent("skip step", Attributes.of(AttributeKey.stringKey("name"), stepMessage))
|
||||
}
|
||||
else {
|
||||
spanBuilder(stepMessage).use {
|
||||
spanBuilder(stepMessage).startSpan().use {
|
||||
step.run()
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
suspend inline fun BuildContext.executeStep(spanBuilder: SpanBuilder, stepId: String, crossinline step: suspend CoroutineScope.(Span) -> Unit) {
|
||||
suspend inline fun BuildContext.executeStep(spanBuilder: SpanBuilder,
|
||||
stepId: String,
|
||||
crossinline step: suspend CoroutineScope.(Span) -> Unit) {
|
||||
if (isStepSkipped(stepId)) {
|
||||
spanBuilder.startSpan().addEvent("skip '$stepId' step").end()
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:Suppress("ReplacePutWithAssignment")
|
||||
|
||||
package org.jetbrains.intellij.build
|
||||
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import org.jetbrains.intellij.build.TraceManager.spanBuilder
|
||||
import org.jetbrains.intellij.build.dependencies.BuildDependenciesCommunityRoot
|
||||
@@ -47,7 +47,7 @@ class GradleRunner(
|
||||
tasks = tasks.asList())
|
||||
|
||||
private fun runInner(title: String, buildFile: File?, force: Boolean, parallel: Boolean, tasks: List<String>): Boolean {
|
||||
spanBuilder("gradle $tasks").setAttribute("title", title).useWithScope { span ->
|
||||
spanBuilder("gradle $tasks").setAttribute("title", title).useWithScopeBlocking { span ->
|
||||
if (runInner(buildFile = buildFile, parallel = parallel, tasks = tasks)) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope2
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.JavaModuleOptions
|
||||
import com.intellij.util.system.OS
|
||||
import com.intellij.util.xml.dom.readXmlAsModel
|
||||
@@ -28,7 +28,7 @@ import kotlin.io.path.copyTo
|
||||
import kotlin.time.Duration
|
||||
|
||||
internal fun span(spanBuilder: SpanBuilder, task: Runnable) {
|
||||
spanBuilder.useWithScope {
|
||||
spanBuilder.useWithScopeBlocking {
|
||||
task.run()
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ fun copyDirWithFileFilter(fromDir: Path, targetDir: Path, fileFilter: Predicate<
|
||||
fun zip(context: CompilationContext, targetFile: Path, dir: Path) {
|
||||
spanBuilder("pack")
|
||||
.setAttribute("targetFile", context.paths.buildOutputDir.relativize(targetFile).toString())
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
org.jetbrains.intellij.build.io.zip(targetFile = targetFile, dirs = mapOf(dir to ""))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.util.text.Formats
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope2
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.io.Decompressor
|
||||
import com.intellij.util.system.CpuArch
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
@@ -350,7 +351,7 @@ private suspend fun buildOsSpecificDistributions(context: BuildContext): List<Di
|
||||
|
||||
val ideaPropertyFileContent = createIdeaPropertyFile(context)
|
||||
|
||||
spanBuilder("Adjust executable permissions on common dist").useWithScope {
|
||||
spanBuilder("Adjust executable permissions on common dist").useWithScopeBlocking {
|
||||
val matchers = SUPPORTED_DISTRIBUTIONS.mapNotNull {
|
||||
getOsDistributionBuilder(it.os, null, context)
|
||||
}.flatMap { builder ->
|
||||
@@ -513,7 +514,7 @@ suspend fun zipSourcesOfModules(modules: List<String>, targetFile: Path, include
|
||||
|
||||
spanBuilder("pack")
|
||||
.setAttribute("targetFile", context.paths.buildOutputDir.relativize(targetFile).toString())
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
zipWithCompression(targetFile = targetFile, dirs = zipFileMap)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
@@ -88,7 +88,7 @@ private fun pluginXml(buildContext: BuildContext, version: String): String {
|
||||
private val helpIndexerMutex = Mutex()
|
||||
|
||||
private suspend fun buildResourcesForHelpPlugin(resourceRoot: Path, classPath: List<String>, assetJar: Path, context: CompilationContext) {
|
||||
spanBuilder("index help topics").useWithScope {
|
||||
spanBuilder("index help topics").useWithScopeBlocking {
|
||||
helpIndexerMutex.withLock {
|
||||
runIdea(context = context, mainClass = "com.jetbrains.builtInHelp.indexer.HelpIndexer",
|
||||
args = listOf(resourceRoot.resolve("search").toString(),
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import org.jetbrains.intellij.build.CompilationContext
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.intellij.build.impl.compilation.CompiledClasses
|
||||
class CompilationTasksImpl(private val context: CompilationContext) : CompilationTasks {
|
||||
override fun compileModules(moduleNames: Collection<String>?, includingTestsInModules: List<String>?) {
|
||||
resolveProjectDependencies()
|
||||
spanBuilder("compile modules").useWithScope {
|
||||
spanBuilder("compile modules").useWithScopeBlocking {
|
||||
CompiledClasses.reuseOrCompile(context, moduleNames, includingTestsInModules)
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class CompilationTasksImpl(private val context: CompilationContext) : Compilatio
|
||||
|
||||
spanBuilder("build project artifacts")
|
||||
.setAttribute(AttributeKey.stringArrayKey("artifactNames"), artifactNames.toList())
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
jps.buildArtifacts(artifactNames, buildIncludedModules = false)
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class CompilationTasksImpl(private val context: CompilationContext) : Compilatio
|
||||
Span.current().addEvent("project dependencies are already resolved")
|
||||
}
|
||||
else {
|
||||
spanBuilder("resolve project dependencies").useWithScope {
|
||||
spanBuilder("resolve project dependencies").useWithScopeBlocking {
|
||||
JpsCompilationRunner(context).resolveProjectDependencies()
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class CompilationTasksImpl(private val context: CompilationContext) : Compilatio
|
||||
Span.current().addEvent("runtime module repository is already generated")
|
||||
}
|
||||
else {
|
||||
spanBuilder("generate runtime module repository").useWithScope {
|
||||
spanBuilder("generate runtime module repository").useWithScopeBlocking {
|
||||
JpsCompilationRunner(context).generateRuntimeModuleRepository()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -6,8 +6,8 @@ package org.jetbrains.intellij.build.impl
|
||||
import com.fasterxml.jackson.jr.ob.JSON
|
||||
import com.intellij.openapi.util.io.NioFiles
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope2
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.io.Compressor
|
||||
import com.jetbrains.plugin.blockmap.core.BlockMap
|
||||
import com.jetbrains.plugin.blockmap.core.FileHash
|
||||
@@ -337,11 +337,12 @@ suspend fun buildNonBundledPlugins(pluginsToPublish: Set<PluginLayout>,
|
||||
}
|
||||
|
||||
private suspend fun validatePlugin(path: Path, context: BuildContext) {
|
||||
context.executeStep(spanBuilder("plugin validation").setAttribute("path", "$path"), BuildOptions.VALIDATE_PLUGINS_TO_BE_PUBLISHED) {
|
||||
if (!Files.exists(path)) {
|
||||
it.addEvent("path doesn't exist, skipped")
|
||||
context.executeStep(spanBuilder("plugin validation").setAttribute("path", "$path"), BuildOptions.VALIDATE_PLUGINS_TO_BE_PUBLISHED) { span ->
|
||||
if (Files.notExists(path)) {
|
||||
span.addEvent("path doesn't exist, skipped")
|
||||
return@executeStep
|
||||
}
|
||||
|
||||
val pluginManager = IdePluginManager.createManager()
|
||||
val id = (pluginManager.createPlugin(path, validateDescriptor = false)
|
||||
as? PluginCreationSuccess)
|
||||
@@ -591,7 +592,7 @@ suspend fun layoutPlatformDistribution(moduleOutputPatcher: ModuleOutputPatcher,
|
||||
patchKeyMapWithAltClickReassignedToMultipleCarets(moduleOutputPatcher = moduleOutputPatcher, context = context)
|
||||
}
|
||||
launch {
|
||||
spanBuilder("write patched app info").useWithScope {
|
||||
spanBuilder("write patched app info").useWithScopeBlocking {
|
||||
val moduleOutDir = context.getModuleOutputDir(context.findRequiredModule("intellij.platform.core"))
|
||||
val relativePath = "com/intellij/openapi/application/ApplicationNamesInfo.class"
|
||||
val result = injectAppInfo(inFile = moduleOutDir.resolve(relativePath), newFieldValue = context.applicationInfo.appInfoXml)
|
||||
|
||||
@@ -14,10 +14,7 @@ import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.jetbrains.intellij.build.Source
|
||||
import org.jetbrains.intellij.build.SourceAndCacheStrategy
|
||||
import org.jetbrains.intellij.build.ZipSource
|
||||
import org.jetbrains.intellij.build.createSourceAndCacheStrategyList
|
||||
import org.jetbrains.intellij.build.*
|
||||
import org.jetbrains.intellij.build.dependencies.CacheDirCleanup
|
||||
import java.math.BigInteger
|
||||
import java.nio.file.FileAlreadyExistsException
|
||||
@@ -47,6 +44,8 @@ internal sealed interface JarCacheManager {
|
||||
nativeFiles: MutableMap<ZipSource, List<String>>?,
|
||||
span: Span,
|
||||
producer: SourceBuilder): Path
|
||||
|
||||
fun validateHash(source: Source)
|
||||
}
|
||||
|
||||
internal data object NonCachingJarCacheManager : JarCacheManager {
|
||||
@@ -58,6 +57,9 @@ internal data object NonCachingJarCacheManager : JarCacheManager {
|
||||
producer.produce()
|
||||
return targetFile
|
||||
}
|
||||
|
||||
override fun validateHash(source: Source) {
|
||||
}
|
||||
}
|
||||
|
||||
private val json by lazy {
|
||||
@@ -169,6 +171,12 @@ internal class LocalDiskJarCacheManager(private val cacheDir: Path,
|
||||
}
|
||||
return targetFile
|
||||
}
|
||||
|
||||
override fun validateHash(source: Source) {
|
||||
if (source.hash == 0L && (source !is DirSource || Files.exists(source.dir))) {
|
||||
Span.current().addEvent("Zero hash for $source")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkCache(cacheMetadataFile: Path,
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.jetbrains.jps.model.module.JpsModuleReference
|
||||
import java.io.File
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.file.FileSystems
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.PathMatcher
|
||||
import java.security.MessageDigest
|
||||
@@ -129,7 +128,7 @@ class JarPackager private constructor(private val outputDir: Path,
|
||||
layout: BaseLayout?,
|
||||
platformLayout: PlatformLayout?,
|
||||
moduleOutputPatcher: ModuleOutputPatcher = ModuleOutputPatcher(),
|
||||
dryRun: Boolean = false,
|
||||
dryRun: Boolean,
|
||||
moduleWithSearchableOptions: Set<String> = emptySet(),
|
||||
context: BuildContext): Collection<DistributionFileEntry> {
|
||||
|
||||
@@ -190,10 +189,10 @@ class JarPackager private constructor(private val outputDir: Path,
|
||||
val list = mutableListOf<DistributionFileEntry>()
|
||||
val hasher = Hashing.komihash5_0().hashStream()
|
||||
for (item in packager.jarDescriptors.values) {
|
||||
computeDistributionFileEntries(item = item, hasher = hasher, list = list, dryRun = dryRun)
|
||||
computeDistributionFileEntries(item = item, hasher = hasher, list = list, dryRun = dryRun, cacheManager = cacheManager)
|
||||
}
|
||||
for (item in packager.dirDescriptors.values) {
|
||||
computeDistributionFileEntries(item = item, hasher = hasher, list = list, dryRun = dryRun)
|
||||
computeDistributionFileEntries(item = item, hasher = hasher, list = list, dryRun = dryRun, cacheManager = cacheManager)
|
||||
}
|
||||
|
||||
// sort because projectStructureMapping is a concurrent collection
|
||||
@@ -806,18 +805,19 @@ private fun isFromLocalMavenRepo(path: Path) = path.startsWith(MAVEN_REPO)
|
||||
private fun computeDistributionFileEntries(item: AssetDescriptor,
|
||||
hasher: HashStream64,
|
||||
list: MutableList<DistributionFileEntry>,
|
||||
dryRun: Boolean) {
|
||||
dryRun: Boolean,
|
||||
cacheManager: JarCacheManager) {
|
||||
for ((module, sources) in item.includedModules) {
|
||||
var size = 0
|
||||
hasher.reset()
|
||||
hasher.putInt(sources.size)
|
||||
for (source in sources) {
|
||||
size += source.size
|
||||
if (!dryRun && source.hash == 0L && (source !is DirSource || Files.exists(source.dir))) {
|
||||
Span.current().addEvent("Zero hash for $source")
|
||||
if (!dryRun) {
|
||||
cacheManager.validateHash(source)
|
||||
hasher.putLong(source.hash)
|
||||
hasher.putInt(source.size)
|
||||
}
|
||||
hasher.putLong(source.hash)
|
||||
hasher.putInt(source.size)
|
||||
}
|
||||
|
||||
val hash = hasher.asLong
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.devkit.runtimeModuleRepository.jps.build.RuntimeModuleRepositoryBuildConstants
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.common.Attributes
|
||||
import io.opentelemetry.api.trace.Span
|
||||
@@ -316,7 +316,7 @@ internal class JpsCompilationRunner(private val context: CompilationContext) {
|
||||
.setAttribute("modules", moduleSet.joinToString(separator = ", "))
|
||||
.setAttribute("incremental", context.options.incrementalCompilation)
|
||||
.setAttribute("cacheDir", compilationData.dataStorageRoot.toString())
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
Standalone.runBuild(
|
||||
{ context.projectModel }, compilationData.dataStorageRoot.toFile(),
|
||||
mapOf(GlobalOptions.BUILD_DATE_IN_SECONDS to "${context.options.buildDateInSeconds}"),
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@ package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import com.intellij.openapi.util.io.NioFiles
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope2
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -200,10 +200,10 @@ class LinuxDistributionBuilder(override val context: BuildContext,
|
||||
val snapDir = context.paths.buildOutputDir.resolve("dist.snap")
|
||||
spanBuilder("build Linux .snap package")
|
||||
.setAttribute("snapName", snapName)
|
||||
.useWithScope { span ->
|
||||
.useWithScopeBlocking { span ->
|
||||
if (SystemInfoRt.isWindows) {
|
||||
span.addEvent(".snap cannot be built on Windows, skipped")
|
||||
return@useWithScope
|
||||
return@useWithScopeBlocking
|
||||
}
|
||||
check(iconPngPath != null) { context.messages.error("'iconPngPath' not set") }
|
||||
check(!customizer.snapDescription.isNullOrBlank()) { context.messages.error("'snapDescription' not set") }
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.io.PosixFilePermissionsUtil
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
|
||||
@@ -47,7 +47,7 @@ interface OsSpecificDistributionBuilder {
|
||||
}
|
||||
|
||||
fun checkExecutablePermissions(distribution: Path, root: String, includeRuntime: Boolean = true, arch: JvmArchitecture) {
|
||||
TraceManager.spanBuilder("Permissions check for ${distribution.name}").useWithScope {
|
||||
TraceManager.spanBuilder("Permissions check for ${distribution.name}").useWithScopeBlocking {
|
||||
val patterns = generateExecutableFilesMatchers(includeRuntime, arch)
|
||||
val matchedFiles = when {
|
||||
patterns.isEmpty() -> return
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.openapi.util.io.FileUtilRt
|
||||
import com.intellij.openapi.util.io.NioFiles
|
||||
import com.intellij.openapi.util.text.StringUtilRt
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.lang.UrlClassLoader
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -164,7 +164,7 @@ internal class TestingTasksImpl(private val context: CompilationContext, private
|
||||
systemProperties: MutableMap<String, String>,
|
||||
context: CompilationContext) {
|
||||
for (configuration in runConfigurations) {
|
||||
spanBuilder("run '${configuration.name}' run configuration").useWithScope {
|
||||
spanBuilder("run '${configuration.name}' run configuration").useWithScopeBlocking {
|
||||
runTestsFromRunConfiguration(configuration, additionalJvmOptions, systemProperties, context)
|
||||
}
|
||||
}
|
||||
@@ -698,7 +698,7 @@ internal class TestingTasksImpl(private val context: CompilationContext, private
|
||||
if (isRunningInBatchMode) {
|
||||
spanBuilder("run tests in batch mode")
|
||||
.setAttribute(AttributeKey.stringKey("pattern"), options.batchTestIncludes ?: "")
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
runInBatchMode(mainModule, systemProperties, jvmArgs, envVariables, bootstrapClasspath, testClasspath)
|
||||
}
|
||||
}
|
||||
@@ -720,7 +720,7 @@ internal class TestingTasksImpl(private val context: CompilationContext, private
|
||||
val spanNameSuffix = if (options.attemptCount > 1) " (attempt $attempt)" else ""
|
||||
val additionalJvmArgs: List<String> = if (attempt > 1) listOf("-Dintellij.build.test.ignoreFirstAndLastTests=true") else emptyList()
|
||||
|
||||
val exitCode5: Int = if (runJUnit5) spanBuilder("run junit 5 tests${spanNameSuffix}").useWithScope {
|
||||
val exitCode5: Int = if (runJUnit5) spanBuilder("run junit 5 tests${spanNameSuffix}").useWithScopeBlocking {
|
||||
if (options.isDedicatedRuntimePerClassEnabled) {
|
||||
context.messages.info("Creation of a dedicated runtime for each class is enabled")
|
||||
val testClasses = getTestClassesForModule(mainModule = mainModule)
|
||||
@@ -756,7 +756,7 @@ internal class TestingTasksImpl(private val context: CompilationContext, private
|
||||
}
|
||||
else 0
|
||||
|
||||
val exitCode3: Int = if (runJUnit3) spanBuilder("run junit 3 tests${spanNameSuffix}").useWithScope {
|
||||
val exitCode3: Int = if (runJUnit3) spanBuilder("run junit 3 tests${spanNameSuffix}").useWithScopeBlocking {
|
||||
if (options.isDedicatedRuntimePerClassEnabled) {
|
||||
context.messages.info("Creation of a dedicated runtime for each class is enabled")
|
||||
val testClasses = getTestClassesForModule(mainModule = mainModule)
|
||||
|
||||
+7
-7
@@ -4,7 +4,7 @@
|
||||
package org.jetbrains.intellij.build.impl.compilation
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.common.Attributes
|
||||
@@ -78,7 +78,7 @@ fun packAndUploadToServer(context: CompilationContext, zipDir: Path, config: Com
|
||||
}
|
||||
}
|
||||
else {
|
||||
spanBuilder("pack classes").useWithScope {
|
||||
spanBuilder("pack classes").useWithScopeBlocking {
|
||||
packCompilationResult(context, zipDir)
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ fun packCompilationResult(context: CompilationContext, zipDir: Path, addDirEntri
|
||||
}
|
||||
}
|
||||
|
||||
spanBuilder("build zip archives").useWithScope {
|
||||
spanBuilder("build zip archives").useWithScopeBlocking {
|
||||
val traceContext = Context.current()
|
||||
ForkJoinTask.invokeAll(items.map { item ->
|
||||
ForkJoinTask.adapt(Callable {
|
||||
@@ -214,7 +214,7 @@ private fun upload(config: CompilationCacheUploadConfiguration,
|
||||
}
|
||||
|
||||
spanBuilder("upload archives").setAttribute(AttributeKey.stringArrayKey("items"),
|
||||
items.map(PackAndUploadItem::name)).useWithScope {
|
||||
items.map(PackAndUploadItem::name)).useWithScopeBlocking {
|
||||
uploadArchives(reportStatisticValue = messages::reportStatisticValue,
|
||||
config = config,
|
||||
metadataJson = metadataJson,
|
||||
@@ -245,7 +245,7 @@ fun fetchAndUnpackCompiledClasses(reportStatisticValue: (key: String, value: Str
|
||||
|
||||
var verifyTime = 0L
|
||||
val upToDate = ContainerUtil.newConcurrentSet<String>()
|
||||
spanBuilder("check previously unpacked directories").useWithScope { span ->
|
||||
spanBuilder("check previously unpacked directories").useWithScopeBlocking { span ->
|
||||
verifyTime += checkPreviouslyUnpackedDirectories(items = items,
|
||||
span = span,
|
||||
upToDate = upToDate,
|
||||
@@ -255,7 +255,7 @@ fun fetchAndUnpackCompiledClasses(reportStatisticValue: (key: String, value: Str
|
||||
reportStatisticValue("compile-parts:up-to-date:count", upToDate.size.toString())
|
||||
|
||||
val toUnpack = LinkedHashSet<FetchAndUnpackItem>(items.size)
|
||||
val toDownload = spanBuilder("check previously downloaded archives").useWithScope { span ->
|
||||
val toDownload = spanBuilder("check previously downloaded archives").useWithScopeBlocking { span ->
|
||||
val start = System.nanoTime()
|
||||
val result = ForkJoinTask.invokeAll(items.mapNotNull { item ->
|
||||
if (upToDate.contains(item.name)) {
|
||||
@@ -539,7 +539,7 @@ inline fun <T> forkJoinTask(spanBuilder: SpanBuilder, crossinline operation: ()
|
||||
.setParent(context)
|
||||
.setAttribute(THREAD_NAME, thread.name)
|
||||
.setAttribute(THREAD_ID, thread.id)
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
operation()
|
||||
}
|
||||
})
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:Suppress("ReplaceGetOrSet")
|
||||
|
||||
package org.jetbrains.intellij.build.impl.compilation
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.io.Decompressor
|
||||
import org.jetbrains.intellij.build.CompilationContext
|
||||
import org.jetbrains.intellij.build.TraceManager
|
||||
@@ -47,7 +47,7 @@ internal class PortableCompilationCacheDownloader(
|
||||
}
|
||||
|
||||
private fun downloadToFile(url: String, file: Path, spanName: String) {
|
||||
TraceManager.spanBuilder(spanName).setAttribute("url", url).setAttribute("path", "$file").useWithScope {
|
||||
TraceManager.spanBuilder(spanName).setAttribute("url", url).setAttribute("path", "$file").useWithScopeBlocking {
|
||||
Files.createDirectories(file.parent)
|
||||
retryWithExponentialBackOff {
|
||||
if (url.isS3()) {
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.impl.compilation
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.io.Compressor
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.common.Attributes
|
||||
@@ -81,7 +81,7 @@ internal class PortableCompilationCacheUploader(
|
||||
|
||||
private fun uploadToS3() {
|
||||
if (remoteCache.shouldBeSyncedToS3) {
|
||||
spanBuilder("aws s3 sync").useWithScope {
|
||||
spanBuilder("aws s3 sync").useWithScopeBlocking {
|
||||
awsS3Cli("cp", "--no-progress", "--include", "*", "--recursive", "$s3Folder", "s3://intellij-jps-cache", returnStdOut = false)
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ private class Uploader(serverUrl: String, val authHeader: String) {
|
||||
|
||||
fun upload(path: String, file: Path) {
|
||||
val url = pathToUrl(path)
|
||||
spanBuilder("upload").setAttribute("url", url).setAttribute("path", path).useWithScope {
|
||||
spanBuilder("upload").setAttribute("url", url).setAttribute("path", path).useWithScopeBlocking {
|
||||
check(Files.exists(file)) {
|
||||
"The file $file does not exist"
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
package org.jetbrains.intellij.build.impl.compilation
|
||||
|
||||
import com.github.luben.zstd.ZstdDirectBufferDecompressingStreamNoFinalizer
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.lang.HashMapZipFile
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.common.Attributes
|
||||
@@ -34,7 +34,7 @@ internal fun downloadCompilationCache(serverUrl: String,
|
||||
saveHash: Boolean): List<FetchAndUnpackItem> {
|
||||
var urlWithPrefix = "$serverUrl/$prefix/"
|
||||
// first let's check for initial redirect (mirror selection)
|
||||
spanBuilder("mirror selection").useWithScope { span ->
|
||||
spanBuilder("mirror selection").useWithScopeBlocking { span ->
|
||||
client.newCall(Request.Builder()
|
||||
.url(urlWithPrefix)
|
||||
.head()
|
||||
@@ -87,7 +87,7 @@ internal fun downloadCompilationCache(serverUrl: String,
|
||||
}
|
||||
}
|
||||
|
||||
spanBuilder("unpack").setAttribute("name", item.name).useWithScope {
|
||||
spanBuilder("unpack").setAttribute("name", item.name).useWithScopeBlocking {
|
||||
unpackArchive(item, saveHash)
|
||||
}
|
||||
null
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.intellij.build.impl.logging
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import org.jetbrains.intellij.build.*
|
||||
@@ -117,7 +117,7 @@ class BuildMessagesImpl private constructor(private val logger: BuildMessageLogg
|
||||
|
||||
try {
|
||||
processMessage(LogMessage(LogMessage.Kind.BLOCK_STARTED, blockName))
|
||||
spanBuilder(blockName.lowercase(Locale.getDefault())).useWithScope {
|
||||
spanBuilder(blockName.lowercase(Locale.getDefault())).useWithScopeBlocking {
|
||||
try {
|
||||
task.call()
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
package org.jetbrains.intellij.build.impl
|
||||
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.use
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope2
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.jetbrains.signatureverifier.ILogger
|
||||
import com.jetbrains.signatureverifier.InvalidDataException
|
||||
import com.jetbrains.signatureverifier.crypt.SignatureVerificationParams
|
||||
@@ -122,7 +121,7 @@ private fun copyZipReplacing(origin: Path, entries: Map<String, Path>, context:
|
||||
spanBuilder("replacing unsigned entries in zip")
|
||||
.setAttribute("zip", origin.toString())
|
||||
.setAttribute(AttributeKey.stringArrayKey("unsigned"), entries.keys.toList())
|
||||
.useWithScope {
|
||||
.useWithScopeBlocking {
|
||||
transformZipUsingTempFile(origin) { zipWriter ->
|
||||
val index = PackageIndexBuilder()
|
||||
readZipFile(origin) { name, dataSupplier ->
|
||||
|
||||
+8
-18
@@ -17,7 +17,7 @@ import java.util.concurrent.CancellationException
|
||||
import java.util.function.Consumer
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
inline fun <T> SpanBuilder.useWithScope(operation: (Span) -> T): T {
|
||||
inline fun <T> SpanBuilder.useWithScopeBlocking(operation: (Span) -> T): T {
|
||||
val span = startSpan()
|
||||
return span.makeCurrent().use {
|
||||
span.use(operation)
|
||||
@@ -42,10 +42,6 @@ suspend inline fun <T> SpanBuilder.useWithScope2(crossinline operation: suspend
|
||||
}
|
||||
}
|
||||
|
||||
fun runWithSpanSimple(tracer: IJTracer, spanName: String, operation: Runnable) {
|
||||
runWithSpan(tracer, spanName) { _ -> operation.run() }
|
||||
}
|
||||
|
||||
fun <T> computeWithSpanAttribute(tracer: IJTracer,
|
||||
spanName: String,
|
||||
attributeName: String,
|
||||
@@ -60,11 +56,11 @@ fun <T> computeWithSpanAttribute(tracer: IJTracer,
|
||||
|
||||
fun <T> computeWithSpanAttributes(tracer: IJTracer,
|
||||
spanName: String,
|
||||
attributesGenerator: (T) -> Map<String, String>,
|
||||
attributeGenerator: (T) -> Map<String, String>,
|
||||
operation: () -> T): T {
|
||||
return computeWithSpan(tracer, spanName) { span ->
|
||||
val result = operation.invoke()
|
||||
attributesGenerator.invoke(result).forEach { (attributeName, attributeValue) ->
|
||||
attributeGenerator.invoke(result).forEach { (attributeName, attributeValue) ->
|
||||
span.setAttribute(attributeName, attributeValue)
|
||||
}
|
||||
return@computeWithSpan result
|
||||
@@ -72,25 +68,25 @@ fun <T> computeWithSpanAttributes(tracer: IJTracer,
|
||||
}
|
||||
|
||||
inline fun <T> computeWithSpan(tracer: Tracer, spanName: String, operation: (Span) -> T): T {
|
||||
return tracer.spanBuilder(spanName).useWithScope(operation)
|
||||
return tracer.spanBuilder(spanName).useWithScopeBlocking(operation)
|
||||
}
|
||||
|
||||
inline fun runWithSpan(tracer: Tracer, spanName: String, operation: (Span) -> Unit) {
|
||||
tracer.spanBuilder(spanName).useWithScope(operation)
|
||||
tracer.spanBuilder(spanName).useWithScopeBlocking(operation)
|
||||
}
|
||||
|
||||
internal fun <T> computeWithSpanIgnoreThrows(tracer: Tracer,
|
||||
spanName: String,
|
||||
operation: ThrowableNotNullFunction<Span, T, out Throwable>): T {
|
||||
return tracer.spanBuilder(spanName).useWithScope(operation::`fun`)
|
||||
return tracer.spanBuilder(spanName).useWithScopeBlocking(operation::`fun`)
|
||||
}
|
||||
|
||||
internal fun runWithSpanIgnoreThrows(tracer: Tracer, spanName: String, operation: ThrowableConsumer<Span, out Throwable>) {
|
||||
tracer.spanBuilder(spanName).useWithScope(operation::consume)
|
||||
tracer.spanBuilder(spanName).useWithScopeBlocking(operation::consume)
|
||||
}
|
||||
|
||||
fun runWithSpan(tracer: Tracer, spanName: String, operation: Consumer<Span>) {
|
||||
tracer.spanBuilder(spanName).useWithScope(operation::accept)
|
||||
tracer.spanBuilder(spanName).useWithScopeBlocking(operation::accept)
|
||||
}
|
||||
|
||||
inline fun <T> SpanBuilder.use(operation: (Span) -> T): T {
|
||||
@@ -103,12 +99,6 @@ inline fun Span.useWithScope(operation: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Span.runSpanWithScope(operation: Runnable) {
|
||||
makeCurrent().use {
|
||||
use { operation.run() }
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> Span.use(operation: (Span) -> T): T {
|
||||
try {
|
||||
return operation(this)
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.platform.ide.CoreUiCoroutineScopeHolder
|
||||
import com.intellij.util.SlowOperations
|
||||
import com.intellij.util.TimeoutUtil
|
||||
@@ -43,7 +44,6 @@ import com.intellij.util.ui.EDT
|
||||
import com.intellij.util.use
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.currentCoroutineContext
|
||||
import kotlinx.coroutines.flow.*
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.awt.AWTEvent
|
||||
@@ -190,7 +190,7 @@ internal class ActionUpdater @JvmOverloads constructor(
|
||||
edtCallsCount++
|
||||
edtWaitNanos += start - start0
|
||||
currentEDTWaitMillis = TimeUnit.NANOSECONDS.toMillis(start - start0)
|
||||
Utils.getTracer(true).spanBuilder(operationName).useWithScope { span: Span ->
|
||||
Utils.getTracer(true).spanBuilder(operationName).useWithScopeBlocking { span: Span ->
|
||||
val prevStack = ourInEDTActionOperationStack
|
||||
val prevNoRules = isNoRulesInEDTSection
|
||||
var traceCookie: ThreadDumpService.Cookie? = null
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.vcs.log.impl.VcsLogIndexer;
|
||||
import com.intellij.vcs.log.impl.VcsLogSharedSettings;
|
||||
import com.intellij.vcs.log.util.PersistentUtil;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import kotlin.Unit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
@@ -37,7 +38,7 @@ import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static com.intellij.openapi.vcs.VcsScopeKt.VcsScope;
|
||||
import static com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.runSpanWithScope;
|
||||
import static com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.useWithScope;
|
||||
|
||||
public final class VcsLogData implements Disposable, VcsLogDataProvider {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogData.class);
|
||||
@@ -184,12 +185,13 @@ public final class VcsLogData implements Disposable, VcsLogDataProvider {
|
||||
false) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
runSpanWithScope(span, () -> {
|
||||
useWithScope(span, () -> {
|
||||
indicator.setIndeterminate(true);
|
||||
resetState();
|
||||
readCurrentUser();
|
||||
myRefresher.readFirstBlock();
|
||||
fireDataPackChangeEvent(myRefresher.getCurrentDataPack());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.intellij.openapi.vcs.telemetry.VcsTelemetrySpan.*
|
||||
import com.intellij.openapi.vcs.telemetry.VcsTelemetrySpanAttribute
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.platform.diagnostic.telemetry.TelemetryManager
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.alsoIfNull
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import com.intellij.util.containers.MultiMap
|
||||
@@ -136,7 +136,7 @@ internal class FileHistoryFilterer(private val logData: VcsLogData, private val
|
||||
filters: VcsLogFilterCollection,
|
||||
commitCount: CommitCountStage): Pair<VisiblePack, CommitCountStage> {
|
||||
val start = System.currentTimeMillis()
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogHistory.Computing.getName()).useWithScope { scope ->
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogHistory.Computing.getName()).useWithScopeBlocking { scope ->
|
||||
val isInitial = commitCount == CommitCountStage.INITIAL
|
||||
|
||||
scope.setAttribute("filePath", filePath.toString())
|
||||
@@ -289,7 +289,7 @@ internal class FileHistoryFilterer(private val logData: VcsLogData, private val
|
||||
private fun collectRenamesFromProvider(fileHistory: FileHistory): MultiMap<UnorderedPair<Int>, Rename> {
|
||||
if (fileHistory.unmatchedAdditionsDeletions.isEmpty()) return MultiMap.empty()
|
||||
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogHistory.CollectingRenames.getName()).useWithScope { span ->
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogHistory.CollectingRenames.getName()).useWithScopeBlocking { span ->
|
||||
val renames = fileHistory.unmatchedAdditionsDeletions.mapNotNull { ad ->
|
||||
val parentHash = storage.getCommitId(ad.parent)!!.hash
|
||||
val childHash = storage.getCommitId(ad.child)!!.hash
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.openapi.vcs.telemetry.VcsTelemetrySpan.LogFilter
|
||||
import com.intellij.openapi.vcs.telemetry.VcsTelemetrySpanAttribute
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.platform.diagnostic.telemetry.TelemetryManager
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.vcs.log.*
|
||||
import com.intellij.vcs.log.data.*
|
||||
@@ -55,7 +55,7 @@ class VcsLogFiltererImpl(private val logProviders: Map<VirtualFile, VcsLogProvid
|
||||
val hashFilter = allFilters.get(VcsLogFilterCollection.HASH_FILTER)
|
||||
val filters = allFilters.without(VcsLogFilterCollection.HASH_FILTER)
|
||||
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogFilter.getName()).useWithScope { span ->
|
||||
TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(LogFilter.getName()).useWithScopeBlocking { span ->
|
||||
if (hashFilter != null && !hashFilter.hashes.isEmpty()) { // hashes should be shown, no matter if they match other filters or not
|
||||
try {
|
||||
val hashFilterResult = applyHashFilter(dataPack, hashFilter, sortType, commitCount)
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.project.guessProjectDir
|
||||
import com.intellij.openapi.ui.playback.PlaybackContext
|
||||
import com.intellij.openapi.vfs.findDirectory
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.PsiManagerImpl
|
||||
import com.intellij.psi.impl.file.PsiDirectoryImpl
|
||||
@@ -56,7 +56,7 @@ class CreateKotlinFileCommand(text: String, line: Int) : PerformanceCommandCorou
|
||||
VcsTestUtil.provisionVcsAddFileConfirmation(context.project, VcsTestUtil.VcsAddFileConfirmation.DO_NOTHING)
|
||||
|
||||
ApplicationManager.getApplication().invokeAndWait(Context.current().wrap(Runnable {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(NAME).useWithScope {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(NAME).useWithScopeBlocking {
|
||||
val createdFile = createKotlinFileFromTemplateForTest(fileName, template, directory)
|
||||
createdFile?.let {
|
||||
LOG.info("Created kotlin file\n${createdFile.text}")
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package com.jetbrains.performancePlugin.commands
|
||||
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScope
|
||||
import com.intellij.ide.DataManager
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.ui.playback.PlaybackContext
|
||||
import com.intellij.openapi.ui.playback.commands.AbstractCommand
|
||||
import com.intellij.openapi.wm.IdeFocusManager
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.useWithScopeBlocking
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.refactoring.InplaceRefactoringContinuation
|
||||
import com.intellij.refactoring.RefactoringSettings
|
||||
@@ -56,7 +56,7 @@ class StartInlineRenameCommand(text: String, line: Int) : AbstractCommand(text,
|
||||
actionCallback.reject("Renamers are empty")
|
||||
}
|
||||
else if (renamers.size == 1) {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME).useWithScope {
|
||||
PerformanceTestSpan.TRACER.spanBuilder(SPAN_NAME).useWithScopeBlocking {
|
||||
renamers[0].performRename()
|
||||
actionCallback.setDone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user