AWS re:Invent happy hour: Dec 1, 6 PM PST at MGM Grand RSVP

Three colored streams of API requests converge into one timeline.

One Shopper, Three Session IDs


We needed a way to follow a shopper through checkout as their session ID changed from one service to the next. Take Alice. Her checkout has a user ID, the payment call carries a service token, and her browser comes back with a session cookie. Group the requests by those IDs and one shopper shows up three times.

We found a starting point in Splunk’s transaction command, which can group events through a chain of shared values. We built on that idea in proxymock and Speedscale with rules for recorded API traffic. A payment ID can link sessions after a later request sends it back. A tenant ID shared by too many sessions is ignored. That gives us one checkout journey while keeping unrelated shoppers apart.

🎯 Key Takeaways
  • Recorded requests can carry different session IDs even when they belong to one shopper.
  • Links can follow an identity, a trace ID or an ID created in a response and sent back in a later request.
  • A shared tenant ID joins nobody, and a lookup for two shoppers can stay unattributed.

Three session IDs in one checkout

The mock-lab storefront uses a small Go app and two stand-in services. Alice’s checkout arrives with a JWT whose uid is u-alice-1001, which becomes the checkout’s session key. The storefront calls the payment service with a different JWT. That call is keyed by the token itself, but its sub also says u-alice-1001. That shared identity connects the first two keys.

Later, Alice’s browser polls for the payment with a jsessionid cookie. The request path contains pay-faf46814, the ID returned by the payment service in this recording. That ID connects the browser’s key to the payment call. Follow both links and you get one actor with three keys.

What counts as evidence

EvidenceWhat to look for in the lab
Same identityAlice’s recorded checkout key matches the sub claim in the payment call’s JWT. A Basic auth username can also provide identity evidence.
Same traceCarol’s browser request and the storefront’s order lookup share a trace ID carried in a W3C traceparent header.
ID from an earlier responseThe payment service creates an ID, the storefront passes it back, and Alice’s browser sends it in a later request path. The proxymock row calls this link minted.

The proxymock Actors view shows three linked keys each for Alice and Bob and two for Carol.

The order ID that fooled the demo

Carol’s browser and the order service both saw a new order ID because the storefront relayed the order response. In my first run, the linker joined the two keys on that ID. The row showed a response field on both sides of the link. Nobody had sent the ID back in a request.

A catalog makes the problem easy to see. Two shoppers can get the same SKU in separate responses. Treat that as linking evidence and you can put both shoppers in the same journey.

The linker now requires a later request to send the value back. If several responses introduced that value, their request intervals must all overlap. That lets a gateway and its downstream service count as one creation when the gateway relays the response. The timestamp check disqualifies separate creations. A shared value still has to supply the link. Carol’s two keys now link by trace ID.

When requests stay separate

A value that appears under more than four session keys is treated as shared state. Everyone in the lab sends the same tenant ID, so that ID joins nobody. The actor size limit is one tenth of the recording’s session keys, rounded up, with a floor of 8 and a ceiling of 50. If a join would exceed the cap, the two actors stay separate and each is marked possibly the same as the other.

A request with no session ID can join an actor when its matching evidence points to exactly one actor. Alice’s receipt request carries her payment ID, so it appears in her journey. The support lookup carries both Alice’s and Bob’s payment IDs, so the lookup itself stays unattributed.

Alice's seven-request journey includes checkout, payment calls, the browser poll and the receipt.

The linker fingerprints the values it uses and records where they came from, such as jwt sub or response body paymentId. The original capture and the recorded session keys still exist. Filters, replay and load groups continue to use those keys.

Run the linked sessions lab

You need Git and proxymock v2.5.1436 or later, installed and initialized. The lab includes a synthetic recording. You only need Go if you plan to capture fresh traffic by following the lab README.

Each step has a command and an optional prompt for a coding assistant with terminal access. Use one path per step. If you use the prompts, paste them into the same conversation.

1. Check your version and get the lab

Run these commands from the directory where you want the checkout.

proxymock version --client -o pretty
git clone https://github.com/speedscale/mock-lab.git
cd mock-lab/labs/linked-sessions
AI coding assistant prompt for step 1
Check Git is available and run proxymock version --client -o pretty. This lab needs proxymock v2.5.1436 or later. If it is missing or too old, point me to https://docs.speedscale.com/proxymock/getting-started/installation/ and report the blocker. Clone https://github.com/speedscale/mock-lab.git into a fresh directory, or reuse my existing checkout if I give you its path. Enter mock-lab/labs/linked-sessions, confirm proxymock/recording contains the bundled request/response files, and give me the absolute lab path.

2. Open the recording and inspect the actors

From mock-lab/labs/linked-sessions, start the viewer.

proxymock web --in proxymock/recording

Open the local URL printed by the command and select Sessions. In Actors, Alice and Bob each have one LINKED row with three keys. Carol’s two keys link by trace. Dave has a single key and the support lookup stays in the unattributed row.

Select u-alice-1001. The journey has seven requests, including checkout, the call that creates the payment, the browser poll and the receipt. The row says +4 with no session. Hover over it to see the identity and payment ID evidence. If you add the actor to a load group, proxymock selects its three recorded keys.

AI coding assistant prompt for step 2
From the linked-sessions lab directory from step 1, start proxymock web --in proxymock/recording. Keep the process available while we inspect it. Open the local page if you have browser access, go to Sessions > Actors, and verify the three keys each for Alice and Bob, Carol's two trace-linked keys, Dave's single key and the unattributed row. Open u-alice-1001 and verify the identity and payment ID links, the four requests with no session and the seven-request timeline. If you have terminal access only, give me the local viewer URL privately and tell me what to click. Report any startup or browser blocker and what you verified.

In Speedscale, open an analyzed snapshot and select Traffic, then Sessions, to see the same grouping and its evidence. The linked sessions guide covers the matching rules, limits and differences between the two views.

Frequently asked questions

How do I link session IDs that change across services?

The Sessions views in proxymock and Speedscale can group different recorded session IDs into one actor. They look for a shared identity or trace ID, or an ID a response created and a later request sent back. The recorded session IDs stay the same.

How does session linking relate to Splunk's transaction command?

Both can follow transitive relationships across fields. If one pair of events shares an identity and another pair shares a payment ID, the middle event can connect them. proxymock applies rules for shared values, IDs from earlier responses and actor size before it makes those joins.

Why do two session IDs for the same person show up separately?

The requests may lack eligible linking evidence, the shared value may appear under more than four session keys, or the join may exceed the actor size limit. When the size limit blocks a join, the Sessions view marks the actors as possibly the same.

Stop writing API mocks by hand

proxymock records real traffic from your running app and replays it as mocks for HTTP, gRPC, Postgres, Kafka, and more. Install locally, activate once, and start recording.