🔇 back: silent output of purposefully non implemented diagnostics (#762)
This commit is contained in:
@@ -79,7 +79,9 @@ export const getConfig = (): IDiagnosticsConfig => {
|
||||
export type TDiagnosticKey = string;
|
||||
|
||||
/** Each provider should return an object of this format. The key of the provider defines the schema. */
|
||||
export type TDiagnosticResult = { ok: boolean; warn?: string } & { [key: string]: unknown };
|
||||
export type TDiagnosticResult = { ok: boolean; warn?: string; empty?: boolean } & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
/** Implemented by objects that want to provide data to the diagnostic check */
|
||||
export interface IDiagnosticProvider {
|
||||
@@ -155,7 +157,7 @@ const runProvider = async (provider, log) => {
|
||||
{ diagnostic: provider.key, ...result },
|
||||
"Got diagnostic provider result with ok=true but a warning",
|
||||
);
|
||||
else if (log)
|
||||
else if (log && !result.empty)
|
||||
logger.info({ diagnostic: provider.key, ...result }, "Diagnostic provider result");
|
||||
return recordDiagnostic(startMs, provider.key, result);
|
||||
} catch (err) {
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ export class PostgresConnector extends AbstractConnector<PostgresConnectionOptio
|
||||
]),
|
||||
};
|
||||
case TServiceDiagnosticDepth.stats_basic:
|
||||
return { ok: true, warn: "pgsql_basic_has_no_basic_level_stats" };
|
||||
return { ok: true, empty: true };
|
||||
case TServiceDiagnosticDepth.stats_deep:
|
||||
return {
|
||||
ok: true,
|
||||
|
||||
@@ -51,7 +51,8 @@ export default class S3ConnectorService implements StorageConnectorAPI {
|
||||
case TServiceDiagnosticDepth.stats_basic:
|
||||
case TServiceDiagnosticDepth.stats_track:
|
||||
case TServiceDiagnosticDepth.stats_deep:
|
||||
return { ok: true, warn: "s3_statistics_not_implemented" };
|
||||
// Local store is always ok... should never be used outside dev environments
|
||||
return { ok: true, empty: true };
|
||||
|
||||
default:
|
||||
throw new Error(`Unexpected TServiceDiagnosticDepth: ${JSON.stringify(depth)}`);
|
||||
|
||||
@@ -36,7 +36,7 @@ export default class LocalConnectorService implements StorageConnectorAPI {
|
||||
case TServiceDiagnosticDepth.stats_basic:
|
||||
case TServiceDiagnosticDepth.stats_track:
|
||||
case TServiceDiagnosticDepth.stats_deep:
|
||||
return { ok: true, warn: "local_storage_always_ok" };
|
||||
return { ok: true, empty: true };
|
||||
|
||||
default:
|
||||
throw new Error(`Unexpected TServiceDiagnosticDepth: ${JSON.stringify(depth)}`);
|
||||
|
||||
Reference in New Issue
Block a user