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