mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-30 05:32:30 +08:00
[TortoiseORM instrumentation] Fix AttributeError: type object 'Config' has no attribute 'title'
(#1575)
* Use pydantic model name as default `title` value * Update `CHANGELOG.md` * Format with black * Lint with `black`
This commit is contained in:
@ -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.
|
||||
|
@ -291,14 +291,19 @@ class TortoiseORMInstrumentor(BaseInstrumentor):
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user