Skip to content

Commit d7edd29

Browse files
Merge pull request #388 from pace/sentry
Sentry cleanup and fixes
2 parents 8c94a5a + f46f39c commit d7edd29

File tree

12 files changed

+330
-513
lines changed

12 files changed

+330
-513
lines changed

backend/couchdb/db.go

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func Client(cfg *Config) (*kivik.Client, error) {
7979
Username: cfg.User,
8080
Password: cfg.Password,
8181
},
82-
&transport.TracingRoundTripper{},
8382
transport.NewDumpRoundTripperEnv(),
8483
}
8584
if !cfg.DisableRequestLogging {

http/jsonapi/generator/generate_handler.go

+5-18
Original file line numberDiff line numberDiff line change
@@ -595,31 +595,19 @@ func (g *Generator) buildHandler(method string, op *openapi3.Operation, pattern
595595
// recover panics
596596
g.Defer().Qual(pkgMaintErrors, "HandleRequest").Call(jen.Lit(handler), jen.Id("w"), jen.Id("r"))
597597

598-
g.Add(auth)
599-
// set tracing context
600-
601-
ctxStmt := jen.Id("r").Dot("Context").Call()
602-
603-
if auth != nil {
604-
ctxStmt = jen.Id("ctx")
605-
}
606-
607598
g.Line().Comment("Trace the service function handler execution")
608599
g.Id("span").Op(":=").Qual(pkgSentry, "StartSpan").Call(
609-
ctxStmt, jen.Lit("http.server"), jen.Qual(pkgSentry, "WithDescription").Call(jen.Lit(handler)))
600+
jen.Id("r").Dot("Context").Call(), jen.Lit("http.server"), jen.Qual(pkgSentry, "WithDescription").Call(jen.Lit(handler)))
610601
g.Defer().Id("span").Dot("Finish").Call()
611602
g.Line().Empty()
612603

613-
operator := ":="
614-
615-
if auth != nil {
616-
operator = "="
617-
}
618-
619-
g.Id("ctx").Op(operator).Id("span").Dot("Context").Call()
604+
// set tracing context
605+
g.Id("ctx").Op(":=").Id("span").Dot("Context").Call()
620606

621607
g.Id("r").Op("=").Id("r.WithContext").Call(jen.Id("ctx"))
622608

609+
g.Add(auth)
610+
623611
g.Line().Comment("Setup context, response writer and request type")
624612

625613
// response writer
@@ -830,7 +818,6 @@ func generateAuthorizationForMultipleSecSchemas(op *openapi3.Operation, secSchem
830818

831819
caser := cases.Title(language.Und, cases.NoLower)
832820

833-
r.Line().Var().Id("ctx").Id("context.Context")
834821
r.Line().Var().Id("ok").Id("bool")
835822
for _, val := range orderedSec {
836823
name := val[0]

http/jsonapi/generator/internal/pay/open-api_test.go

+14-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)