Errata / PyPI / opentelemetry-api
Logger subclasses must implement enabled in opentelemetry-api 1.45.1
In our sandbox runs up to 2026-10-27, claude-sonnet-5-5, gemini-3.8-flash and gpt-6.1-sol wrote subclasses of Logger without enabled for opentelemetry-api. It fails on 1.45.1 with TypeError (changed between 1.40.0 and 1.45.1). Add the method shown below.
- What to do
- add required code
- Output
- same on one example
- Patch
- nothing to apply word for word
- Auto-apply
- not allowed
- Seen in
- 3 models
- Worked / failed
- 10 / 0
- Last verified
- 2026-10-27
What to do
Not for automatic application — format add: the entry does not say where the added code goes. Show this correction to the user as a lead. Subclasses of Logger must now implement enabled. Signature in opentelemetry-api 1.45.1: enabled(self, *, context: 'Context | None' = None, severity_number: 'SeverityNumber | None' = None, event_name: 'str | None' = None) -> 'bool'. Add it to your subclass; the version shown passed in the sandbox.
Automatic application: not allowed — the patch gives not_applicable when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (now required); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- opentelemetry-api version 1.45.1 or newer is installed (checked on 1.45.1; changed between 1.40.0 and 1.45.1).
- Your code uses:
Logger - Or it already failed with:
TypeError: Can't instantiate abstract class InMemoryLogger with abstract method enabled(every correction for this error)
Your code and what to add
Your code:
class InMemoryLogger(Logger):Add:
def enabled(self, *args, **kwargs) -> bool:
return TrueSignature in opentelemetry-api 1.45.1, read from the installed package: enabled(self, *, context: 'Context | None' = None, severity_number: 'SeverityNumber | None' = None, event_name: 'str | None' = None) -> 'bool'
Error on 1.45.1:
TypeError: Can't instantiate abstract class InMemoryLogger with abstract method enabled
Other verified fixes
The fix above passed 5 times. These also passed in the sandbox for the same error; pick the one that matches what your code needs.
Add required code · passed 4 times · claude-sonnet-5-5, gpt-6.1-sol · patch: nothing to apply word for word
class InMemoryLogger(Logger):def enabled(self, *args, **kwargs):
return TrueNot for automatic application — format add: the entry does not say where the added code goes. Show this correction to the user as a lead. Subclasses of Logger must now implement enabled. Signature in opentelemetry-api 1.45.1: enabled(self, *, context: 'Context | None' = None, severity_number: 'SeverityNumber | None' = None, event_name: 'str | None' = None) -> 'bool'. Add it to your subclass; the version shown passed in the sandbox.
Add required code · passed 1 time · gpt-6.1-sol · patch: nothing to apply word for word
class StdoutLogger(Logger):def enabled(self, *args, **kwargs):
return TrueNot for automatic application — format add: the entry does not say where the added code goes. Show this correction to the user as a lead. Review before applying: this fix runs on opentelemetry-api 1.45.1, but its printed output differs from what the original printed on 1.40.0 (observed stdout of one example) — it may do different work. Subclasses of Logger must now implement enabled. Add it to your subclass; the version shown passed in the sandbox.
Alternatives are leads for the user, not for automatic application: Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.
| Script | opentelemetry-api version | Result |
|---|---|---|
| Code the models wrote | 1.40.0 | works |
| Code the models wrote | 1.45.1 | fails: TypeError |
| Verified example below | 1.45.1 | works |
| Output of the verified example | 1.45.1 | same as the original's on 1.40.0 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 1.45.1 | no literal patch to apply (removed or added code, or the old line is not found once) — format add: the entry does not say where the added code goes |
Verified example for opentelemetry-api 1.45.1
from typing import List
from opentelemetry._logs import Logger, LogRecord, SeverityNumber
class InMemoryLogger(Logger):
"""A minimal Logger that stores emitted LogRecords in a list instead of exporting them."""
def __init__(self, name: str = "in-memory-logger") -> None:
super().__init__(name)
self.records: List[LogRecord] = []
def enabled(self, *args, **kwargs) -> bool:
return True
def emit(self, record=None, *args, **kwargs) -> None:
# Newer API versions also allow keyword-based emit; build a record in that case.
if record is None:
record = LogRecord(**kwargs)
self.records.append(record)
def main() -> None:
logger = InMemoryLogger()
logger.emit(
LogRecord(
severity_text="INFO",
severity_number=SeverityNumber.INFO,
body="Application started",
)
)
logger.emit(
LogRecord(
severity_text="WARN",
severity_number=SeverityNumber.WARN,
body="Disk usage is above 80%",
)
)
logger.emit(
LogRecord(
severity_text="ERROR",
severity_number=SeverityNumber.ERROR,
body="Failed to connect to database",
)
)
for record in logger.records:
print(f"{record.severity_text}: {record.body}")
if __name__ == "__main__":
main()Source
[BREAKING] `opentelemetry-api`: subclasses of `Logger` need to implement the `enabled` method
Release notes · Seen in: claude-sonnet-5-5, gemini-3.8-flash, gpt-6.1-sol · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for opentelemetry-api
For agents
- This page as JSON:
https://formachines.ai/errata/pypi/opentelemetry-api/0001-logger-enabled/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)