Creates a new TelemetryError instance.
Telemetry error construction options including optional exporter type and package name for diagnostic context.
import { TelemetryError } from '#core/errors/telemetry-error.js';
const error = new TelemetryError({
message: 'Peer dependency missing: @opentelemetry/sdk-node',
attempted: 'Dynamic import of @opentelemetry/sdk-node',
code: 'ERR_TELEMETRY_PEER_DEP_MISSING',
packageName: '@opentelemetry/sdk-node',
});
ReadonlyattemptedReadonlycodeReadonlydetailsReadonlyexporterReadonlypackageReadonlyretryableReadonlyseverityReadonlysuggestionsReadonlytimestampReturns AI-agent-friendly context with telemetry-specific diagnostic fields.
Base AI context extended with exporter type and package name details.
Serializes this error to a JSON-safe object with telemetry-specific fields.
Base serialization extended with exporterType and packageName.
Error subclass for OpenTelemetry initialization and runtime failures.
Example
Failure Mode
Init failed — OTel SDK could not be started
Failure Mode
Peer dep missing — required OTel package not installed
Failure Mode
Exporter failed — trace/metrics exporter creation failed
Failure Mode
Shutdown failed — graceful shutdown of SDK timed out
Failure Mode
Metrics init failed — metrics SDK could not be started