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

feat: trace http.status_code #2708

Merged
merged 10 commits into from
Jan 4, 2023
Merged

feat: trace http.status_code #2708

merged 10 commits into from
Jan 4, 2023

Conversation

xiang-xx
Copy link
Contributor

@xiang-xx xiang-xx commented Dec 16, 2022

Trace http.status_code

Add a traceResponseWriter to set trace span attribute and status:

  • set attribute http.status_code with http statusCode
  • set Error when code >= 400, else Ok

}

func (w *traceResponseWriter) Write(data []byte) (int, error) {
return w.w.Write(data)

Check warning

Code scanning / CodeQL

Information exposure through a stack trace

HTTP response depends on [stack trace information](1) and may be exposed to an external user. HTTP response depends on [stack trace information](2) and may be exposed to an external user. HTTP response depends on [stack trace information](3) and may be exposed to an external user.
Copy link
Contributor

@kevwan kevwan left a comment

Choose a reason for hiding this comment

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

Thanks for you PR!

rest/handler/tracinghandler.go Show resolved Hide resolved
rest/handler/tracinghandler.go Show resolved Hide resolved
@xiang-xx xiang-xx requested a review from kevwan December 19, 2022 01:25
Copy link
Contributor

@kevwan kevwan left a comment

Choose a reason for hiding this comment

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

LGTM.

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2023

Codecov Report

Merging #2708 (4c4858e) into master (cf435bf) will decrease coverage by 0.07%.
The diff coverage is 64.51%.

Impacted Files Coverage Δ
rest/handler/tracinghandler.go 81.35% <64.51%> (-18.65%) ⬇️
core/stores/sqlx/tx.go 19.41% <0.00%> (-3.89%) ⬇️
core/logx/rotatelogger.go 71.58% <0.00%> (-2.22%) ⬇️
core/stores/sqlx/sqlconn.go 57.84% <0.00%> (+1.47%) ⬆️

@kevwan kevwan merged commit 641ebf1 into zeromicro:master Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants