open-telemetry / open-telemetry/opentelemetry-python-contrib

sqlcommenter: put the comment at the beginning of the query

Open Beginner friendly
#3,583 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Hi!

sqlcommenter appends the comment to the end of the query. I would propose prepending the comment at the beginning of the query instead.

The comment at the end is problematic when the query is really long, and the comment is truncated from database query logs. The very long queries are often produced by Django, and the query logs (e.g. top slow queries) have limited length in AWS RDS.

What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read opentelemetry-instrumentation/src/opentelemetry/instrumentation/sqlcommenter_utils.py at the linked line to understand how sqlcommenter currently appends comments. Verify the completed change by checking that generated comments appear before the SQL text, including for the long-query case described with AWS RDS logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.