instana / python-sensor

:snake: Python Distributed Tracing & Metrics Sensor for Instana
https://www.instana.com/
MIT License
69 stars 31 forks source link

fix: Capture the correct log caller #605

Closed GSVarsha closed 2 months ago

GSVarsha commented 2 months ago

What

Python version >= 3.13

log_withinstana -> \_call__ -> custom_func stacklevel1 -> stacklevel2 -> stacklevel3

Python version < 3.13

log_with_instana -> custom_func stacklevel1 -> stacklevel2

Why

Bug reported by a customer: https://github.com/instana/python-sensor/issues/563

Before the changes

BEFORE instana import
funcName:custom_func message:Hello, world

AFTER instana import
funcName:log_with_instana message:Hello, world

After the changes

BEFORE instana import
funcName:custom_func message:Hello, world

AFTER instana import
funcName:custom_func message:Hello, world