Skip to content

Revert "[server] Metrics for sessions with JWTs WEB-102" #17329

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

Merged
merged 1 commit into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/server/src/auth/jwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TestAuthJWT {
const encoded = await sign({}, keypair.privateKey, {
algorithm: "RS512",
expiresIn: "1d",
issuer: "https://mp-server-d7650ec945.preview.gitpod-dev.com",
issuer: this.config.hostUrl.toStringWoRootSlash(),
keyid: keypair.id,
subject,
});
Expand Down
11 changes: 0 additions & 11 deletions components/server/src/prometheus-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function registerServerMetrics(registry: prometheusClient.Registry) {
registry.registerMetric(spicedbClientLatency);
registry.registerMetric(dashboardErrorBoundary);
registry.registerMetric(jwtCookieIssued);
registry.registerMetric(sessionsWithJWTs);
}

const loginCounter = new prometheusClient.Counter({
Expand Down Expand Up @@ -68,16 +67,6 @@ export function reportJWTCookieIssued() {
jwtCookieIssued.inc();
}

const sessionsWithJWTs = new prometheusClient.Counter({
name: "gitpod_server_sessions_with_jwts_total",
help: "Total number of sessions which did/or did not contain JWTs",
labelNames: ["present"],
});

export function reportSessionHasJWT(jwtPresent: boolean) {
sessionsWithJWTs.inc({ present: `${jwtPresent}` });
}

const apiConnectionClosedCounter = new prometheusClient.Counter({
name: "gitpod_server_api_connections_closed_total",
help: "Total amount of closed API connections",
Expand Down
10 changes: 1 addition & 9 deletions components/server/src/session-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
import { Config as DBConfig } from "@gitpod/gitpod-db/lib/config";
import { Config } from "./config";
import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url";
import { reportSessionHasJWT } from "./prometheus-metrics";

@injectable()
export class SessionHandlerProvider {
Expand All @@ -41,14 +40,7 @@ export class SessionHandlerProvider {

options.store = this.createStore();

this.sessionHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => {
const jwt = req.cookies[SessionHandlerProvider.getJWTCookieName(this.config.hostUrl)];
const containedJWT = !!jwt;

reportSessionHasJWT(containedJWT);

return session(options)(req, res, next);
};
this.sessionHandler = session(options);
}

protected getCookieOptions(config: Config): express.CookieOptions {
Expand Down