Skip to content

v1.23.0 added an abstract method to Meter, breaking subclasses  #3710

Closed
@alexmojaki

Description

@alexmojaki

We're developing an SDK that uses OpenTelemetry. This morning a user reported that after installing the SDK, everything they tried led to this error:

TypeError: Can't instantiate abstract class _ProxyMeter with abstract method create_gauge

_ProxyMeter here is our own subclass of Meter.

The changelog says:

this project adheres to Semantic Versioning.

I think releasing this change violates semver, as it was a minor version release that created errors in previously compliant code.

If this is intentional because users aren't supposed to subclass Meter themselves, please let me know so that we can constrain the dependency to <1.24 to avoid any future surprises. We have subclasses of Span, Tracer, TracerProvider, MeterProvider, Meter, and probably others, so from our perspective the abstract base classes need to be stable.

If this wasn't intentional, then in future I think you could either:

  1. Release such changes in a major version, or
  2. Add new 'abstract' methods to abstract base classes as normal methods (i.e. not decorated with @abstractmethod) but that simply raise NotImplementedError. That way subclasses can still be instantiated.

We've resolved the problem in our own library, but it's likely that there are other libraries currently giving new users the same error. That could be mitigated here by either:

  1. Releasing 2.0.0 with the same code, then yanking 1.23.0 from PyPI. This means that pip install opentelemetry-sdk<2 will install 1.22.0, while pip install opentelemetry-sdk==1.23.0 will still work.
  2. Releasing 1.23.1 with a backwards compatible fix such as (2) above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p1Issues that should be resolved in the upcoming release (except for zero-day hotfix release)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions