Skip to content

Commit afe7793

Browse files
committed
support-true-in-digma-observability
1 parent 51f31da commit afe7793

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

jvm-common/src/main/kotlin/org/digma/intellij/plugin/idea/execution/ParametersExtractor.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.intellij.execution.configurations.RunConfiguration
55
import com.intellij.execution.configurations.SimpleJavaParameters
66
import com.intellij.execution.configurations.SimpleProgramParameters
77
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration
8+
import org.digma.intellij.plugin.errorreporting.ErrorReporter
89

910
open class ParametersExtractor(protected val configuration: RunConfiguration, protected val params: SimpleProgramParameters) {
1011

@@ -69,7 +70,18 @@ open class ParametersExtractor(protected val configuration: RunConfiguration, pr
6970

7071
fun getDigmaObservability(): DigmaObservabilityType? {
7172
return extractEnvValue(DIGMA_OBSERVABILITY)?.takeIf { it.isNotBlank() }?.let {
72-
DigmaObservabilityType.valueOf(it)
73+
try {
74+
DigmaObservabilityType.valueOf(it)
75+
} catch (e: Throwable) {
76+
//report an error so we know if users put non-supported value
77+
ErrorReporter.getInstance().reportError(
78+
"ParametersExtractor.getDigmaObservability", "non supported value in DIGMA_OBSERVABILITY",
79+
mapOf(
80+
"value" to it
81+
)
82+
)
83+
DigmaObservabilityType.app
84+
}
7385
} ?: if (isEnvExists(DIGMA_OBSERVABILITY)) DigmaObservabilityType.app else null
7486
}
7587

jvm-common/src/main/kotlin/org/digma/intellij/plugin/idea/execution/constants.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ don't add DIGMA_OBSERVABILITY if it's not necessary, it may confuse the instrume
4343
*/
4444
const val DIGMA_OBSERVABILITY = "DIGMA_OBSERVABILITY"
4545

46-
enum class DigmaObservabilityType { app, test }
46+
enum class DigmaObservabilityType {
47+
//app and true means the same thing, true is backwards compatibility
48+
app, test, `true`;
49+
}
4750

4851
val KNOWN_IRRELEVANT_TASKS = setOf(
4952
/*

0 commit comments

Comments
 (0)