Skip to content

Commit d0a6a6e

Browse files
m1x0naldas
authored andcommitted
Renaming according to echo conventions
1 parent 3cc8455 commit d0a6a6e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

jaegertracing/jaegertracing.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type (
6464
LimitSize int
6565

6666
// OperationNameFunc composes operation name based on context. Can be used to override default naming
67-
OperationNameFunc func(ctx echo.Context) string
67+
OperationNameFunc func(c echo.Context) string
6868
}
6969
)
7070

@@ -255,9 +255,9 @@ func generateToken() string {
255255
return fmt.Sprintf("%x", b)
256256
}
257257

258-
func defaultOperationName(ctx echo.Context) string {
259-
req := ctx.Request()
260-
return "HTTP " + req.Method + " URL: " + ctx.Path()
258+
func defaultOperationName(c echo.Context) string {
259+
req := c.Request()
260+
return "HTTP " + req.Method + " URL: " + c.Path()
261261
}
262262

263263
// TraceFunction wraps funtion with opentracing span adding tags for the function name and caller details

jaegertracing/jaegertracing_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,21 +354,21 @@ func TestTraceWithCustomOperationName(t *testing.T) {
354354
e.Use(TraceWithConfig(TraceConfig{
355355
Tracer: tracer,
356356
ComponentName: "EchoTracer",
357-
OperationNameFunc: func(ctx echo.Context) string {
357+
OperationNameFunc: func(c echo.Context) string {
358358
// This is an example of operation name customization
359359
// In most cases default formatting is more than enough
360-
req := ctx.Request()
360+
req := c.Request()
361361
opName := "HTTP " + req.Method
362362

363-
path := ctx.Path()
364-
paramNames := ctx.ParamNames()
363+
path := c.Path()
364+
paramNames := c.ParamNames()
365365

366366
for _, name := range paramNames {
367367
from := ":" + name
368368
to := "{" + name + "}"
369369
path = strings.ReplaceAll(path, from, to)
370370
}
371-
371+
372372
return opName + " " + path
373373
},
374374
}))

0 commit comments

Comments
 (0)