-
Notifications
You must be signed in to change notification settings - Fork 273
Update telemetry: emit auth scopes in user state #4944
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 5 commits
f157c53
f0d455d
924a2b0
4512625
a4db555
4e1af21
df30b58
2d053c5
13c8cd0
d05315f
744a2d3
098fa1d
e6082fe
214f4d8
e3e4838
5f780a1
1404bb1
82708b7
3ade8d8
0858d1b
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 |
|---|---|---|
|
|
@@ -4,10 +4,13 @@ | |
| package software.aws.toolkits.jetbrains.core.gettingstarted | ||
|
|
||
| import com.intellij.openapi.project.Project | ||
| import migration.software.aws.toolkits.jetbrains.services.telemetry.TelemetryService | ||
| import software.amazon.awssdk.services.toolkittelemetry.model.Unit | ||
| import software.aws.toolkits.core.utils.tryOrNull | ||
| import software.aws.toolkits.jetbrains.core.credentials.LegacyManagedBearerSsoConnection | ||
| import software.aws.toolkits.jetbrains.core.credentials.ManagedBearerSsoConnection | ||
| import software.aws.toolkits.jetbrains.core.credentials.ProfileSsoManagedBearerSsoConnection | ||
| import software.aws.toolkits.jetbrains.core.credentials.ToolkitAuthManager | ||
| import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager | ||
| import software.aws.toolkits.jetbrains.core.credentials.loginSso | ||
| import software.aws.toolkits.jetbrains.core.credentials.pinning.CodeWhispererConnection | ||
|
|
@@ -26,6 +29,7 @@ import software.aws.toolkits.resources.AwsCoreBundle | |
| import software.aws.toolkits.telemetry.AuthTelemetry | ||
| import software.aws.toolkits.telemetry.FeatureId | ||
| import software.aws.toolkits.telemetry.Result | ||
| import java.time.Instant | ||
|
|
||
| fun requestCredentialsForCodeWhisperer( | ||
| project: Project, | ||
|
|
@@ -229,13 +233,27 @@ fun reauthenticateWithQ(project: Project) { | |
| } | ||
|
|
||
| fun emitUserState(project: Project) { | ||
| AuthTelemetry.userState( | ||
| project, | ||
| source = getStartupState().toString(), | ||
| authEnabledConnections = getEnabledConnections(project), | ||
| authStatus = getAuthStatus(project), | ||
| passive = true | ||
| ) | ||
|
|
||
| val scopes = ToolkitAuthManager.getInstance().listConnections().flatMap { connection -> | ||
| when (connection) { | ||
| is ProfileSsoManagedBearerSsoConnection -> connection.scopes | ||
| is LegacyManagedBearerSsoConnection -> connection.scopes | ||
| else -> emptyList() | ||
| } | ||
| }.toSet() | ||
|
||
|
|
||
| TelemetryService.getInstance().record(project) { | ||
| datum("auth_userState"){ | ||
| createTime(Instant.now()) | ||
| unit(Unit.NONE) | ||
| value(1.0) | ||
|
||
| passive(true) | ||
| metadata("source", getStartupState().toString()) | ||
| metadata("authStatus", getAuthStatus(project).toString()) | ||
| metadata("authEnabledConnections", getEnabledConnections(project)) | ||
| metadata("authScopes", scopes.joinToString(",")) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const val CODEWHISPERER_AUTH_LEARN_MORE_LINK = "https://docs.aws.amazon.com/codewhisperer/latest/userguide/codewhisperer-auth.html" | ||
Uh oh!
There was an error while loading. Please reload this page.