question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instrumented mysql not working with pymysql

See original GitHub issue

I am using PyMySQL==0.9.2 for MySQL connection. I can’t get MySQL instrument for my requests.

repreduce If I just import pumysql, agent will not found the mysql module.

import pymysql
pymysql.connect(**db_conf,
                charset='utf8mb4',
                cursorclass=pymysql.cursors.SSDictCursor)
# LOG
DEBUG elasticapm.instrument:base.py:73 - Skipping instrumentation of mysql. Module MySQLdb not found

If I just import pumysql as MySQLdb, agent will found the mysql module, but not working.

import pymysql
pymysql.install_as_MySQLdb()
pymysql.connect(**db_conf,
                charset='utf8mb4',
                cursorclass=pymysql.cursors.SSDictCursor)

# LOG
DEBUG elasticapm.instrument:base.py:82 - Instrumented mysql, MySQLdb.connect

Environment (please complete the following information)

  • OS: mac 10.14.2 (18C54)
  • Python version: python 3.6.5
  • Framework and version [e.g. Django 2.1]: Flask==1.0.2
  • APM Server version: 6.4.0
  • Agent version: elastic-apm==3.0.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
beniwohlicommented, Dec 16, 2018

Hi @BrikerMan

unfortunately, we don’t yet support pymysql instrumentation, and I’m unfamiliar with its MySQLdb compatibility mode.

While adding support for pymysql would probably be relatively straight forward, we need to be vary to not overload the agent with built-in instrumentations. Every new instrumentation we write needs to be tested, supported and updated, adding a lot of additional load. We are currently looking into ways to add custom module instrumentation without having to depend on built-in instrumentation.

0reactions
basepicommented, Oct 7, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does pymysql hang on a select statement that works fine ...
As I said before, running the query in MySQL workbench returns results immediately. The query itself is shown below: SELECT at.instrument, at.
Read more >
Connect to MySQL using PyMySQL in Python - GeeksforGeeks
In this article, we will discuss how to connect to the MySQL database remotely or locally using Python. In below process, we will...
Read more >
PyMySQL - PyPI
This package contains a pure-Python MySQL client library, based on PEP 249. Most public APIs are compatible with mysqlclient and MySQLdb.
Read more >
Integrations — ddtrace documentation - Read the Docs
The pymysql integration instruments the pymysql library to trace MySQL queries. Enabling¶. The integration is enabled automatically when using ddtrace-run or ...
Read more >
Connection to RDS database not working : r/aws - Reddit
I'm trying to connect to a RDS database that already has public access, with this code: connection = pymysql.connect(host=host, user=user…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found