Skip to content

[BUG]: Error stacktrace and Exception type not being set properly #3424

@agentCalculator

Description

@agentCalculator

Tracer Version(s)

1.70.0

Go Version(s)

go1.22.0

Bug Report

Image
func recordErrorFromCtx(ctx context.Context, err error, markFailure bool, attrs ...attribute.KeyValue) {
	if err == nil {
		return
	}

	span := trace.SpanFromContext(ctx)

	if markFailure {
		span.SetStatus(codes.Error, err.Error())
	}

	span.RecordError(err, trace.WithStackTrace(true), trace.WithAttributes(attrs...))
}

But it is not adding any attributes to that span and neither am I getting proper stacktrace
And by seeing the stacktrace that I am getting it seems like the it is overwriting the actual stacktrace with the otel's internal middlewares and interceptors and I am getting the stacktrace of the last executed function for each and every error

Reproduction Code

No response

Error Logs

No response

Go Env Output

No response

Metadata

Metadata

Assignees

Labels

bugunintended behavior that has to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions