2024-09-19 19:44:15 +00:00
|
|
|
import is from '@sindresorhus/is';
|
|
|
|
|
2022-10-23 04:36:35 +00:00
|
|
|
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;
|
|
|
|
}
|
2024-09-19 19:44:15 +00:00
|
|
|
|
|
|
|
export function massageThrowable(e: unknown): string | undefined {
|
|
|
|
if (is.nullOrUndefined(e)) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
if (e instanceof Error) {
|
|
|
|
return e.message;
|
|
|
|
}
|
|
|
|
return String(e);
|
|
|
|
}
|