Skip to content
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

Port @eclipse-che/theia-activity-tracker #65

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

dkwon17
Copy link
Contributor

@dkwon17 dkwon17 commented Jul 4, 2022

This PR ports eclipse-che-theia-activity-tracker to che-code.

There were two main differences with https://github.com/eclipse-che/che-theia/tree/main/extensions/eclipse-che-theia-activity-tracker and the VS Code plugin introduced in this PR:

Tracking

Instead of front-end tracking like in che-theia, this PR tracks the following VS Code events using the extension API:

  • vscode.workspace.onDidChangeTextDocument
  • vscode.window.onDidChangeActiveTextEditor
  • vscode.window.onDidChangeTextEditorSelection
  • vscode.window.onDidChangeTextEditorViewColumn
  • vscode.window.onDidChangeWindowState
  • vscode.window.onDidChangeTerminalState
  • vscode.window.onDidChangeActiveTerminal

Determining the che-machine-exec url

Instead using an EndpointService to determine the machine-exec port like for che-theia, this PR relies on an environment variable set by entrypoint-volume.sh which executes the machine-exec binary. The environment variable is read here.This was done because for Che-code, because for che-code, che-machine-exec is not running in its own container.

To test this PR:

Since there is no idling set up for Che-code at the moment, to test this PR, create a workspace with this che-code image: quay.io/dkwon17/che-code:idle. Here is the editor devfile v2: https://gist.githubusercontent.com/dkwon17/1a96b69643260c9af23553f740132157/raw/72fb81012aa03618490b91cf887ff6a5cd12a889/gistfile1.txt.

For example, to start a golang che sample workspace, go to:

{CHE_HOST}/#https://github.com/che-samples/golang-example/tree/devfilev2?che-editor=https://gist.githubusercontent.com/dkwon17/1a96b69643260c9af23553f740132157/raw/72fb81012aa03618490b91cf887ff6a5cd12a889/gistfile1.txt

When the workspace is running, the tools container of the workspace pod should log /activity/tick POST messages when interacting with the che-code editor. Requests are sent once a minute at most to che-machine-exec:
image

Signed-off-by: David Kwon dakwon@redhat.com

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jul 4, 2022

This PR is for eclipse-che/che#21513

@@ -23,7 +23,8 @@ fi
ls -la /checode/

# Start the machine-exec component in background
nohup /checode/bin/machine-exec --url '0.0.0.0:3333' &
export MACHINE_EXEC_PORT=3333
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done so that the VS Code extension could determine the machine exec port

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-65-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-65-dev-amd64

3 similar comments
@github-actions
Copy link

github-actions bot commented Jul 4, 2022

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-65-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-65-dev-amd64

@github-actions
Copy link

github-actions bot commented Jul 4, 2022

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-65-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-65-dev-amd64

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-65-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-65-dev-amd64

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works well - the endpoint is requested regularly as expected
image

Signed-off-by: David Kwon <dakwon@redhat.com>
@dkwon17
Copy link
Contributor Author

dkwon17 commented Jul 7, 2022

Thank you for the review @azatsarynnyy , I've made the changes

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @dkwon17 for this contribution.

@github-actions
Copy link

github-actions bot commented Jul 7, 2022

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-65-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-65-dev-amd64

@top1436
Copy link

top1436 commented Jun 21, 2023

@dkwon17 Thank you for your explanation.

"devEnvironments.secondsOfInactivityBeforeIdling" is right. my bad...

If che-code built-in extension checks "Activity", Another IDE cannot be applied by this option? ex) IntelliJ

In my exprience, Intellij is also applied this option and it stopped Intellij workspace after the seconds.

In IntelliJ IDE, Is it implemented a diffrent way?

@azatsarynnyy
Copy link
Member

Hi @top1436
JetBrains editors in Che have no support yet for sending the user's activity to the machine-exec component that stops the workspaces.

@top1436
Copy link

top1436 commented Jun 21, 2023

@azatsarynnyy hi!
you mean in jetbrains editor, always inactivity state and workspace always stops after secondsOfInactivityBeforeIdling?

@azatsarynnyy
Copy link
Member

@top1436 correct, if I haven't missed anything )

@top1436
Copy link

top1436 commented Jun 21, 2023

@azatsarynnyy
thank you! I think it needs to be fixed. Is there any plan to develop jetbrain plugin as che-code does?

@azatsarynnyy
Copy link
Member

@azatsarynnyy thank you! I think it needs to be fixed. Is there any plan to develop jetbrain plugin as che-code does?

There're no plans to invest in the current (Projector-based) implementation of JetBrains editors for Che.
But we're going to look at JetBrains Gateway instead (eclipse-che/che#21412)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants