| Conditions | 4 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package logexporters |
||
| 11 | func NewOTLP(endpoint string, insecure bool, urlpath string, headers map[string]string) (*otlplogs.Exporter, error) { |
||
| 12 | options := []otlplogshttp.Option{ |
||
| 13 | otlplogshttp.WithCompression(otlplogshttp.GzipCompression), |
||
| 14 | otlplogshttp.WithEndpoint(endpoint), |
||
| 15 | } |
||
| 16 | |||
| 17 | if urlpath != "" { |
||
| 18 | options = append(options, otlplogshttp.WithURLPath(urlpath)) |
||
| 19 | } |
||
| 20 | |||
| 21 | if insecure { |
||
| 22 | options = append(options, otlplogshttp.WithInsecure()) |
||
| 23 | } |
||
| 24 | |||
| 25 | exporter, err := otlplogs.NewExporter(context.Background(), otlplogs.WithClient( |
||
| 26 | otlplogshttp.NewClient(options...), |
||
| 27 | )) |
||
| 28 | if err != nil { |
||
| 29 | return nil, err |
||
| 30 | } |
||
| 31 | |||
| 32 | return exporter, nil |
||
| 33 | } |
||
| 34 |