Skip to content

[Tracking] Figure out how we should handle the disposing of the meters created from meter factory #86592

@tarekgh

Description

@tarekgh

The IMeterFactory interface offers the Create method for generating a Meter instance. We supply the default implementation of the meter factory, which utilizes this method to create meters. However, an issue arises as Meters are disposable objects, and we assert that the factory should be responsible for managing the lifetime of the meters it creates. Users who employ the factory to generate meters may mistakenly consider it to be disposable and attempt to dispose of it. We are currently tracking this issue to determine the most appropriate resolution.

Here are a couple of suggestions to address the issue:

  • Modify the returned meters' disposal behavior to be a no-op, ensuring that no adverse effects occur even if users attempt to dispose of them.
  • Rename the Create method to something like Get to convey to users that the returned objects should not be disposed.

Consider implementing one or both of these ideas to mitigate the problem and provide clearer guidance to users.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions