Skip to content

Commit 53b84e7

Browse files
hannahkmkakkoyun
andauthored
chore: revert breaking error tracking changes (#4095)
Co-authored-by: kakkoyun <[email protected]> Co-authored-by: kemal.akkoyun <[email protected]>
1 parent 3e0f593 commit 53b84e7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

ddtrace/tracer/span.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ func (s *Span) setTagError(value interface{}, cfg errorConfig) {
454454
case error:
455455
// if anyone sets an error value as the tag, be nice here
456456
// and provide all the benefits.
457+
// TODO: once Error Tracking fix is resolved, update relevant tags here. See #4095
457458
setError(true)
458459
s.setMeta(ext.ErrorMsg, v.Error())
459460
s.setMeta(ext.ErrorType, reflect.TypeOf(v).String())
@@ -462,18 +463,18 @@ func (s *Span) setTagError(value interface{}, cfg errorConfig) {
462463
}
463464
switch err := v.(type) {
464465
case xerrors.Formatter:
465-
s.setMeta(ext.ErrorStack, fmt.Sprintf("%+v", v))
466+
s.setMeta(ext.ErrorDetails, fmt.Sprintf("%+v", v))
466467
case fmt.Formatter:
467468
// pkg/errors approach
468-
s.setMeta(ext.ErrorStack, fmt.Sprintf("%+v", v))
469+
s.setMeta(ext.ErrorDetails, fmt.Sprintf("%+v", v))
469470
case *errortrace.TracerError:
470471
// instrumentation/errortrace approach
471472
s.setMeta(ext.ErrorStack, fmt.Sprintf("%+v", v))
472473
s.setMeta(ext.ErrorHandlingStack, err.Format())
473474
return
474475
}
475476
stack := takeStacktrace(cfg.stackFrames, cfg.stackSkip)
476-
s.setMeta(ext.ErrorHandlingStack, stack)
477+
s.setMeta(ext.ErrorStack, stack)
477478
case nil:
478479
// no error
479480
setError(false)

ddtrace/tracer/span_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func TestSpanFinishWithError(t *testing.T) {
345345
assert.Equal(int32(1), span.error)
346346
errMsg, _ := getMeta(span, ext.ErrorMsg)
347347
errType, _ := getMeta(span, ext.ErrorType)
348-
errStack, _ := getMeta(span, ext.ErrorHandlingStack)
348+
errStack, _ := getMeta(span, ext.ErrorStack)
349349
assert.Equal("test error", errMsg)
350350
assert.Equal("*errors.errorString", errType)
351351
assert.NotEmpty(errStack)
@@ -360,7 +360,7 @@ func TestSpanFinishWithErrorNoDebugStack(t *testing.T) {
360360

361361
errMsg, _ := getMeta(span, ext.ErrorMsg)
362362
errType, _ := getMeta(span, ext.ErrorType)
363-
_, hasErrStack := getMeta(span, ext.ErrorHandlingStack)
363+
_, hasErrStack := getMeta(span, ext.ErrorStack)
364364
assert.Equal(int32(1), span.error)
365365
assert.Equal("test error", errMsg)
366366
assert.Equal("*errors.errorString", errType)
@@ -376,7 +376,7 @@ func TestSpanFinishWithErrorStackFrames(t *testing.T) {
376376

377377
errMsg, _ := getMeta(span, ext.ErrorMsg)
378378
errType, _ := getMeta(span, ext.ErrorType)
379-
errStack, _ := getMeta(span, ext.ErrorHandlingStack)
379+
errStack, _ := getMeta(span, ext.ErrorStack)
380380

381381
assert.Equal(int32(1), span.error)
382382
assert.Equal("test error", errMsg)
@@ -429,7 +429,7 @@ func TestSpanSetTag(t *testing.T) {
429429
assert.Equal(int32(1), span.error)
430430
assert.Equal("abc", span.meta[ext.ErrorMsg])
431431
assert.Equal("*errors.errorString", span.meta[ext.ErrorType])
432-
assert.NotEmpty(span.meta[ext.ErrorHandlingStack])
432+
assert.NotEmpty(span.meta[ext.ErrorStack])
433433

434434
span.SetTag(ext.Error, "something else")
435435
assert.Equal(int32(1), span.error)
@@ -539,7 +539,7 @@ func TestSpanSetTagError(t *testing.T) {
539539
t.Run("on", func(t *testing.T) {
540540
span := newBasicSpan("web.request")
541541
span.setTagError(errors.New("error value with trace"), errorConfig{noDebugStack: false})
542-
assert.NotEmpty(t, span.meta[ext.ErrorHandlingStack])
542+
assert.NotEmpty(t, span.meta[ext.ErrorStack])
543543
})
544544
}
545545

@@ -876,7 +876,7 @@ func TestErrorStack(t *testing.T) {
876876
assert.Equal("Something wrong", span.meta[ext.ErrorMsg])
877877
assert.Equal("*errors.errorString", span.meta[ext.ErrorType])
878878

879-
stack := span.meta[ext.ErrorHandlingStack]
879+
stack := span.meta[ext.ErrorStack]
880880
assert.NotEqual("", stack)
881881
assert.Contains(stack, "tracer.TestErrorStack")
882882
assert.NotContains(stack, "tracer.createTestError")
@@ -899,7 +899,7 @@ func TestSpanError(t *testing.T) {
899899
assert.Equal(int32(1), span.error)
900900
assert.Equal("Something wrong", span.meta[ext.ErrorMsg])
901901
assert.Equal("*errors.errorString", span.meta[ext.ErrorType])
902-
assert.NotEqual("", span.meta[ext.ErrorHandlingStack])
902+
assert.NotEqual("", span.meta[ext.ErrorStack])
903903
span.Finish()
904904

905905
// operating on a finished span is a no-op
@@ -932,7 +932,7 @@ func TestSpanError_Typed(t *testing.T) {
932932
assert.Equal(int32(1), span.error)
933933
assert.Equal("boom", span.meta[ext.ErrorMsg])
934934
assert.Equal("*tracer.boomError", span.meta[ext.ErrorType])
935-
assert.NotEqual("", span.meta[ext.ErrorHandlingStack])
935+
assert.NotEqual("", span.meta[ext.ErrorStack])
936936
}
937937

938938
func TestSpanErrorNil(t *testing.T) {

0 commit comments

Comments
 (0)