Switch language한국어
Back to the list

Refactoring OpenTelemetry Metrics: from God Class to Per-Subsystem Modules

TL;DR AI

Key summary

2 min read
  1. The OpenTelemetry metrics architecture was refactored from one large Metrics class built on mixins to separate subsystem modules.

  2. Each module now uses its own memoized factory for instrument creation, with a lightweight per-request wrapper for access.

  3. This removes mixin name collisions, hidden overrides, and MRO-related fragility while making the design clearer.

  4. It still preserves the process-level singleton rule that OpenTelemetry instruments must be created once and reused.

Read the original