Skip to content

Look-to-Book (L2B) Tracking

Counts every AerTicket flight search (“look”) and every booked flight segment (“book”) to monitor compliance with the Look-to-Book ratio limit in the AerTicket consolidator contract.

  • Check whether flight-search volume is approaching the contractual L2B limit
  • Understand where the numbers on the L2B Monitor admin page come from
  • Wire a new booking-confirmation flow into segment counting
  • Look — one successful AerTicket search API call. AerticketSearchService calls L2bTrackingService::recordLook() after each search response is parsed and filtered (source: backend/app/Services/Flights/Aerticket/AerticketSearchService.php:105).
  • Book — a booked flight segment (a round trip counts as 2). L2bTrackingService::recordBooking(int $segments) increments the counter.
  • Counters live in a single row (id = 1) of the dynamic_flight_l2b_metrics table (L2bMetric model) together with last_look_at / last_booking_at timestamps. Increments are atomic single-query updates.

GDS/consolidator contracts cap how many searches a partner may run per booked segment. The AerTicket contract limit is 350:1 (L2bMonitoring::CONTRACT_LIMIT). Exceeding it risks contractual penalties, so the ratio is surfaced as a traffic light (TrafficLight enum):

Status Ratio
Green (Normal) below 250:1
Amber (Warning) 250:1 to below 320:1
Red (Critical) 320:1 and above

With zero bookings the ratio is N/A and the status reports Green.

L2bTrackingService exposes:

  • recordLook() / recordBooking(int $segments = 1) — increment counters
  • getMetrics() — looks, bookings, ratio, formatted ratio, traffic-light status
  • getStatus() / isWithinLimits()isWithinLimits() is true unless the status is Red
  • reset() — zero all counters (testing/manual reset only)

Source: backend/app/Services/L2bTrackingService.php, backend/app/Models/L2bMetric.php

L2bMonitoring (System → L2B Monitor, admin-only) shows the L2bStatsWidget: total looks, booked segments, current ratio vs the 350:1 limit, and the traffic-light status, polling every 30s. The same metrics also appear in the Dynamic Flight Cache stats widget.

Source: backend/app/Filament/Pages/L2bMonitoring.php, backend/app/Filament/Widgets/L2bStatsWidget.php

  • recordBooking() has no production caller yet. Only recordLook() is wired in (AerTicket searches); no booking-confirmation flow currently calls recordBooking(), so the bookings counter stays at 0 until one does. Any new flight-booking confirmation path must call it with the booked segment count.
  • Counters are cumulative since the last reset — there is no automatic periodic window.