github.com/wangyougui/gf/v2@v2.6.5/net/gtrace/gtrace_tracer.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/wangyougui/gf. 6 7 package gtrace 8 9 import ( 10 "go.opentelemetry.io/otel" 11 "go.opentelemetry.io/otel/trace" 12 ) 13 14 // Tracer warps trace.Tracer for compatibility and extension. 15 type Tracer struct { 16 trace.Tracer 17 } 18 19 // NewTracer Tracer is a short function for retrieving Tracer. 20 func NewTracer(name ...string) *Tracer { 21 tracerName := "" 22 if len(name) > 0 { 23 tracerName = name[0] 24 } 25 return &Tracer{ 26 Tracer: otel.Tracer(tracerName), 27 } 28 }