-
Notifications
You must be signed in to change notification settings - Fork 274
telemetry(amazonq): combine metrics #5227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
621ac8d
be2892c
bca224b
ba6553c
15a7496
d48feaa
713152f
8a24636
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,8 @@ import software.aws.toolkits.telemetry.CodeTransformCancelSrcComponents | |
| import software.aws.toolkits.telemetry.CodeTransformJavaSourceVersionsAllowed | ||
| import software.aws.toolkits.telemetry.CodeTransformJavaTargetVersionsAllowed | ||
| import software.aws.toolkits.telemetry.CodeTransformPreValidationError | ||
| import software.aws.toolkits.telemetry.CodeTransformVCSViewerSrcComponents | ||
| import software.aws.toolkits.telemetry.CodetransformTelemetry | ||
| import software.aws.toolkits.telemetry.MetricResult | ||
| import software.aws.toolkits.telemetry.Result | ||
| import java.time.Instant | ||
| import java.util.Base64 | ||
|
|
@@ -65,13 +65,14 @@ class CodeTransformTelemetryManager(private val project: Project) { | |
| ) | ||
| } | ||
|
|
||
| fun submitSelection(userChoice: String, customerSelection: CustomerSelection? = null, telemetryErrorMessage: String? = null) { | ||
| fun submitSelection(userChoice: String, jobId: String? = null, customerSelection: CustomerSelection? = null, telemetryErrorMessage: String? = null) { | ||
| CodetransformTelemetry.submitSelection( | ||
| // TODO: remove below 2 lines (JavaSource / JavaTarget) once BI is updated to use source / target | ||
| codeTransformJavaSourceVersionsAllowed = CodeTransformJavaSourceVersionsAllowed.from(customerSelection?.sourceJavaVersion?.name.orEmpty()), | ||
| codeTransformJavaTargetVersionsAllowed = CodeTransformJavaTargetVersionsAllowed.from(customerSelection?.targetJavaVersion?.name.orEmpty()), | ||
| codeTransformSessionId = sessionId, | ||
| codeTransformProjectId = customerSelection?.let { getProjectHash(it) }, | ||
| codeTransformJobId = jobId, | ||
| source = if (userChoice == "Confirm-Java") customerSelection?.sourceJavaVersion?.name.orEmpty() else customerSelection?.sourceVendor.orEmpty(), | ||
| target = if (userChoice == "Confirm-Java") customerSelection?.targetJavaVersion?.name.orEmpty() else customerSelection?.targetVendor.orEmpty(), | ||
| userChoice = userChoice, | ||
|
|
@@ -128,25 +129,6 @@ class CodeTransformTelemetryManager(private val project: Project) { | |
| ) | ||
| } | ||
|
|
||
| fun viewArtifact( | ||
| artifactType: CodeTransformArtifactType, | ||
| jobId: JobId, | ||
| userChoice: String, | ||
| source: CodeTransformVCSViewerSrcComponents, | ||
| telemetryErrorMessage: String? = null, | ||
| ) { | ||
| CodetransformTelemetry.viewArtifact( | ||
| codeTransformArtifactType = artifactType, | ||
| codeTransformVCSViewerSrcComponents = source, | ||
| codeTransformSessionId = sessionId, | ||
| codeTransformJobId = jobId.id, | ||
| codeTransformStatus = currentJobStatus, | ||
| userChoice = userChoice, | ||
| result = if (telemetryErrorMessage.isNullOrEmpty()) Result.Succeeded else Result.Failed, | ||
| reason = telemetryErrorMessage, | ||
| ) | ||
| } | ||
|
|
||
| fun getProjectHash(customerSelection: CustomerSelection) = Base64.getEncoder().encodeToString( | ||
| DigestUtils.sha256(customerSelection.configurationFile?.toNioPath()?.toAbsolutePath().toString()) | ||
| ) | ||
|
|
@@ -196,12 +178,12 @@ class CodeTransformTelemetryManager(private val project: Project) { | |
|
|
||
| fun logHil(jobId: String, metaData: HilTelemetryMetaData, success: Boolean, reason: String) { | ||
| CodetransformTelemetry.humanInTheLoop( | ||
| project, | ||
| jobId, | ||
| metaData.toString(), | ||
| sessionId, | ||
| reason, | ||
| success, | ||
| project = project, | ||
| codeTransformJobId = jobId, | ||
| codeTransformMetadata = metaData.toString(), | ||
| codeTransformSessionId = sessionId, | ||
| reason = reason, | ||
| result = if (success) MetricResult.Succeeded else MetricResult.Failed, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would recommend using Result.Succeeded and Result.Failed here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw that |
||
| ) | ||
| } | ||
|
|
||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
sourcebecause it's not useful to us