-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_test.go
More file actions
40 lines (29 loc) · 901 Bytes
/
example_test.go
File metadata and controls
40 lines (29 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package tracing_test
import (
"context"
"github.com/go-coldbrew/tracing"
)
func ExampleNewInternalSpan() {
ctx := context.Background()
// Create a span for internal business logic
span, ctx := tracing.NewInternalSpan(ctx, "processOrder")
defer span.End()
// Your logic here — the span tracks duration and errors
_ = ctx
}
func ExampleNewDatastoreSpan() {
ctx := context.Background()
// Create a span for a database operation
span, ctx := tracing.NewDatastoreSpan(ctx, "postgres", "SELECT", "users")
defer span.End()
// Run your query — the span records datastore, operation, and collection
_ = ctx
}
func ExampleNewExternalSpan() {
ctx := context.Background()
// Create a span for an external service call
span, ctx := tracing.NewExternalSpan(ctx, "payment-gateway", "/charge")
defer span.End()
// Make the external call — the span tracks the dependency
_ = ctx
}