sessionid

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Session ID Producer Plugin

Type: session-id-producer

Extracts a session identifier from each inference request and publishes it as the SessionID attribute on the InferenceRequest attribute store. Affinity-aware scorers and filters consume this attribute via session.ReadSessionID(request) without needing to know whether the session was carried in a header or a cookie.

The producer is a no-op when the configured source is absent or empty; consumers must treat the missing attribute as "no session preference".

Parameters

Exactly one of the following must be set:

  • headerName: name of the request header whose value is the session identifier. Comparison is case-insensitive (header names in the request are lowercased).
  • cookieName: name of the cookie within the standard Cookie request header whose value is the session identifier.

Examples

plugins:
  - type: session-id-producer
    parameters:
      headerName: x-session-id
plugins:
  - type: session-id-producer
    parameters:
      cookieName: llm-d-session

Documentation

Overview

Package sessionid provides a DataProducer that extracts a session identifier from a configured request header or named cookie and publishes it as a SessionID attribute on the InferenceRequest attribute store, so that affinity-aware scorers and filters can read it without knowing how the session was carried on the wire.

Index

Constants

View Source
const SessionIDProducerType = sessionidconstants.SessionIDProducerType

SessionIDProducerType is the plugin type registered with the framework.

Variables

This section is empty.

Functions

func Factory

func Factory(name string, rawParameters *json.Decoder, _ fwkplugin.Handle) (fwkplugin.Plugin, error)

Factory builds a Producer from raw plugin parameters.

Types

type Parameters

type Parameters struct {
	HeaderName string `json:"headerName"`
	CookieName string `json:"cookieName"`
}

Parameters configures the session-id producer.

Exactly one of HeaderName or CookieName must be set:

  • HeaderName: read the value of the named request header verbatim.
  • CookieName: parse the standard "cookie" request header and read the value of the named cookie.

type Producer

type Producer struct {
	// contains filtered or unexported fields
}

Producer extracts a session identifier from each incoming request and publishes it as an endpoint attribute.

func (*Producer) Produce

func (p *Producer) Produce(_ context.Context, request *fwksched.InferenceRequest, _ []fwksched.Endpoint) error

Produce extracts the session identifier from the request and writes it to the request's attribute store. When no identifier can be found the producer is a no-op; consumers must handle absence as "no session preference".

func (*Producer) Produces

func (p *Producer) Produces() map[fwkplugin.DataKey]any

Produces declares the SessionID attribute key written by this producer.

func (*Producer) TypedName

func (p *Producer) TypedName() fwkplugin.TypedName

TypedName returns the type and name of the plugin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL