@@ -51,11 +51,32 @@ type Config struct {
5151	Ratio  float64  `yaml:"ratio" validate:"required,lte=1,gte=0"` 
5252}
5353
54+ func  (c  * Config ) String () string  {
55+ 	switch  c .Protocol  {
56+ 	case  "otlp_http" , "OTLP_HTTP" :
57+ 		return  fmt .Sprintf ("Sending spans via OTLP HTTP into %s with ratio %.0f%%..." ,
58+ 			c .OTLPEndpoint , 100 * c .Ratio )
59+ 	case  "udp" , "UDP" :
60+ 		return  fmt .Sprintf ("Sending spans over compact thrift protocol over udp into %s:%s with ratio %.0f%%..." ,
61+ 			c .Host , c .Port , 100 * c .Ratio )
62+ 	case  "http" , "HTTP" :
63+ 		return  fmt .Sprintf ("Sending spans over compact thrift protocol over http into %s with ratio %.0f%%..." ,
64+ 			c .Endpoint , 100 * c .Ratio )
65+ 	default :
66+ 		return  fmt .Sprintf ("Unknown protocol %s" , c .Protocol )
67+ 	}
68+ }
69+ 
5470// Start starts telemetry exporter 
5571func  Start (cfg  Config , extraAttributes  ... attribute.KeyValue ) (err  error ) {
72+ 	return  StartWithContext (context .Background (), cfg , extraAttributes ... )
73+ }
74+ 
75+ // StartWithContext starts telemetry exporter with context provided 
76+ func  StartWithContext (ctx  context.Context , cfg  Config , extraAttributes  ... attribute.KeyValue ) (err  error ) {
5677	switch  cfg .Protocol  {
5778	case  "otlp_http" , "OTLP_HTTP" :
58- 		return  ConfigureOTLPoverHTTP (context . Background () , OTLPoverHTTPConfig {
79+ 		return  ConfigureOTLPoverHTTP (ctx , OTLPoverHTTPConfig {
5980			Endpoint :    cfg .Endpoint ,
6081			Compression : true ,
6182			Ratio :       cfg .Ratio ,
0 commit comments