Skip to content

Commit 8342f30

Browse files
authored
[pkg/translator/zipkin] Unexport ToTranslator (open-telemetry#43852)
This is a breaking change of this package: this struct is not used directly anywhere in contrib, and therefore it would make sense to no longer expose it. I would like to hear back if anyone is using this directly as API.
1 parent fb9edee commit 8342f30

File tree

6 files changed

+37
-10
lines changed

6 files changed

+37
-10
lines changed

.chloggen/zipkin_pkg_api.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: pkg/translator/zipkin
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Unexport ToTranslator
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [43852]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

pkg/translator/zipkin/zipkinv2/from_translator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestInternalTracesToZipkinSpansAndBack(t *testing.T) {
135135
zipkinSpans, err := FromTranslator{}.FromTraces(td)
136136
assert.NoError(t, err)
137137
assert.Len(t, zipkinSpans, td.SpanCount())
138-
tdFromZS, zErr := ToTranslator{}.ToTraces(zipkinSpans)
138+
tdFromZS, zErr := toTranslator{}.ToTraces(zipkinSpans)
139139
assert.NoError(t, zErr, "%+v", zipkinSpans)
140140
assert.NotNil(t, tdFromZS)
141141
assert.Equal(t, td.SpanCount(), tdFromZS.SpanCount())

pkg/translator/zipkin/zipkinv2/json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
type jsonUnmarshaler struct {
15-
toTranslator ToTranslator
15+
toTranslator toTranslator
1616
}
1717

1818
// UnmarshalTraces from JSON bytes.
@@ -26,7 +26,7 @@ func (j jsonUnmarshaler) UnmarshalTraces(buf []byte) (ptrace.Traces, error) {
2626

2727
// NewJSONTracesUnmarshaler returns an unmarshaler for JSON bytes.
2828
func NewJSONTracesUnmarshaler(parseStringTags bool) ptrace.Unmarshaler {
29-
return jsonUnmarshaler{toTranslator: ToTranslator{ParseStringTags: parseStringTags}}
29+
return jsonUnmarshaler{toTranslator: toTranslator{ParseStringTags: parseStringTags}}
3030
}
3131

3232
// NewJSONTracesMarshaler returns a marshaler to JSON bytes.

pkg/translator/zipkin/zipkinv2/protobuf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type protobufUnmarshaler struct {
1313
// the "X-B3-Flags" header is set to 1 on the request.
1414
debugWasSet bool
1515

16-
toTranslator ToTranslator
16+
toTranslator toTranslator
1717
}
1818

1919
// UnmarshalTraces from protobuf bytes.
@@ -29,7 +29,7 @@ func (p protobufUnmarshaler) UnmarshalTraces(buf []byte) (ptrace.Traces, error)
2929
func NewProtobufTracesUnmarshaler(debugWasSet, parseStringTags bool) ptrace.Unmarshaler {
3030
return protobufUnmarshaler{
3131
debugWasSet: debugWasSet,
32-
toTranslator: ToTranslator{ParseStringTags: parseStringTags},
32+
toTranslator: toTranslator{ParseStringTags: parseStringTags},
3333
}
3434
}
3535

pkg/translator/zipkin/zipkinv2/to_translator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ import (
2727
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin/internal/zipkin"
2828
)
2929

30-
// ToTranslator converts from Zipkin data model to pdata.
31-
type ToTranslator struct {
30+
// toTranslator converts from Zipkin data model to pdata.
31+
type toTranslator struct {
3232
// ParseStringTags should be set to true if tags should be converted to numbers when possible.
3333
ParseStringTags bool
3434
}
3535

3636
// ToTraces translates Zipkin v2 spans into ptrace.Traces.
37-
func (t ToTranslator) ToTraces(zipkinSpans []*zipkinmodel.SpanModel) (ptrace.Traces, error) {
37+
func (t toTranslator) ToTraces(zipkinSpans []*zipkinmodel.SpanModel) (ptrace.Traces, error) {
3838
traceData := ptrace.NewTraces()
3939
if len(zipkinSpans) == 0 {
4040
return traceData, nil

pkg/translator/zipkin/zipkinv2/to_translator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func TestZipkinSpansToInternalTraces(t *testing.T) {
141141
}
142142
for _, test := range tests {
143143
t.Run(test.name, func(t *testing.T) {
144-
td, err := ToTranslator{}.ToTraces(test.zs)
144+
td, err := toTranslator{}.ToTraces(test.zs)
145145
assert.Equal(t, test.err, err)
146146
if test.name != "nilSpan" {
147147
assert.Equal(t, len(test.zs), td.SpanCount())
@@ -241,7 +241,7 @@ func TestV2SpanWithoutTimestampGetsTag(t *testing.T) {
241241
Tags: nil,
242242
}
243243

244-
gb, err := ToTranslator{}.ToTraces(spans)
244+
gb, err := toTranslator{}.ToTraces(spans)
245245
if err != nil {
246246
t.Errorf("Unexpected error: %v", err)
247247
return

0 commit comments

Comments
 (0)