On-demand Rides and Deliveries Solution is currently available only to select partners.

Use Fleet Archive for Troubleshooting Trips and Vehicles

This tutorial walks you through the process of retrieving trip and vehicle fleet data.

Prerequisites

To complete this tutorial, you must have already:

Viewing historical trip logs

To view the responses made by Fleet Engine for a trip:

gRPC
Call the `CollectTripCalls()` method with the `CollectTripCallsRequest` request message.
REST
Call `https://fleetengine.googleapis.com/v1/archive/{trip=providers/*/trips/*}:collectTripCalls`

The following code example demonstrates how to retrieve Fleet Engine logs made for trip_a within a time range.

// This is the GCP Project Number.
private static final int PROJECT_NUMBER = 12345;
private static final Timestamp START_TIME = Timestamps.fromSeconds(1000);
private static final Timestamp END_TIME = Timestamps.fromSeconds(2000);
private static final String TRIP_ID = "providers/my_provider/trips/trip_a";

ArchiveServiceBlockingStub archiveService = ArchiveService.newBlockingStub(channel);

String pageToken = null;
do {
    CollectTripCallsRequest.Builder tripCallsRequest = CollectTripCallsRequest.newBuilder()
        .setProjectNumber(PROJECT_NUMBER)
        .setTrip(TRIP_ID)
        .setTimeWindow(TimeWindow.newBuilder().setStartTime(START_TIME).setEndTime(END_TIME))
        .setPageSize(2);

    if (pageToken != null) tripCallsRequest.setPageToken(pageToken);

    CollectTripCallsResponse tripCallsResponsePage = archiveService.collectTripCalls(tripCallsRequest);

    System.out.println(tripCallsResponsePage.toString());

    pageToken = tripCallsResponsePage.getPageToken();
} while (pageToken != null);

Viewing historical vehicle logs

You can view the responses made by the Fleet Engine for a vehicle via the CollectVehicleCalls endpoint:

gRPC
Call the `CollectVehicleCalls()` method with the `CollectVehicleCallsRequest` request message.
REST
Call `https://fleetengine.googleapis.com/v1/archive/{vehicle=providers/*/vehicles/*}:collectVehicleCalls`

The following code example demonstrates how to retrieve Fleet Engine logs made for vehicle_a within a time range.

// This is the GCP Project Number.
private static final int PROJECT_NUMBER = 12345;
private static final Timestamp START_TIME = Timestamps.fromSeconds(1000);
private static final Timestamp END_TIME = Timestamps.fromSeconds(2000);
private static final String VEHICLE_ID = "providers/my_provider/vehicles/vehicle_a";

ArchiveServiceBlockingStub archiveService = ArchiveService.newBlockingStub(channel);

String pageToken = null;
do {
    CollectVehicleCallsRequest.Builder vehicleCallsRequest = CollectVehicleCallsRequest.newBuilder()
        .setProjectNumber(PROJECT_NUMBER)
        .setVehicle(VEHICLE_ID)
        .setTimeWindow(TimeWindow.newBuilder().setStartTime(START_TIME).setEndTime(END_TIME))
        .setPageSize(2);

    if (pageToken != null) vehicleCallsRequest.setPageToken(pageToken);

    CollectVehicleCallsResponse vehicleCallsResponsePage = archiveService.collectVehicleCalls(vehicleCallsRequest);

    System.out.println(vehicleCallsResponsePage.toString());

    pageToken = vehicleCallsResponsePage.getPageToken();
} while (pageToken != null);