Skip to content

Conversation

@adecaro
Copy link
Contributor

@adecaro adecaro commented Apr 16, 2025

jsonSession := session2.JSON(context)
msg, err := jsonSession.ReceiveRawWithTimeout(time.Minute * 4)
span := trace.SpanFromContext(context.Context())
span.AddEvent("start_receive_transaction_view")
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to use the method logger.DebugfContext

// New returns a JSON-based session wrapping the passed session.
func New(context context.Context, s Session) *JSession {
span := trace.SpanFromContext(context)
span.AddEvent(fmt.Sprintf("Open json session to [%s:%s]", string(s.Info().Caller), s.Info().CallerViewID))
Copy link
Contributor

Choose a reason for hiding this comment

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

logger

// New returns a JSON-based session wrapping the passed session.
func New(context context.Context, s Session) *JSession {
span := trace.SpanFromContext(context)
span.AddEvent(fmt.Sprintf("Open json session to [%s:%s]", string(s.Info().Caller), s.Info().CallerViewID))
Copy link
Contributor

Choose a reason for hiding this comment

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

s.Info() is an expensive call (it contains a lock). I would suggest you use it only once or even better you use the Eval util:

logger.DebugfContext(context, "Open json session: %s", logging.Eval(s.Info))

Copy link
Contributor

@alexandrosfilios alexandrosfilios left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments

@adecaro adecaro added this to the Q3 milestone Jul 27, 2025
@adecaro adecaro force-pushed the f-915-part2 branch 2 times, most recently from 08b5077 to 0528814 Compare July 27, 2025 04:50
clean jsession package
FSC b9bece2d0ce57e207809c748f19f431ef0457d62
remove the need to pass a timeout

Signed-off-by: Angelo De Caro <[email protected]>
@adecaro
Copy link
Contributor Author

adecaro commented Oct 24, 2025

this will be reworked in another PR

@adecaro adecaro closed this Oct 24, 2025
@adecaro adecaro deleted the f-915-part2 branch October 24, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants