Skip to content

Commit 84612d5

Browse files
authored
feat: add disableStartupLogs flag (#165)
1 parent c7ea13c commit 84612d5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.changeset/friendly-doors-visit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/node-opentelemetry': patch
3+
---
4+
5+
feat: add disableStartupLogs flag

packages/node-opentelemetry/src/otel.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export type SDKConfig = {
6565
detectResources?: boolean;
6666
disableLogs?: boolean;
6767
disableMetrics?: boolean;
68+
disableStartupLogs?: boolean;
6869
disableTracing?: boolean;
6970
enableInternalProfiling?: boolean;
7071
experimentalExceptionCapture?: boolean;
@@ -168,8 +169,11 @@ const healthCheckUrl = async (
168169
};
169170

170171
export const initSDK = (config: SDKConfig) => {
172+
const defaultDisableStartupLogs =
173+
config.disableStartupLogs ?? !DEFAULT_HDX_STARTUP_LOGS;
174+
171175
const ui = ora({
172-
isSilent: !DEFAULT_HDX_STARTUP_LOGS,
176+
isSilent: defaultDisableStartupLogs,
173177
prefixText: UI_LOG_PREFIX,
174178
spinner: cliSpinners.dots,
175179
text: 'Initializing OpenTelemetry SDK...',
@@ -610,7 +614,7 @@ export const initSDK = (config: SDKConfig) => {
610614
symbol: '🦄',
611615
});
612616

613-
if (DEFAULT_HDX_STARTUP_LOGS) {
617+
if (!defaultDisableStartupLogs) {
614618
setTimeout(() => {
615619
const _targetUrl = `https://www.hyperdx.io/services?service=${encodeURIComponent(
616620
defaultServiceName,
@@ -655,7 +659,6 @@ export const init = (config?: Omit<SDKConfig, 'programmaticImports'>) =>
655659

656660
const _shutdown = () => {
657661
const ui = ora({
658-
isSilent: !DEFAULT_HDX_STARTUP_LOGS,
659662
spinner: cliSpinners.dots,
660663
text: 'Shutting down OpenTelemetry SDK...',
661664
}).start();

0 commit comments

Comments
 (0)