github.com/cs3org/reva/v2@v2.27.7/pkg/trace/options.go (about)

     1  package trace
     2  
     3  import "google.golang.org/grpc/credentials"
     4  
     5  // Options for trace
     6  type Options struct {
     7  	Enabled              bool
     8  	Insecure             bool
     9  	Exporter             string
    10  	Collector            string
    11  	Endpoint             string
    12  	ServiceName          string
    13  	TransportCredentials credentials.TransportCredentials
    14  }
    15  
    16  // Option for trace
    17  type Option func(o *Options)
    18  
    19  // WithEnabled option
    20  func WithEnabled() Option {
    21  	return func(o *Options) {
    22  		o.Enabled = true
    23  	}
    24  }
    25  
    26  // WithExporter option
    27  // Deprecated: unused
    28  func WithExporter(v string) Option {
    29  	return func(o *Options) {
    30  		o.Exporter = v
    31  	}
    32  }
    33  
    34  // WithInsecure option
    35  func WithInsecure() Option {
    36  	return func(o *Options) {
    37  		o.Insecure = true
    38  	}
    39  }
    40  
    41  // WithCollector option
    42  // Deprecated: unused
    43  func WithCollector(v string) Option {
    44  	return func(o *Options) {
    45  		o.Collector = v
    46  	}
    47  }
    48  
    49  // WithEndpoint option
    50  func WithEndpoint(v string) Option {
    51  	return func(o *Options) {
    52  		o.Endpoint = v
    53  	}
    54  }
    55  
    56  // WithServiceName option
    57  func WithServiceName(v string) Option {
    58  	return func(o *Options) {
    59  		o.ServiceName = v
    60  	}
    61  }
    62  
    63  // WithTransportCredentials option
    64  func WithTransportCredentials(v credentials.TransportCredentials) Option {
    65  	return func(o *Options) {
    66  		o.TransportCredentials = v
    67  	}
    68  }