Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-snails-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-kit': patch
---

[internal] suppress console errors when pushing metrics
5 changes: 4 additions & 1 deletion packages/cli-kit/src/private/node/otel-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DefaultOtelServiceOptions,
} from '../../public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js'
import {isUnitTest, opentelemetryDomain} from '../../public/node/context/local.js'
import {ValueType} from '@opentelemetry/api'
import {ValueType, diag} from '@opentelemetry/api'

type MetricRecorder =
| 'console'
Expand Down Expand Up @@ -150,6 +150,9 @@ function globalOtelService(options: CreateMetricRecorderOptions): OtelService {
env: undefined,
otelEndpoint: `${opentelemetryDomain()}/v1/metrics`,
})
// Suppress OTEL diagnostic output — internal export errors (e.g. retryable failures)
// should never appear in user-facing CLI output.
diag.disable()
}
return _otelService
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export function throttle<T extends (...args: any) => any>(
timeout = null
if (lastArgs) {
result = func.apply(context, lastArgs)
// If the throttled function returns a promise, swallow rejections to
// prevent unhandled promise rejections (the caller already .catch()'d
// the leading-edge invocation and has no reference to trailing calls).
if (result && typeof (result as any).catch === 'function') {
(result as any).catch(() => {})
}
}
context = null
lastArgs = null
Expand Down
Loading