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

Sentry cleanup and fixes #388

Merged
merged 7 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend/couchdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func Client(cfg *Config) (*kivik.Client, error) {
Username: cfg.User,
Password: cfg.Password,
},
&transport.TracingRoundTripper{},
transport.NewDumpRoundTripperEnv(),
}
if !cfg.DisableRequestLogging {
Expand Down
23 changes: 5 additions & 18 deletions http/jsonapi/generator/generate_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,31 +595,19 @@ func (g *Generator) buildHandler(method string, op *openapi3.Operation, pattern
// recover panics
g.Defer().Qual(pkgMaintErrors, "HandleRequest").Call(jen.Lit(handler), jen.Id("w"), jen.Id("r"))

g.Add(auth)
// set tracing context

ctxStmt := jen.Id("r").Dot("Context").Call()

if auth != nil {
ctxStmt = jen.Id("ctx")
}

g.Line().Comment("Trace the service function handler execution")
g.Id("span").Op(":=").Qual(pkgSentry, "StartSpan").Call(
ctxStmt, jen.Lit("http.server"), jen.Qual(pkgSentry, "WithDescription").Call(jen.Lit(handler)))
jen.Id("r").Dot("Context").Call(), jen.Lit("http.server"), jen.Qual(pkgSentry, "WithDescription").Call(jen.Lit(handler)))
g.Defer().Id("span").Dot("Finish").Call()
g.Line().Empty()

operator := ":="

if auth != nil {
operator = "="
}

g.Id("ctx").Op(operator).Id("span").Dot("Context").Call()
// set tracing context
g.Id("ctx").Op(":=").Id("span").Dot("Context").Call()

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

g.Add(auth)

g.Line().Comment("Setup context, response writer and request type")

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

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

r.Line().Var().Id("ctx").Id("context.Context")
r.Line().Var().Id("ok").Id("bool")
for _, val := range orderedSec {
name := val[0]
Expand Down
30 changes: 14 additions & 16 deletions http/jsonapi/generator/internal/pay/open-api_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading