Skip to content

Commit

Permalink
[BREAKING CHANGE] Remove export_resource_labels flag from Zipkin ex…
Browse files Browse the repository at this point in the history
…porter (open-telemetry#1163)

Addresses open-telemetry#595

This flag was scheduled to be removed. Removing now.
  • Loading branch information
flands authored and wyTrivail committed Jul 13, 2020
1 parent cedc882 commit 5393f1a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
3 changes: 0 additions & 3 deletions exporter/zipkinexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ The following settings are required:

The following settings can be optionally configured:

- (temporary flag) `export_resource_labels` (default = true): Whether Resource labels are going to be merged with span attributes
Note: this flag was added to aid the migration to new (fixed and symmetric) behavior and is going to be
removed soon. See https://github.com/open-telemetry/opentelemetry-collector/issues/595 for more details
- `defaultservicename` (no default): What to name services missing this information

Example:
Expand Down
5 changes: 0 additions & 5 deletions exporter/zipkinexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,5 @@ type Config struct {
URL string `mapstructure:"url"`
Format string `mapstructure:"format"`

// Whether resource labels from TraceData are to be included in Span. True by default
// This is a temporary flag and will be removed soon,
// see https://go.opentelemetry.io/collector/issues/595
ExportResourceLabels *bool `mapstructure:"export_resource_labels"`

DefaultServiceName string `mapstructure:"default_service_name"`
}
1 change: 0 additions & 1 deletion exporter/zipkinexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func TestLoadConfig(t *testing.T) {
assert.Equal(t, "zipkin/2", e1.(*Config).Name())
assert.Equal(t, "https://somedest:1234/api/v2/spans", e1.(*Config).URL)
assert.Equal(t, "proto", e1.(*Config).Format)
assert.Equal(t, false, *e1.(*Config).ExportResourceLabels)
_, err = factory.CreateTraceExporter(zap.NewNop(), e1)
require.NoError(t, err)
}
1 change: 0 additions & 1 deletion exporter/zipkinexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ exporters:
url: "http://some.location.org:9411/api/v2/spans"
zipkin/2:
url: "https://somedest:1234/api/v2/spans"
export_resource_labels: false
format: proto
default_service_name: test_name

Expand Down
26 changes: 7 additions & 19 deletions exporter/zipkinexporter/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,16 @@ import (
type zipkinExporter struct {
defaultServiceName string

exportResourceLabels bool
url string
client *http.Client
serializer zipkinreporter.SpanSerializer
url string
client *http.Client
serializer zipkinreporter.SpanSerializer
}

// Default values for Zipkin endpoint.
const (
defaultTimeout = time.Second * 5

defaultServiceName string = "<missing service name>"

DefaultExportResourceLabels = true
)

// NewTraceExporter creates an zipkin trace exporter.
Expand All @@ -81,16 +78,10 @@ func createZipkinExporter(config configmodels.Exporter) (*zipkinExporter, error)
serviceName = zCfg.DefaultServiceName
}

exportResourceLabels := DefaultExportResourceLabels
if zCfg.ExportResourceLabels != nil {
exportResourceLabels = *zCfg.ExportResourceLabels
}

ze := &zipkinExporter{
defaultServiceName: serviceName,
exportResourceLabels: exportResourceLabels,
url: zCfg.URL,
client: &http.Client{Timeout: defaultTimeout},
defaultServiceName: serviceName,
url: zCfg.URL,
client: &http.Client{Timeout: defaultTimeout},
}

switch zCfg.Format {
Expand All @@ -108,10 +99,7 @@ func createZipkinExporter(config configmodels.Exporter) (*zipkinExporter, error)
func (ze *zipkinExporter) PushTraceData(_ context.Context, td consumerdata.TraceData) (int, error) {
tbatch := make([]*zipkinmodel.SpanModel, 0, len(td.Spans))

var resource *resourcepb.Resource
if ze.exportResourceLabels {
resource = td.Resource
}
var resource *resourcepb.Resource = td.Resource

for _, span := range td.Spans {
zs, err := zipkin.OCSpanProtoToZipkin(td.Node, resource, span, ze.defaultServiceName)
Expand Down

0 comments on commit 5393f1a

Please sign in to comment.