instana / python-sensor

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

[Bug]: python-sensor overrides funcName which logs the message with log_with_instana #563

Closed staaam closed 2 months ago

staaam commented 3 months ago

Problem Description

Instana python-sensor overrides funcName which logs the message with log_with_instana

Impact: we're writing funcName for every message for easier understanding of the message origin, and currently we see log_with_instana in all places instead.

Minimal, Complete, Verifiable, Example

import logging

def random_func():
    logging.info("Hello, world")

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO, format="funcName:%(funcName)s message:%(message)s")
    random_func()

    import instana
    random_func()

Expected output:

funcName:random_func message:Hello, world
funcName:random_func message:Hello, world

Actual output:

funcName:random_func message:Hello, world
funcName:log_with_instana message:Hello, world

Python Version

Python 3

Python Modules

instana @ https://github.com/instana/python-sensor/archive/refs/tags/v2.4.0.zip

Python Environment

-
GSVarsha commented 3 months ago

Hi @staaam, thank you for reaching out to us. I just installed the same instana module version with pip install -e git+https://github.com/instana/python-sensor@v2.4.0#egg=instana and ran the same snippet you provided and it works fine for me.

BEFORE instana import
funcName:random_func message:Hello, world
AFTER instana import
funcName:random_func message:Hello, world
staaam commented 3 months ago

oh, could it be related to python3.12 ? UPD: just checked, loooks like python3.10 works as expected, but 3.11/3.12 has this issue UPD2: also upgraded to python-sensor 2.5.1 - also happens

GSVarsha commented 3 months ago

Hi @staaam, thanks for the update! Yeah, I checked with python 3.10.13 and it works but when I checked with python 3.11.0 and 3.12.0 I could see the same issue you're facing.

Is it possible for you to use python 3.10 until we figure out what we could do about this?

staaam commented 3 months ago

thanks! Unfortunately no, we've just recently migrated to python3.12 and go back is not an option. Worth saying, that at the moment it's not an urgent issue for us, so I think we can wait for this to be fixed...

staaam commented 1 month ago

thanks! looks like this solves the issue. Any estimation when version with the fix will be released?

GSVarsha commented 1 month ago

thanks! looks like this solves the issue. Any estimation when version with the fix will be released?

Hi @staaam, the fix is already available on the master branch, I will release a new version with the fix before tomorrow and will update you here!

GSVarsha commented 1 month ago

Hello @staaam, we've released the new version with the fix. You can install the same using the command below:

pip install git+https://github.com/instana/python-sensor@v2.5.3

Do let us know if you need anything else, thanks!

staaam commented 1 month ago

thank you! 🙏