Passed
Push — master ( 5fb140...f50c84 )
by Tolga
01:04 queued 13s
created

pkg/telemetry/logexporters/factory.go   A

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 12
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A logexporters.ExporterFactory 0 8 4
1
package logexporters
2
3
import (
4
	"fmt"
5
6
	"github.com/agoda-com/opentelemetry-logs-go/exporters/otlp/otlplogs"
7
)
8
9
// ExporterFactory - Create log exporter according to given params
10
func ExporterFactory(name, endpoint string, insecure bool, urlpath string, headers map[string]string) (*otlplogs.Exporter, error) {
11
	switch name {
12
	case "otlp", "otlp-http":
13
		return NewOTLP(endpoint, insecure, urlpath, headers)
14
	case "otlp-grpc":
15
		return nil, fmt.Errorf("%s log exporter is unsupported", name)
16
	default:
17
		return nil, fmt.Errorf("%s log exporter is unsupported", name)
18
	}
19
}
20