[#44] add tracing support refactoring #53
No reviewers
TrueCloudLab/storage-services-developers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-http-gw#53
Loading…
Reference in a new issue
No description provided.
Delete branch "pogpp/frostfs-http-gw:feature/tracing_refactoring"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #44
Signed-off-by: Pavel Pogodaev p.pogodaev@yadro.com
Check
fetchOwnerAndBearerToken()
usage. It usesfasthttp.RequestCtx
instead ofctx
.@ -162,0 +158,4 @@
// // Expect to see the same token without errors.
// actual, err := LoadBearerToken(ctx)
// require.NoError(t, err)
// require.Equal(t, tkn, actual)
We can replace
StoreBearerToken
call withStoreBearerTokenAppCtx
.@ -45,1 +46,4 @@
}
func AddToContext(ctx context.Context, c *fasthttp.RequestCtx) {
c.SetUserValue("context", ctx)
Put
context
into constant. Also it would be nice to add comments to a public functions in the package!7988bed472
to70cbf5285c
@ -46,0 +51,4 @@
}
// GetFromContext returns main context from fasthttp request context.
func GetFromContext(c *fasthttp.RequestCtx) context.Context {
Let's rename these functions to
GetContext
andSetContext
orGetFromRequest
andSetToRequest
orGetContextFromRequest
andSetContextToRequest
?
Last one seems good to me.
@ -101,6 +103,7 @@ func newApp(ctx context.Context, opt ...Option) App {
)
a := &app{
ctx: ctx,
If we store appCtx to this, we now can:
appCtx
from here and herea.ctx
insidea.initTracing
,a.initTree
,a.initServers
and other similar places)@ -503,2 +506,4 @@
}
func (a *app) tokenizer(h fasthttp.RequestHandler) fasthttp.RequestHandler {
return func(ctx *fasthttp.RequestCtx) {
Since we started to rename variables with type
*fasthttp.RequestCtx
toreq
let's stick on it.@ -505,0 +518,4 @@
}
func (a *app) tracer(h fasthttp.RequestHandler) fasthttp.RequestHandler {
return func(ctx *fasthttp.RequestCtx) {
Since we started to rename variables with type
*fasthttp.RequestCtx
toreq
let's stick on it.@ -505,0 +521,4 @@
return func(ctx *fasthttp.RequestCtx) {
appCtx := utils.GetFromContext(ctx)
appCtx, span := utils.StartHTTPServerSpan(appCtx, ctx, "OPERATION With Object")
Maybe we should write
REQUEST to http-gw
instead ofOPERATION With Object
?70cbf5285c
tocdaab4feab