Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9a939073
Commit
9a939073
authored
Sep 16, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make 502 errors easier to spot in Sentry
parent
91ec241b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
CHANGELOG
CHANGELOG
+2
-1
internal/badgateway/roundtripper.go
internal/badgateway/roundtripper.go
+7
-1
No files found.
CHANGELOG
View file @
9a939073
...
...
@@ -4,7 +4,8 @@ Formerly known as 'gitlab-git-http-server'.
v0.8.2 (not released yet)
Recognize more archive formats in git.SendArchive.
Recognize more archive formats in git.SendArchive. Make 502 errors
(failed proxy requests to Unicorn) easier to recognize in Sentry.
v0.8.1
...
...
internal/badgateway/roundtripper.go
View file @
9a939073
...
...
@@ -24,6 +24,9 @@ var DefaultTransport = &http.Transport{
TLSHandshakeTimeout
:
10
*
time
.
Second
,
// from http.DefaultTransport
}
// Custom error for pretty Sentry 'issues'
type
Error502
error
type
RoundTripper
struct
{
Transport
*
http
.
Transport
}
...
...
@@ -68,6 +71,7 @@ func mustParseAddress(address, scheme string) string {
}
func
(
t
*
RoundTripper
)
RoundTrip
(
r
*
http
.
Request
)
(
res
*
http
.
Response
,
err
error
)
{
start
:=
time
.
Now
()
res
,
err
=
t
.
Transport
.
RoundTrip
(
r
)
// httputil.ReverseProxy translates all errors from this
...
...
@@ -77,7 +81,9 @@ func (t *RoundTripper) RoundTrip(r *http.Request) (res *http.Response, err error
// instead of 500s we catch the RoundTrip error here and inject a
// 502 response.
if
err
!=
nil
{
helper
.
LogError
(
fmt
.
Errorf
(
"proxyRoundTripper: %s %q failed with: %q"
,
r
.
Method
,
r
.
RequestURI
,
err
))
helper
.
LogError
(
Error502
(
fmt
.
Errorf
(
"badgateway: %s %q failed after %.3fs: %v"
,
r
.
Method
,
r
.
RequestURI
,
time
.
Since
(
start
)
.
Seconds
(),
err
,
)))
res
=
&
http
.
Response
{
StatusCode
:
http
.
StatusBadGateway
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment