Skip to content

make Agent.destroy() async #3222

@trentm

Description

@trentm

Currently in index.d.ts:

  export interface Agent {
    // ...
    destroy (): void;
  }

In the coming OTel Metrics work, Agent.destroy() will possibly call an async method to shutdown an OTel MeterProvider. This means that agent shutdown code can possibly be running after the sync Agent.destroy() method returns. That's unfortunate.

The fix is to make Agent.destroy() async -- i.e. returns a Promise -- then the user can await it. However, is changing that return type in the TypeScript types a breaking change? I'm not sure.

Metadata

Metadata

Assignees

Labels

agent-nodejsMake available for APM Agents project planning.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions