Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log db statement with parameter value when use SmartSql #539

Merged
merged 2 commits into from Feb 19, 2023

Conversation

xclw2000
Copy link
Contributor

Please answer these questions before submitting pull request

  • Why submit this pull request?

  • New feature provided

  • Related issues
    Can't log parameter values


New feature or improvement

  • log parameter values when log db statement

@@ -249,7 +250,12 @@ public void BeforeCommandExecuterExecute([Object]CommandExecuterExecuteBeforeEve
var context = CreateSmartSqlLocalSegmentContext(eventData.Operation);
if (eventData.ExecutionContext.Request.RealSql != null)
{
context.Span.AddTag(Common.Tags.DB_STATEMENT, eventData.ExecutionContext.Request.RealSql);
//context.Span.AddTag(Common.Tags.DB_STATEMENT, eventData.ExecutionContext.Request.RealSql);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you comment this line?

Copy link
Contributor Author

@xclw2000 xclw2000 Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below varialbe "sql" include "RealSql"
for example:
ReqlSql="select 1 from T where F1=@F1"
sql="selece 1 from T where F1='aaa'"

So it's no need to log RealSql

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean if you try to delete this, delete this. Git is the time machine. We don't need to keep old codes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommit pr after I delete it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if your plan is to remove this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@wu-sheng wu-sheng added this to the 2.2.0 milestone Feb 16, 2023
@wu-sheng wu-sheng added the enhancement New feature or request label Feb 16, 2023
@wu-sheng
Copy link
Member

Let's wait for @liuhaoyang to review other details.

@liuhaoyang
Copy link
Collaborator

Let's wait for @liuhaoyang to review other details.

LGTM

@liuhaoyang liuhaoyang merged commit 30366b7 into SkyAPM:main Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants