Skip to content

Conversation

@kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Oct 6, 2025

Summary

How did you test this change?

Are there any deployment considerations?


Note

Ensures supplied tags are included on exception events, span.RecordError calls, and log records.

  • Error handling:
    • Include provided tags on span.RecordError(..., trace.WithAttributes(tags...)) when no stack trace is present.
    • Refactor exception event attributes into exceptionAttributes and append provided tags before span.AddEvent.
  • Logging:
    • Add tags to log.Record via record.AddAttributes(tags...) before emitting.

Written by Cursor Bugbot for commit 5f3ec5c. This will update automatically on new commits. Configure here.

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

@kinyoklion kinyoklion marked this pull request as ready for review October 7, 2025 16:44
@kinyoklion kinyoklion requested a review from a team as a code owner October 7, 2025 16:44

// 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
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

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

Successfully merging this pull request may close these issues.

2 participants