Skip to content

Sticky session ID and balancer outcome not logged — makes debugging affinity routing impossible #178

Description

@sg-shag

Olla's sticky session balancer computes affinity keys and tracks outcomes (hit/miss/repin/disabled), but none of this information appears in request logs.

The X-Olla-Session-ID header is set by clients, used by ComputeStickyKey() to derive affinity keys, and echoed back in responses — but the actual session ID and sticky outcome are never logged.

Currently, handler_proxy.go logs at INFO and DEBUG levels, but neither includes:

  • session_id (the X-Olla-Session-ID value)
  • sticky_outcome (hit / miss / repin / disabled)
  • sticky_source (session_header / prefix_hash / auth_header / ip)

This makes it impossible to answer questions like:

  • Was this request routed by sticky session or full round-robin?
  • Is the sticky session cache filling up with dead keys?
  • Why did a request go to a different backend than expected?

Suggested fix:
Add session_id and sticky_outcome fields to the INFO-level log in logRequestStart() and logRequestResult(), and optionally include sticky_source in DEBUG logs. These fields should be read from the request context keys:

  • constants.ContextStickyKeyKey → session ID
  • constants.ContextStickyKeySourceKey → key source
  • constants.ContextStickyOutcomeKey → outcome (hit/miss/repin/disabled)

Example INFO log would gain:

"session_id": "a1b2c3d4e5f6...", "sticky_outcome": "hit", "sticky_source": "session_header"

Metadata

Metadata

Assignees

Labels

resolvedIssue is resolved and merged.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions