0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-12 14:19:01 +00:00
renovatebot_renovate/lib/instrumentation/utils.ts

23 lines
568 B
TypeScript

import is from '@sindresorhus/is';
export function isTracingEnabled(): boolean {
return isTraceDebuggingEnabled() || isTraceSendingEnabled();
}
export function isTraceDebuggingEnabled(): boolean {
return !!process.env.RENOVATE_TRACING_CONSOLE_EXPORTER;
}
export function isTraceSendingEnabled(): boolean {
return !!process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
}
export function massageThrowable(e: unknown): string | undefined {
if (is.nullOrUndefined(e)) {
return undefined;
}
if (e instanceof Error) {
return e.message;
}
return String(e);
}