github.com/craicoverflow/tyk@v2.9.6-rc3+incompatible/trace/jaeger/config.go (about)

     1  package jaeger
     2  
     3  import (
     4  	"github.com/uber/jaeger-client-go/config"
     5  	yaml "gopkg.in/yaml.v2"
     6  )
     7  
     8  // Load returns jaeger configuration from opts. Please see jaeger configuration
     9  // for details about the key value pairs
    10  //
    11  // https://github.com/jaegertracing/jaeger-client-go/blob/master/config/config.go#L37
    12  func Load(opts map[string]interface{}) (*config.Configuration, error) {
    13  	// The object opts is loaded from json. Instead of decoding every single value
    14  	// by had we marshal to then fro yaml.
    15  	//
    16  	// This is possible because the tags are the same for both json and yaml.
    17  	b, err := yaml.Marshal(opts)
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  	var c config.Configuration
    22  	err = yaml.Unmarshal(b, &c)
    23  	return &c, nil
    24  }