Skip to content

Commit b0591d0

Browse files
authored
Revert breaking change to Span.End() (#21252)
The method has been in GA since v1.2.0 so we can't change it.
1 parent e6de6ab commit b0591d0

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

sdk/azcore/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* Added function `SanitizePagerPollerPath` to the `server` package to centralize sanitization and formalize the contract.
88

99
### Breaking Changes
10+
> These changes affect only code written against beta versions `v1.7.0-beta.2` and `v1.8.0-beta.1`.
11+
* Removed parameter from method `Span.End()` and its type `tracing.SpanEndOptions`. This API GA'ed in `v1.2.0` so we cannot change it.
1012

1113
### Bugs Fixed
1214

sdk/azcore/runtime/policy_http_trace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (h *httpTracePolicy) Do(req *policy.Request) (resp *http.Response, err erro
7878
// so instead of attempting to sanitize the output, we simply output the error type.
7979
span.SetStatus(tracing.SpanStatusError, fmt.Sprintf("%T", err))
8080
}
81-
span.End(nil)
81+
span.End()
8282
}()
8383

8484
req = req.WithContext(ctx)
@@ -112,6 +112,6 @@ func StartSpan(ctx context.Context, name string, tracer tracing.Tracer, options
112112
errType := strings.Replace(fmt.Sprintf("%T", err), "*exported.", "*azcore.", 1)
113113
span.SetStatus(tracing.SpanStatusError, fmt.Sprintf("%s:\n%s", errType, err.Error()))
114114
}
115-
span.End(nil)
115+
span.End()
116116
}
117117
}

sdk/azcore/tracing/tracing.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ type Span struct {
149149

150150
// End terminates the span and MUST be called before the span leaves scope.
151151
// Any further updates to the span will be ignored after End is called.
152-
func (s Span) End(opts *SpanEndOptions) {
152+
func (s Span) End() {
153153
if s.impl.End != nil {
154154
s.impl.End()
155155
}
@@ -177,11 +177,6 @@ func (s Span) SetStatus(code SpanStatus, desc string) {
177177
}
178178
}
179179

180-
// SpanEndOptions contains the optional values for the Span.End() method.
181-
type SpanEndOptions struct {
182-
// for future expansion
183-
}
184-
185180
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
186181

187182
// Attribute is a key-value pair.

sdk/azcore/tracing/tracing_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestProviderZeroValues(t *testing.T) {
2323
require.Equal(t, context.Background(), ctx)
2424
require.Zero(t, sp)
2525
sp.AddEvent("event")
26-
sp.End(nil)
26+
sp.End()
2727
sp.SetAttributes(Attribute{})
2828
sp.SetStatus(SpanStatusError, "boom")
2929
spCtx := tr.SpanFromContext(ctx)
@@ -67,7 +67,7 @@ func TestProvider(t *testing.T) {
6767
require.NotZero(t, sp)
6868

6969
sp.AddEvent("event")
70-
sp.End(nil)
70+
sp.End()
7171
sp.SetAttributes()
7272
sp.SetStatus(SpanStatusError, "desc")
7373
require.True(t, addEventCalled)

0 commit comments

Comments
 (0)