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.
When to Use
Section titled “When to Use”- 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
How It Works
Section titled “How It Works”- Look — one successful AerTicket search API call.
AerticketSearchServicecallsL2bTrackingService::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 thedynamic_flight_l2b_metricstable (L2bMetricmodel) together withlast_look_at/last_booking_attimestamps. Increments are atomic single-query updates.
Why the Ratio Matters
Section titled “Why the Ratio Matters”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.
Service API
Section titled “Service API”L2bTrackingService exposes:
recordLook()/recordBooking(int $segments = 1)— increment countersgetMetrics()— looks, bookings, ratio, formatted ratio, traffic-light statusgetStatus()/isWithinLimits()—isWithinLimits()is true unless the status is Redreset()— zero all counters (testing/manual reset only)
Source: backend/app/Services/L2bTrackingService.php, backend/app/Models/L2bMetric.php
Monitoring Page
Section titled “Monitoring Page”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
Gotchas
Section titled “Gotchas”recordBooking()has no production caller yet. OnlyrecordLook()is wired in (AerTicket searches); no booking-confirmation flow currently callsrecordBooking(), 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.
Related
Section titled “Related”- AerTicket Service
- Dynamic Flight Cache
- Source:
backend/app/Enums/TrafficLight.php