diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodTerminalService.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodTerminalService.kt index ced1f759e52c30..59d5daca068d97 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodTerminalService.kt +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodTerminalService.kt @@ -204,6 +204,11 @@ class GitpodTerminalService(private val session: ClientProjectSession) { } } + override fun onPortForwardingEnded(hostPort: Int) { + thisLogger().info("gitpod: Port $hostPort from Supervisor's Terminal " + + "${supervisorTerminal.pid} is not being forwarded anymore.") + } + override fun onPortForwardingFailed(hostPort: Int, reason: String) { thisLogger().error("gitpod: Failed to forward port $hostPort from Supervisor's Terminal " + "${supervisorTerminal.pid}: $reason") diff --git a/dev/gpctl/cmd/workspaces-last-heartbeat.go b/dev/gpctl/cmd/workspaces-last-heartbeat.go new file mode 100644 index 00000000000000..c1243448a23710 --- /dev/null +++ b/dev/gpctl/cmd/workspaces-last-heartbeat.go @@ -0,0 +1,47 @@ +// Copyright (c) 2020 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 cmd + +import ( + "context" + "fmt" + + "github.com/spf13/cobra" + + "github.com/gitpod-io/gitpod/common-go/log" + "github.com/gitpod-io/gitpod/ws-manager/api" +) + +// workspacesLastHeartbeatCmd get workspace last heartbeat time +var workspacesLastHeartbeatCmd = &cobra.Command{ + Use: "last-heartbeat ", + Short: "get workspace last heartbeat time", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + conn, client, err := getWorkspacesClient(ctx) + if err != nil { + log.WithError(err).Fatal("cannot connect") + } + defer conn.Close() + + instanceID := args[0] + + resp, err := client.DescribeWorkspace(ctx, &api.DescribeWorkspaceRequest{ + Id: instanceID, + }) + if err != nil { + log.WithError(err).Fatal("error during RPC call") + } + + fmt.Println(resp.LastActivity) + }, +} + +func init() { + workspacesCmd.AddCommand(workspacesLastHeartbeatCmd) +}