github.com/gogf/gf/v2@v2.7.4/net/gtrace/internal/provider/provider.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 provider
     8  
     9  import (
    10  	sdkTrace "go.opentelemetry.io/otel/sdk/trace"
    11  )
    12  
    13  type TracerProvider struct {
    14  	*sdkTrace.TracerProvider
    15  }
    16  
    17  // New returns a new and configured TracerProvider, which has no SpanProcessor.
    18  //
    19  // In default the returned TracerProvider is configured with:
    20  // - a ParentBased(AlwaysSample) Sampler;
    21  // - a unix nano timestamp and random umber based IDGenerator;
    22  // - the resource.Default() Resource;
    23  // - the default SpanLimits.
    24  //
    25  // The passed opts are used to override these default values and configure the
    26  // returned TracerProvider appropriately.
    27  func New() *TracerProvider {
    28  	return &TracerProvider{
    29  		TracerProvider: sdkTrace.NewTracerProvider(
    30  			sdkTrace.WithIDGenerator(NewIDGenerator()),
    31  		),
    32  	}
    33  }