I am using APM flask client in my Flask APP. After I instantiate the apm object, I am unable to use existing MySQLdb function in my app, below is how I instantiate the class.
apm = ElasticAPM(app)
The error is get in my MySQLdb implementation when calling cursor execute function below cursor.execute(query=query)
TypeError: execute() got an unexpected keyword argument 'query'
I have identified the change in the apm library that is causing this.
The file is register.py,
and the commenting out the below line fixes the issue for me.
I was able to read through library code and figure out it uses SKIP_INSTRUMENT_
see code from library below
skip_env_var = "SKIP_INSTRUMENT_" + str(self.name.upper())
if skip_env_var in os.environ:
logger.debug("Skipping instrumentation of %s. %s is set.", self.name, skip_env_var)
return
As a fix in my code, I set the below
os.environ["SKIP_INSTRUMENT_MYSQL"] = "1"
This seems to have fixed the issue for me, but I'm still curious to know from the dev team why all registers/methods are instrumented with a wrapper.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.