Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trace] add strack trace info with trace #18

Closed
futurist opened this issue Apr 10, 2023 · 4 comments
Closed

[trace] add strack trace info with trace #18

futurist opened this issue Apr 10, 2023 · 4 comments
Assignees

Comments

@futurist
Copy link

Is your feature request related to a problem? Please describe.

Cannot find option for record stack trace of span:

https://pkg.go.dev/go.opentelemetry.io/otel/trace@v1.14.0#WithStackTrace

Describe the solution you'd like

Want same option for: https://pkg.go.dev/go.opentelemetry.io/otel/trace@v1.14.0#WithStackTrace

Additional context

Want show stacktrace info in APMPlus in VolcEngine(currently always empty):

image

@welkeyever
Copy link

PTAL🙏 @CoderPoet

@rogerogers
Copy link
Collaborator

Usually, you can use logs to report stack traces zap or logrus

code detail:

span.RecordError(errors.New(entry.Message), trace.WithStackTrace(h.cfg.recordStackTraceInSpan))

or report this by calling methods yourself. eg:

span := trace.SpanFromContext(c)
span.RecordError(errors.New("error info"), trace.WithStackTrace(true))

@rogerogers
Copy link
Collaborator

@futurist Hello, can this solve your problem?

@rogerogers rogerogers self-assigned this Apr 21, 2023
@futurist
Copy link
Author

@rogerogers Yes it's solved by add extra line of code, like below:

span := trace.SpanFromContext(c)
span.SetStatus(codes.Error, desc)
span.RecordError(errors.New("error info"), trace.WithStackTrace(true))

Without SetStatus the RecordError do nothing, Ref: https://opentelemetry.io/docs/instrumentation/go/manual/#record-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants