Skip to content

Commit

Permalink
telemetry(amazonq): generateFix metric result (#5199)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctlai95 authored Dec 13, 2024
1 parent 271406b commit 2226148
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhisperer
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
import software.aws.toolkits.resources.message
import software.aws.toolkits.telemetry.Component
import software.aws.toolkits.telemetry.MetricResult
import java.awt.BorderLayout
import java.awt.Dimension
import java.awt.datatransfer.StringSelection
Expand Down Expand Up @@ -88,6 +89,13 @@ internal class CodeWhispererCodeScanIssueDetailsPanel(
scrollToReference("fixFailureSection")
}
}
CodeWhispererTelemetryService.getInstance().sendCodeScanIssueGenerateFix(
Component.Webview,
issue,
isRegenerate,
MetricResult.Failed,
codeFixResponse.failureResponse
)
} else {
val isReferenceAllowed = CodeWhispererSettings.getInstance().isIncludeCodeWithReference()
var suggestedFix = SuggestedFix(
Expand Down Expand Up @@ -141,7 +149,7 @@ internal class CodeWhispererCodeScanIssueDetailsPanel(
if (suggestedFix.code.isNotBlank()) {
sendCodeFixGeneratedTelemetryToServiceAPI(issue, false)
}
CodeWhispererTelemetryService.getInstance().sendCodeScanIssueGenerateFix(Component.Webview, issue, isRegenerate)
CodeWhispererTelemetryService.getInstance().sendCodeScanIssueGenerateFix(Component.Webview, issue, isRegenerate, MetricResult.Succeeded)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import software.aws.toolkits.telemetry.CodewhispererTelemetry
import software.aws.toolkits.telemetry.CodewhispererTriggerType
import software.aws.toolkits.telemetry.Component
import software.aws.toolkits.telemetry.CredentialSourceId
import software.aws.toolkits.telemetry.MetricResult
import software.aws.toolkits.telemetry.Result
import java.time.Duration
import java.time.Instant
Expand Down Expand Up @@ -382,14 +383,18 @@ class CodeWhispererTelemetryService {
component: Component,
issue: CodeWhispererCodeScanIssue,
isRefresh: Boolean,
result: MetricResult,
reason: String? = null,
) {
CodewhispererTelemetry.codeScanIssueGenerateFix(
component = component,
credentialStartUrl = getCodeWhispererStartUrl(issue.project),
findingId = issue.findingId,
detectorId = issue.detectorId,
ruleId = issue.ruleId,
variant = if (isRefresh) "refresh" else null
variant = if (isRefresh) "refresh" else null,
result = result,
reason = reason
)
}

Expand Down

0 comments on commit 2226148

Please sign in to comment.