Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions go/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...))
Copy link
Member Author

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.

}
}

// 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...)
Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like a good change to me. IIRC the public RecordLog api is a relatively new addition

o.GetLogger().Emit(ctx, record)
return nil
}
Expand Down
Loading