diff --git a/packages/fleet/lib/supervisor.ts b/packages/fleet/lib/supervisor.ts index c74c78fc2df..7cf59cf33e5 100644 --- a/packages/fleet/lib/supervisor.ts +++ b/packages/fleet/lib/supervisor.ts @@ -116,25 +116,22 @@ export class Supervisor { } public async tick(): Promise> { - const tickSpan = tracer.startSpan('fleet.supervisor.tick'); - return tracer.scope().activate(tickSpan, async () => { - try { - this.tickCancelled = false; - - const plan = await this.plan(); - if (plan.isOk()) { - await this.executePlan(plan.value); - return Ok(undefined); - } else { - return Err(plan.error); - } - } catch (err) { - tickSpan.setTag('error', err); - return Err(new FleetError('supervisor_tick_failed', { cause: err })); - } finally { - tickSpan.finish(); + const span = tracer.startSpan('fleet.supervisor.tick'); + try { + this.tickCancelled = false; + const plan = await this.plan(); + if (plan.isOk()) { + await this.executePlan(plan.value); + return Ok(undefined); + } else { + return Err(plan.error); } - }); + } catch (err) { + span.setTag('error', err); + return Err(new FleetError('supervisor_tick_failed', { cause: err })); + } finally { + span.finish(); + } } private async loop(): Promise {