Skip to content

Commit e496760

Browse files
authored
Merge pull request #2733 from digma-ai/performance-and-freeze-enhancements
Performance and freeze enhancements Closes #2704
2 parents c68d268 + b37a518 commit e496760

File tree

282 files changed

+6887
-10207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+6887
-10207
lines changed

.idea/codeStyles/Project.xml

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.run/Run IDEA Community - 2025.2.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<option name="executionName" />
66
<option name="externalProjectPath" value="$PROJECT_DIR$" />
77
<option name="externalSystemIdString" value="GRADLE" />
8-
<option name="scriptParameters" value="-PbuildProfile=p252 -x test" />
8+
<option name="scriptParameters" value="-PbuildProfile=p252 -Pdigma-no-info-logging -x test" />
99
<option name="taskDescriptions">
1010
<list />
1111
</option>

.run/Run Rider - 2025.2.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<option name="executionName" />
66
<option name="externalProjectPath" value="$PROJECT_DIR$" />
77
<option name="externalSystemIdString" value="GRADLE" />
8-
<option name="scriptParameters" value="-PbuildWithRider=true -PbuildProfile=p252 -x test" />
8+
<option name="scriptParameters" value="-PbuildWithRider=true -PbuildProfile=p252 -Pdigma-no-info-logging -x test" />
99
<option name="taskDescriptions">
1010
<list />
1111
</option>

analytics-provider/src/main/java/org/digma/intellij/plugin/analytics/AnalyticsProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,6 @@ public interface AnalyticsProvider extends Closeable {
174174
DiscoveredDataResponse getDiscoveredData();
175175

176176
SpanInfoByUid resolveSpanByUid(String uid);
177+
177178
EnvironmentInfoByErrorId resolveEnvironmentByErrorId(String errorId);
178179
}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ tasks {
252252
//to upgrade gradle change the version here and run:
253253
//./gradlew wrapper --gradle-version 8.8
254254
//check that gradle/wrapper/gradle-wrapper.properties was changed
255-
gradleVersion = "8.13"
255+
gradleVersion = "8.14.1"
256256
distributionType = Wrapper.DistributionType.ALL
257257
distributionBase = Wrapper.PathBase.GRADLE_USER_HOME
258258
distributionPath = "wrapper/dists"

common-build-logic/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ dependencies {
1616
implementation("org.jetbrains.intellij.platform:intellij-platform-gradle-plugin:2.6.0")
1717
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.21")
1818
implementation("com.glovoapp.gradle:versioning:1.1.10")
19-
implementation("de.undercouch:gradle-download-task:5.6.0")
2019
}
2120

2221

common-build-logic/src/main/kotlin/common/Common.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
package common
22

3+
import org.gradle.api.GradleException
34
import org.gradle.api.Project
5+
import org.gradle.internal.cc.base.logger
46
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
57
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformExtension
68

79
//send -Pdigma-no-info-logging to silence some console logging, useful when debugging issues so the log is not too noisy.
810
const val DIGMA_NO_INFO_LOGGING = "digma-no-info-logging"
11+
const val GENERATED_RESOURCES_DIR_NAME = "generated-resources"
12+
const val UI_VERSION_FILE_NAME = "ui-version"
13+
const val UI_BUNDLE_DIR_NAME = "$GENERATED_RESOURCES_DIR_NAME/ui-bundle"
914

1015
//use for messages we want to silence sometimes with DIGMA_NO_INFO_LOGGING
1116
fun Project.withSilenceLogging(consumer: () -> Unit){
@@ -52,3 +57,24 @@ fun logIntellijPlatformPlugin(project: Project, intellijPlatform: IntelliJPlatfo
5257

5358

5459
fun isWindows() = org.gradle.internal.os.OperatingSystem.current().isWindows
60+
61+
62+
fun <T> withRetry(
63+
maxAttempts: Int = 3,
64+
delayMillis: Long = 1000,
65+
block: () -> T
66+
): T {
67+
var lastError: Exception? = null
68+
repeat(maxAttempts) { attempt ->
69+
try {
70+
return block()
71+
} catch (e: Exception) {
72+
lastError = e
73+
logger.lifecycle("Retry $attempt failed: ${e.message}")
74+
if (attempt < maxAttempts - 1) {
75+
Thread.sleep(delayMillis * (attempt + 1)) // simple linear backoff
76+
}
77+
}
78+
}
79+
throw GradleException("Failed after $maxAttempts attempts", lastError)
80+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package common
2+
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.GradleException
5+
import org.gradle.api.tasks.InputFile
6+
import org.gradle.api.tasks.OutputDirectory
7+
import org.gradle.api.tasks.TaskAction
8+
import java.net.URI
9+
import java.util.Properties
10+
11+
open class DownloadOtelJarsTask : DefaultTask() {
12+
13+
@InputFile
14+
val propsFile = project.objects.fileProperty()
15+
16+
@OutputDirectory
17+
val outputDir = project.objects.directoryProperty()
18+
19+
@TaskAction
20+
fun downloadJars() {
21+
val props = Properties().apply {
22+
propsFile.get().asFile.inputStream().use { load(it) }
23+
}
24+
25+
val nameMap = mapOf(
26+
"otel-agent" to "opentelemetry-javaagent.jar",
27+
"digma-extension" to "digma-otel-agent-extension.jar",
28+
"digma-agent" to "digma-agent.jar"
29+
)
30+
31+
val dir = outputDir.get().asFile
32+
dir.mkdirs()
33+
34+
props.forEach { (key, value) ->
35+
val finalName = nameMap[key] ?: throw GradleException("Unknown key in properties file: $key")
36+
val url = value.toString()
37+
val outputFile = dir.resolve(finalName)
38+
39+
logger.lifecycle("Downloading $url${outputFile.name}")
40+
withRetry(maxAttempts = 3, delayMillis = 5_000) {
41+
URI(url).toURL().openStream().use { input ->
42+
input.copyTo(outputFile.outputStream())
43+
}
44+
}
45+
}
46+
}
47+
48+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package common
2+
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.tasks.InputFile
5+
import org.gradle.api.tasks.OutputDirectory
6+
import org.gradle.api.tasks.TaskAction
7+
import java.net.URI
8+
9+
open class DownloadUiBundle : DefaultTask() {
10+
11+
@InputFile
12+
val uiVersionFile = project.objects.fileProperty()
13+
14+
@OutputDirectory
15+
val outputDir = project.objects.directoryProperty()
16+
17+
@TaskAction
18+
fun download() {
19+
val uiVersion = uiVersionFile.get().asFile.readText().trim()
20+
val url = "https://github.com/digma-ai/digma-ui/releases/download/v$uiVersion/dist-jetbrains-v$uiVersion.zip"
21+
val fileName = "digma-ui-$uiVersion.zip"
22+
val targetFile = outputDir.get().file(fileName).asFile
23+
24+
logger.lifecycle("Downloading $url${targetFile.name}")
25+
26+
withRetry(maxAttempts = 3, delayMillis = 5000) {
27+
URI(url).toURL().openStream().use { input ->
28+
input.copyTo(targetFile.outputStream())
29+
}
30+
}
31+
}
32+
33+
}

common-build-logic/src/main/kotlin/digma-base.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import common.properties
33

44
plugins {
55
id("java")
6-
id("de.undercouch.download")
76
}
87

98

0 commit comments

Comments
 (0)