• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pace / bricks / 12058212013

27 Nov 2024 08:45PM UTC coverage: 57.508% (+0.04%) from 57.466%
12058212013

Pull #387

github

monstermunchkin
pkg/context: Add deprecation notice
Pull Request #387: tracing: Fix bugs and clean up code

19 of 29 new or added lines in 7 files covered. (65.52%)

2 existing lines in 1 file now uncovered.

5519 of 9597 relevant lines covered (57.51%)

21.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/pkg/context/transfer.go
1
package context
2

3
import (
4
        "context"
5

6
        "github.com/getsentry/sentry-go"
7
        http "github.com/pace/bricks/http/middleware"
8
        "github.com/pace/bricks/http/oauth2"
9
        "github.com/pace/bricks/locale"
10
        "github.com/pace/bricks/maintenance/errors"
11
        "github.com/pace/bricks/maintenance/log"
12
        "github.com/pace/bricks/maintenance/log/hlog"
13
        "github.com/pace/bricks/pkg/redact"
14
        "github.com/pace/bricks/pkg/tracking/utm"
15
)
16

17
// Transfer takes the logger, log.Sink, authentication, request and
18
// error info from the given context and returns a complete
19
// new context with all these objects.
20
// Deprecated: Use context.WithoutCancel instead.
21
func Transfer(in context.Context) context.Context {
9✔
22
        // transfer logger, log.Sink, authentication and error info
9✔
23
        out := TransferTracingContext(in, context.Background())
9✔
24
        out = log.Ctx(in).WithContext(out)
9✔
25
        out = log.SinkContextTransfer(in, out)
9✔
26
        out = oauth2.ContextTransfer(in, out)
9✔
27
        out = errors.ContextTransfer(in, out)
9✔
28
        out = http.ContextTransfer(in, out)
9✔
29
        out = redact.ContextTransfer(in, out)
9✔
30
        out = utm.ContextTransfer(in, out)
9✔
31
        out = hlog.ContextTransfer(in, out)
9✔
32
        out = locale.ContextTransfer(in, out)
9✔
33
        out = TransferExternalDependencyContext(in, out)
9✔
34

9✔
35
        return out
9✔
36
}
9✔
37

38
func TransferTracingContext(in, out context.Context) context.Context {
9✔
39
        span := sentry.SpanFromContext(in)
9✔
40
        if span == nil {
18✔
41
                return out
9✔
42
        }
9✔
43

NEW
44
        return span.Context()
×
45
}
46

47
func TransferExternalDependencyContext(in, out context.Context) context.Context {
9✔
48
        edc := http.ExternalDependencyContextFromContext(in)
9✔
49
        if edc == nil {
18✔
50
                return out
9✔
51
        }
9✔
52
        return http.ContextWithExternalDependency(out, edc)
×
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc