Skip to content

Commit 9a63716

Browse files
authored
only set endpoint if url is not empty (#21)
1 parent 5f1b312 commit 9a63716

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

exporter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ func SetAddress(addr string) func(*Exporter) error {
8383
// Generally only used when create a new Exporter.
8484
func SetEndpoint(rawurl string) func(*Exporter) error {
8585
return func(e *Exporter) error {
86+
if rawurl == "" {
87+
return nil
88+
}
8689
u, err := url.Parse(rawurl)
8790
if err != nil {
8891
return errors.Wrap(err, "failed to parse url")
@@ -97,6 +100,9 @@ func SetEndpoint(rawurl string) func(*Exporter) error {
97100
// Generally only used when create a new Exporter.
98101
func SetFastcgi(rawurl string) func(*Exporter) error {
99102
return func(e *Exporter) error {
103+
if rawurl == "" {
104+
return nil
105+
}
100106
u, err := url.Parse(rawurl)
101107
if err != nil {
102108
return errors.Wrap(err, "failed to parse url")

0 commit comments

Comments
 (0)