Access traces and spans in Trace Explorer

This document describes how to access and view traces and spans generated by your Gemini Enterprise app in the Trace Explorer. Traces and spans provide detailed insights into the performance and execution flow of requests within your application, such as when using the assistant or agents.

Key concepts

This section introduces key concepts related to observability in Gemini Enterprise.

Concept Description
Trace A trace is a collection of spans that represents a single request or transaction as it flows through different services and components.

For example, a trace represents the entire lifecycle of a request. This includes a user asking a question from the Gemini Enterprise assistant, the Gemini Enterprise assistant responding, and any subsequent actions triggered by the answer, such as sending an email.
Span A span is a single, timed unit of work within a trace. It represents a specific operation, such as a function call, an API request, or a database query. Each span includes details like its start and end times, a unique ID, and its relationship to other spans. These relationships together form a trace.
Span logs Span logs are timestamped, free-form messages or events associated with a specific span. They provide detailed, contextual information about a span's execution, helping users debug issues and understand the flow of a request.

Before you begin

Make sure you have the following:

  • The Discovery Engine Admin role.

  • An existing Gemini Enterprise web app. For information about creating a new app, see Create an app.

  • To access the Trace Explorer, you must have the Cloud Trace User role (roles/cloudtrace.user).

  • In your Gemini Enterprise app configurations, enable the Enable instrumentation of OpenTelemetry traces and logs observability setting. For more information, see Manage observability settings.

Access traces and spans

To access the traces and spans, follow these steps:

  1. In the Google Cloud console, go to the Trace Explorer page.

    Go to Trace Explorer

  2. Select the Google Cloud project where your Gemini Enterprise app was created. You see all the spans for your project.

  3. In the table, click a Span ID to view the trace details, including the span's duration and other attributes.

    Screenshot of the Trace Explorer in the Google Cloud console, showing a list of spans with columns for Span ID, Trace ID, Start time, Duration, and Service.