Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TortoiseORM instrumentation] Fix AttributeError: type object 'Config' has no attribute 'title' #1575

Merged
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fix TortoiseORM instrumentation `AttributeError: type object 'Config' has no attribute 'title'`
([#1575](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1575))
- Fix SQLAlchemy uninstrumentation
([#1581](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1581))
- `opentelemetry-instrumentation-grpc` Fix code()/details() of _OpentelemetryServicerContext.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,19 @@ async def _from_queryset(self, func, modelcls, args, kwargs):
name = f"pydantic.{func.__name__}"

with self._tracer.start_as_current_span(
name, kind=SpanKind.INTERNAL
name,
kind=SpanKind.INTERNAL,
) as span:
if span.is_recording():
span_attributes = {}

model_config = getattr(modelcls, "Config", None)
if model_config:
model_title = getattr(modelcls.Config, "title")
model_title = getattr(
modelcls.Config,
"title",
modelcls.__name__,
)
if model_title:
span_attributes["pydantic.model"] = model_title

Expand Down