@@ -240,7 +240,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
240
240
// New projectDetails metric should always be fired whether the project was valid or invalid
241
241
CodetransformTelemetry .projectDetails(
242
242
codeTransformSessionId = CodeTransformTelemetryState .instance.getSessionId(),
243
- result = if (! validationResult.valid) Result .Failed else Result .Unknown ,
243
+ result = if (! validationResult.valid) Result .Failed else Result .Succeeded ,
244
244
reason = if (! validationResult.valid) validationResult.invalidTelemetryReason.additonalInfo else null ,
245
245
codeTransformPreValidationError = validationResult.invalidTelemetryReason.category ? : CodeTransformPreValidationError .Unknown ,
246
246
codeTransformLocalJavaVersion = project.tryGetJdk().toString()
@@ -582,13 +582,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
582
582
}
583
583
584
584
fun informUserOfCompletion (result : CodeModernizerJobCompletedResult ) {
585
- CodetransformTelemetry .totalRunTime(
586
- codeTransformSessionId = CodeTransformTelemetryState .instance.getSessionId(),
587
- codeTransformResultStatusMessage = result.toString(),
588
- codeTransformRunTimeLatency = calculateTotalLatency(CodeTransformTelemetryState .instance.getStartTime(), Instant .now()),
589
- codeTransformLocalJavaVersion = getJavaVersionFromProjectSetting(project),
590
- codeTransformLocalMavenVersion = getMavenVersion(project),
591
- )
585
+ var jobId: JobId ? = null
592
586
when (result) {
593
587
is CodeModernizerJobCompletedResult .UnableToCreateJob -> notifyJobFailure(
594
588
result.failureReason,
@@ -612,19 +606,25 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
612
606
listOf (displayFeedbackNotificationAction())
613
607
)
614
608
615
- is CodeModernizerJobCompletedResult .JobPartiallySucceeded -> notifyStickyInfo(
616
- message(" codemodernizer.notification.info.modernize_partial_complete.title" ),
617
- message(" codemodernizer.notification.info.modernize_partial_complete.content" , result.targetJavaVersion.description),
618
- project,
619
- listOf (displayDiffNotificationAction(result.jobId), displaySummaryNotificationAction(result.jobId), displayFeedbackNotificationAction()),
620
- )
609
+ is CodeModernizerJobCompletedResult .JobPartiallySucceeded -> {
610
+ notifyStickyInfo(
611
+ message(" codemodernizer.notification.info.modernize_partial_complete.title" ),
612
+ message(" codemodernizer.notification.info.modernize_partial_complete.content" , result.targetJavaVersion.description),
613
+ project,
614
+ listOf (displayDiffNotificationAction(result.jobId), displaySummaryNotificationAction(result.jobId), displayFeedbackNotificationAction()),
615
+ )
616
+ jobId = result.jobId
617
+ }
621
618
622
- is CodeModernizerJobCompletedResult .JobCompletedSuccessfully -> notifyStickyInfo(
623
- message(" codemodernizer.notification.info.modernize_complete.title" ),
624
- message(" codemodernizer.notification.info.modernize_complete.content" ),
625
- project,
626
- listOf (displayDiffNotificationAction(result.jobId), displaySummaryNotificationAction(result.jobId)),
627
- )
619
+ is CodeModernizerJobCompletedResult .JobCompletedSuccessfully -> {
620
+ notifyStickyInfo(
621
+ message(" codemodernizer.notification.info.modernize_complete.title" ),
622
+ message(" codemodernizer.notification.info.modernize_complete.content" ),
623
+ project,
624
+ listOf (displayDiffNotificationAction(result.jobId), displaySummaryNotificationAction(result.jobId)),
625
+ )
626
+ jobId = result.jobId
627
+ }
628
628
629
629
is CodeModernizerJobCompletedResult .ManagerDisposed -> LOG .warn { " Manager disposed" }
630
630
is CodeModernizerJobCompletedResult .JobAbortedBeforeStarting -> LOG .warn { " Job was aborted" }
@@ -641,6 +641,14 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
641
641
listOf (openTroubleshootingGuideNotificationAction(TROUBLESHOOTING_URL_PREREQUISITES ), displayFeedbackNotificationAction()),
642
642
)
643
643
}
644
+ CodetransformTelemetry .totalRunTime(
645
+ codeTransformJobId = jobId?.toString(),
646
+ codeTransformSessionId = CodeTransformTelemetryState .instance.getSessionId(),
647
+ codeTransformResultStatusMessage = result.toString(),
648
+ codeTransformRunTimeLatency = calculateTotalLatency(CodeTransformTelemetryState .instance.getStartTime(), Instant .now()),
649
+ codeTransformLocalJavaVersion = getJavaVersionFromProjectSetting(project),
650
+ codeTransformLocalMavenVersion = getMavenVersion(project),
651
+ )
644
652
}
645
653
646
654
fun createCodeModernizerSession (customerSelection : CustomerSelection , project : Project ) = CodeModernizerSession (
0 commit comments