-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
183 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/RemoteTrackMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public class RemoteTrackMessage { | ||
private String event; | ||
private Object properties; | ||
|
||
public String getEvent() { | ||
return event; | ||
} | ||
|
||
public void setEvent(String event) { | ||
this.event = event; | ||
} | ||
|
||
public Object getProperties() { | ||
return properties; | ||
} | ||
|
||
public void setProperties(Object properties) { | ||
this.properties = properties; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "RemoteTrackMessage{" + | ||
"event='" + event + '\'' + | ||
", properties=" + properties + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...nd-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodClientProjectSessionTracker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote | ||
|
||
import com.intellij.openapi.application.ApplicationInfo | ||
import com.intellij.openapi.client.ClientProjectSession | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.diagnostic.thisLogger | ||
import io.gitpod.gitpodprotocol.api.entities.RemoteTrackMessage | ||
import kotlinx.coroutines.GlobalScope | ||
import kotlinx.coroutines.future.await | ||
import kotlinx.coroutines.launch | ||
|
||
class GitpodClientProjectSessionTracker( | ||
private val session: ClientProjectSession | ||
) { | ||
|
||
private val manager = service<GitpodManager>() | ||
init { | ||
GlobalScope.launch { | ||
val info = manager.pendingInfo.await() | ||
val event = RemoteTrackMessage().apply { | ||
event = "jb_session" | ||
properties = mapOf( | ||
"sessionId" to session.clientId.value, | ||
"instanceId" to info.infoResponse.instanceId, | ||
"workspaceId" to info.infoResponse.workspaceId, | ||
"appName" to ApplicationInfo.getInstance().versionName, | ||
"appVersion" to ApplicationInfo.getInstance().fullVersion, | ||
"timestamp" to System.currentTimeMillis() | ||
) | ||
} | ||
if (manager.devMode) { | ||
thisLogger().warn("gitpod: $event") | ||
} else { | ||
manager.client.server.trackEvent(event) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.