Skip to content

API: /api/v2/deployment/stats does not return count for JetBrains Gateway sessions #9673

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

Closed
ericpaulsen opened this issue Sep 13, 2023 · 11 comments · Fixed by #9675 or #10968
Closed
Assignees
Labels
api Area: HTTP API s3 Bugs that confuse, annoy, or are purely cosmetic

Comments

@ericpaulsen
Copy link
Member

ericpaulsen commented Sep 13, 2023

the /api/v2/deployment/stats endpoint returns the below connection figures:

"session_count": {
    "vscode": 1,
    "ssh": 0,
    "jetbrains": 0,
    "reconnecting_pty": 0

however, the session_count.jetbrains figure is not incremented when I open a JetBrains Gateway connection. what is expected to occur for the figure to be >0?

Jetbrains issue

https://youtrack.jetbrains.com/issue/GTW-2288/SSH-Config-SendEnv-not-working-windows

The SetEnv and SendEnv ssh config fields are ignored by Jetbrain's custom ssh implementation. There is no trivial way to fix this. We would have to send the jetbrains information in some other way.

@ericpaulsen ericpaulsen added api Area: HTTP API bug labels Sep 13, 2023
@ericpaulsen ericpaulsen changed the title API: /api/v2/deployment/stats does not return count for JetBrains sessions API: /api/v2/deployment/stats does not return count for JetBrains Gateway sessions Sep 13, 2023
@ericpaulsen
Copy link
Member Author

i've also reproduced this on the Prometheus side, where the coderd_agentstats_session_count_jetbrains is not returning the workspace I've connected to via JetBrains Gateway.

@Emyrk
Copy link
Member

Emyrk commented Sep 13, 2023

@ericpaulsen
Copy link
Member Author

my ~/.ssh/config file as an example:

SetEnv CODER_SSH_SESSION_TYPE=JetBrains

@Emyrk
Copy link
Member

Emyrk commented Sep 14, 2023

This still does not work.

If you manually ssh <workspace-jetbrains-host> it does work. But using gateway, it does not show... 🤔

@ericpaulsen
Copy link
Member Author

cc: @code-asher

@Emyrk
Copy link
Member

Emyrk commented Sep 14, 2023

I wonder what ssh agent jetbrains uses. It could be ignoring part of the ssh config.

@Emyrk
Copy link
Member

Emyrk commented Sep 14, 2023

If I had to guess, gateway parses the ssh config itself, and does not support the same set of features as openssh. I bet SetEnv is not parsed.

Screenshot from 2023-09-14 11-56-39

@Emyrk
Copy link
Member

Emyrk commented Sep 14, 2023

Found something interesting: https://youtrack.jetbrains.com/issue/IDEA-221941/Get-rid-of-sshconfig-parser-use-ssh-G-instead#focus=Comments-27-5706496.0-0

By default they have a custom parser and ssh client. You can change this to use openssh.

Still not working though...

Screenshot from 2023-09-14 12-19-42

@Emyrk
Copy link
Member

Emyrk commented Sep 14, 2023

This is an open issue on Youtrack: https://youtrack.jetbrains.com/issue/GTW-2288/SSH-Config-SendEnv-not-working-windows

Until this is resolved, we cannot send this information over env vars.

If we need this soon and cannot wait, then we could maybe send the info over as like the username? Maybe as something kinda niche like a subsystem command?

https://docstore.mik.ua/orelly/networking_2ndEd/ssh/ch05_07.htm

@matifali
Copy link
Member

I noticed that when connected through JetBrains Gateway, we have TERMINAL_EMULATOR=JetBrains-JediTerm present. We can use this to detect JetBrains client usage.

@matifali
Copy link
Member

matifali commented Oct 19, 2023

@code-asher, to detect Fleet, we can scan for TERM_PROGRAM=Jetbrains.Fleet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API s3 Bugs that confuse, annoy, or are purely cosmetic
Projects
None yet
4 participants