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

[bridge] Add /debug/version endpoint #10426

Merged
merged 3 commits into from
Jun 21, 2022
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: 2 additions & 0 deletions components/gitpod-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@types/analytics-node": "^3.1.5",
"@types/chai-subset": "^1.3.3",
"@types/cookie": "^0.4.1",
"@types/express": "^4.17.13",
"@types/jaeger-client": "^3.18.3",
"@types/js-yaml": "^3.10.1",
"@types/mocha": "^5.2.7",
Expand Down Expand Up @@ -42,6 +43,7 @@
"ajv": "^6.5.4",
"analytics-node": "^4.0.1",
"cookie": "^0.4.2",
"express": "^4.17.3",
"inversify": "^5.1.1",
"jaeger-client": "^3.18.1",
"js-yaml": "^3.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import * as http from "http";
import * as express from "express";
import { injectable, postConstruct } from "inversify";
import { log, LogrusLogLevel } from "@gitpod/gitpod-protocol/lib/util/logging";
import { log, LogrusLogLevel } from "./logging";

export interface SetLogLevelRequest {
level: LogrusLogLevel;
Expand Down Expand Up @@ -53,7 +53,7 @@ export class DebugApp {
return app;
}

public start(port: number) {
public start(port: number = 6060) {
this.httpServer = this._app.listen(port, "localhost", () => {
log.info(`debug server listening on port: ${port}`);
});
Expand Down
2 changes: 1 addition & 1 deletion components/server/src/container-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import { defaultGRPCOptions } from "@gitpod/gitpod-protocol/lib/util/grpc";
import { IDEConfigService } from "./ide-config";
import { PrometheusClientCallMetrics } from "@gitpod/gitpod-protocol/lib/messaging/client-call-metrics";
import { IClientCallMetrics } from "@gitpod/content-service/lib/client-call-metrics";
import { DebugApp } from "./debug-app";
import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app";
import { LocalMessageBroker, LocalRabbitMQBackedMessageBroker } from "./messaging/local-message-broker";
import { contentServiceBinder } from "@gitpod/content-service/lib/sugar";
import { ReferrerPrefixParser } from "./workspace/referrer-prefix-context-parser";
Expand Down
4 changes: 2 additions & 2 deletions components/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
} from "./workspace/headless-log-controller";
import { NewsletterSubscriptionController } from "./user/newsletter-subscription-controller";
import { Config } from "./config";
import { DebugApp } from "./debug-app";
import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app";
import { LocalMessageBroker } from "./messaging/local-message-broker";
import { WsConnectionHandler } from "./express/ws-connection-handler";
import { InstallationAdminController } from "./installation-admin/installation-admin-controller";
Expand Down Expand Up @@ -334,7 +334,7 @@ export class Server<C extends GitpodClient, S extends GitpodServer> {
});
}

this.debugApp.start(6060);
this.debugApp.start();
}

public async stop() {
Expand Down
2 changes: 1 addition & 1 deletion components/ws-manager-bridge/src/bridge-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class BridgeController {
protected async reconcile() {
return this.reconcileQueue.enqueue(async () => {
const allClusters = await this.getAllWorkspaceClusters();
log.info("reconciling clusters...", { allClusters: Array.from(allClusters.values()) });
log.info("reconciling clusters...", { allClusters: Array.from(allClusters.keys()) });
Copy link
Member

Choose a reason for hiding this comment

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

[nit] Logs should start with first letter uppercase

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm happy to help setup a guideline for this. As long as we don't have that I think it's out of scope here. 🙂

const toDelete: string[] = [];
try {
for (const [name, bridge] of this.bridges) {
Expand Down
3 changes: 3 additions & 0 deletions components/ws-manager-bridge/src/container-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { PrometheusClientCallMetrics } from "@gitpod/gitpod-protocol/lib/messagi
import { PreparingUpdateEmulator, PreparingUpdateEmulatorFactory } from "./preparing-update-emulator";
import { PrebuildStateMapper } from "./prebuild-state-mapper";
import { PrebuildUpdater, PrebuildUpdaterNoOp } from "./prebuild-updater";
import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app";

export const containerModule = new ContainerModule((bind) => {
bind(MessagebusConfiguration).toSelf().inSingletonScope();
Expand Down Expand Up @@ -85,4 +86,6 @@ export const containerModule = new ContainerModule((bind) => {

bind(PrebuildStateMapper).toSelf().inSingletonScope();
bind(PrebuildUpdater).to(PrebuildUpdaterNoOp).inSingletonScope();

bind(DebugApp).toSelf().inSingletonScope();
});
4 changes: 4 additions & 0 deletions components/ws-manager-bridge/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Container } from "inversify";
import * as express from "express";
import * as prometheusClient from "prom-client";
import { log, LogrusLogLevel } from "@gitpod/gitpod-protocol/lib/util/logging";
import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app";
import { MessageBusIntegration } from "./messagebus-integration";
import { TypeORM } from "@gitpod/gitpod-db/lib/typeorm/typeorm";
import { TracingManager } from "@gitpod/gitpod-protocol/lib/util/tracing";
Expand Down Expand Up @@ -39,6 +40,9 @@ export const start = async (container: Container) => {
log.info(`prometheus metrics server running on: localhost:${metricsPort}`);
});

const debugApp = container.get<DebugApp>(DebugApp);
debugApp.start();

const bridgeController = container.get<BridgeController>(BridgeController);
await bridgeController.start();

Expand Down