fix(telemetry): Catch a non-std exception from the metrics pipeline setup

The startup path caught std::exception only. initMetrics() reaches the OTel SDK,
which can throw something outside that hierarchy, and escaping a member
initializer would stop the node starting.

The section states the rule it must not break: a telemetry failure never stops
the node, the global provider stays a no-op and every instrument call remains
valid. The new clause drops the half-built provider and logs, exactly as the
std::exception clause does.

~ApplicationImp() already carries the same pairing for the same reason.
This commit is contained in:
Pratik Mankawde
2026-09-22 20:29:17 +01:00
parent ea521593bb
commit e8bb4f4657

View File

@@ -477,6 +477,16 @@ public:
"continuing without metrics: "
<< e.what();
}
catch (...)
{
// initMetrics() reaches third-party SDK code, which may throw
// something outside std::exception. Escaping a constructor on the
// startup path would stop the node starting, so drop the
// half-built provider exactly as the clause above does.
meterProvider_.reset();
JLOG(journal_.error()) << "Telemetry metrics pipeline failed to initialise, "
"continuing without metrics: unknown exception";
}
}
/**