Skip to content

Commit 6d39947

Browse files
author
Paulo Janotti
committed
PR Feedback: add 1 test plus some comments
1 parent e1797e1 commit 6d39947

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

exporter/zipkinexporter/config.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ import (
2121
// Config defines configuration settings for the Zipkin exporter.
2222
type Config struct {
2323
configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
24-
Endpoint string `mapstructure:"endpoint"`
24+
25+
// Endpoint is the URL to send the Zipkin trace data to (e.g.:
26+
// http://some.url:9411/api/v2/spans).
27+
Endpoint string `mapstructure:"endpoint"`
2528
}

exporter/zipkinexporter/config_test.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/stretchr/testify/assert"
2222
"github.com/stretchr/testify/require"
23+
"go.uber.org/zap"
2324

2425
"github.com/open-telemetry/opentelemetry-service/config"
2526
)
@@ -42,5 +43,11 @@ func TestLoadConfig(t *testing.T) {
4243
// Endpoint doesn't have a default value so set it directly.
4344
defaultCfg := factory.CreateDefaultConfig().(*Config)
4445
defaultCfg.Endpoint = "http://some.location.org:9411/api/v2/spans"
45-
assert.Equal(t, e0, defaultCfg)
46+
assert.Equal(t, defaultCfg, e0)
47+
48+
e1 := cfg.Exporters["zipkin/2"]
49+
assert.Equal(t, "zipkin/2", e1.(*Config).Name())
50+
assert.Equal(t, "https://somedest:1234/api/v2/spans", e1.(*Config).Endpoint)
51+
_, _, err = factory.CreateTraceExporter(zap.NewNop(), e1)
52+
require.NoError(t, err)
4653
}

exporter/zipkinexporter/testdata/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exporters:
88
zipkin:
99
endpoint: "http://some.location.org:9411/api/v2/spans"
1010
zipkin/2:
11-
endpoint: "1.2.3.4:1234"
11+
endpoint: "https://somedest:1234/api/v2/spans"
1212

1313
pipelines:
1414
traces:

0 commit comments

Comments
 (0)