🛠️ probe and diagnostic endpoints (#763)
basic lifecycle probes for kubes and an endpoint for diagnosing mem leaks missing tests for av, message queue, possibly sso
This commit is contained in:
@@ -32,8 +32,8 @@ export class AVServiceImpl implements TdriveServiceProvider, Initializable {
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error({ error: `${error}` }, "Error while initializing Antivirus Service");
|
||||
} catch (err) {
|
||||
logger.error({ err }, "Error while initializing Antivirus Service");
|
||||
throw AVException.initializationFailed("Failed to initialize Antivirus service");
|
||||
}
|
||||
return this;
|
||||
|
||||
@@ -37,6 +37,20 @@ export class ConsoleController {
|
||||
}
|
||||
|
||||
async auth(request: FastifyRequest<{ Body: AuthRequest }>): Promise<AuthResponse> {
|
||||
const censoredHeadersLC = {
|
||||
authorization: true,
|
||||
cookie: true,
|
||||
};
|
||||
logger.info(
|
||||
{
|
||||
http_headers: Object.fromEntries(
|
||||
Object.entries(request.headers)
|
||||
.map(([k, v]) => (censoredHeadersLC[k.toLowerCase()] ? null : [k, v]))
|
||||
.filter(x => !!x),
|
||||
),
|
||||
},
|
||||
"auth_attempt",
|
||||
);
|
||||
if (request.body.oidc_id_token) {
|
||||
return { access_token: await this.authByToken(request.body.oidc_id_token) };
|
||||
} else if (request.body.email && request.body.password) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import TrackerAPI from "../core/platform/services/tracker/provider";
|
||||
import WebServerAPI from "../core/platform/services/webserver/provider";
|
||||
|
||||
import assert from "assert";
|
||||
import { logger } from "../core/platform/framework";
|
||||
import { logger, TdriveServiceState } from "../core/platform/framework";
|
||||
import { ApplicationServiceImpl } from "./applications/services/applications";
|
||||
import { CompanyApplicationServiceImpl } from "./applications/services/company-applications";
|
||||
import { ApplicationHooksService } from "./applications/services/hooks";
|
||||
@@ -78,6 +78,7 @@ class GlobalResolver {
|
||||
public services: TdriveServices;
|
||||
public platformServices: PlatformServices;
|
||||
public database: DatabaseServiceAPI;
|
||||
private platform?: TdrivePlatform;
|
||||
|
||||
public fastify: FastifyInstance<Server, IncomingMessage, ServerResponse>;
|
||||
|
||||
@@ -87,6 +88,7 @@ class GlobalResolver {
|
||||
if (this.alreadyInitialized) {
|
||||
return;
|
||||
}
|
||||
this.platform = platform;
|
||||
this.database = platform.getProvider<DatabaseServiceAPI>("database");
|
||||
|
||||
this.platformServices = {
|
||||
@@ -152,6 +154,11 @@ class GlobalResolver {
|
||||
logger.info("Global resolver finished initializing services");
|
||||
this.alreadyInitialized = true;
|
||||
}
|
||||
|
||||
/** `true` if all components are in the started state. This means we should respond to http at least (for kubernetes Startup probe). */
|
||||
isPlatformStarted(): boolean {
|
||||
return this.alreadyInitialized && this.platform?.state.getValue() == TdriveServiceState.Started;
|
||||
}
|
||||
}
|
||||
|
||||
export default new GlobalResolver();
|
||||
|
||||
Reference in New Issue
Block a user