-
Couldn't load subscription status.
- Fork 2
fix: Ensure additional attributes are included in all cases. #264
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,20 +62,21 @@ func recordSpanError(span trace.Span, err error, tags ...attribute.KeyValue) { | |
|
|
||
| if stackErr, ok := err.(withStackTrace); ok { | ||
| stackTrace := fmt.Sprintf("%+v", stackErr.StackTrace()) | ||
| attributes := []attribute.KeyValue{ | ||
| exceptionAttributes := []attribute.KeyValue{ | ||
| semconv.ExceptionTypeKey.String(reflect.TypeOf(err).String()), | ||
| semconv.ExceptionMessageKey.String(err.Error()), | ||
| semconv.ExceptionStacktraceKey.String(stackTrace), | ||
| } | ||
| attributes = append(attributes, tags...) | ||
| span.AddEvent(semconv.ExceptionEventName, trace.WithAttributes(attributes...)) | ||
| exceptionAttributes = append(exceptionAttributes, tags...) | ||
| span.AddEvent(semconv.ExceptionEventName, trace.WithAttributes(exceptionAttributes...)) | ||
| } else { | ||
| span.RecordError(err, trace.WithStackTrace(true)) | ||
| span.RecordError(err, trace.WithStackTrace(true), trace.WithAttributes(tags...)) | ||
| } | ||
| } | ||
|
|
||
| // RecordLog is used to record arbitrary logs in your golang backend. | ||
| func RecordLog(ctx context.Context, record log.Record, tags ...log.KeyValue) error { | ||
| record.AddAttributes(tags...) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theoretically these could already be in the record instead. How would we feel about removing tags from the parameters and just requiring they be in the record? It would be a breaking change, but we have not gone 1.0 and it would be minor to adjust for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds like a good change to me. IIRC the public |
||
| o.GetLogger().Emit(ctx, record) | ||
| return nil | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attributes were not forwarded here.