| Conditions | 3 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package tracerexporters |
||
| 12 | func NewOTLPGrpc(endpoint string, insecure bool) (trace.SpanExporter, error) { |
||
| 13 | var exporter trace.SpanExporter |
||
| 14 | var err error |
||
| 15 | |||
| 16 | opts := []otlptracegrpc.Option{ |
||
| 17 | otlptracegrpc.WithEndpoint(endpoint), |
||
| 18 | } |
||
| 19 | |||
| 20 | if insecure { |
||
| 21 | opts = append(opts, otlptracegrpc.WithInsecure()) |
||
| 22 | } else { |
||
| 23 | opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewClientTLSFromCert(nil, ""))) |
||
| 24 | } |
||
| 25 | |||
| 26 | exporter, err = otlptracegrpc.New(context.Background(), opts...) |
||
| 27 | if err != nil { |
||
| 28 | return nil, err |
||
| 29 | } |
||
| 30 | |||
| 31 | return exporter, nil |
||
| 32 | } |
||
| 33 |