github.com/gogf/gf@v1.16.9/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/gogf/gf.
     6  
     7  package gtrace
     8  
     9  import (
    10  	"go.opentelemetry.io/otel"
    11  	"go.opentelemetry.io/otel/trace"
    12  )
    13  
    14  type Tracer struct {
    15  	trace.Tracer
    16  }
    17  
    18  // Tracer is a short function for retrieving Tracer.
    19  func NewTracer(name ...string) *Tracer {
    20  	tracerName := ""
    21  	if len(name) > 0 {
    22  		tracerName = name[0]
    23  	}
    24  	return &Tracer{
    25  		Tracer: otel.Tracer(tracerName),
    26  	}
    27  }