Skip to content

Google Cloud logo

Observability with Google Cloud Trace

This guide shows you how to set up Google Cloud Trace to add observability to your agents. With observability enabled, you can track agent execution latency and view distributed traces in the Google Cloud Console.

Before starting this guide make sure to follow the Quickstart Guide to have your First Agent running on Idun Agent Platform.

Setting Up Observability

Step 1: Prepare Google Cloud Project

  1. Ensure you have a Google Cloud Project created.
  2. Enable the Cloud Trace API in your project.
  3. Ensure the environment where your agent is running has credentials with permissions to write traces (e.g., Cloud Trace Agent role).
    • If running on Google Cloud (Cloud Run, GKE, Compute Engine), the default service account usually works if scopes are set.
    • If running locally or elsewhere, ensure GOOGLE_APPLICATION_CREDENTIALS is set or default credentials are configured.

Step 2: Navigate to Observability Configuration

  1. On Idun Agent Platform main page, navigate to Observability
  2. Go to Add configuration
  3. Select GCP Trace
  4. Enter a Configuration Name (e.g., "GCP Trace Prod")
  5. Fill in the required details:
    • Project ID: Your Google Cloud Project ID (e.g., my-project-123)
    • Region: (Optional) Specific region if applicable
    • Trace Name: (Optional) Name for the trace session
    • Sampling Rate: A number between 0.0 and 1.0 (e.g., 1.0 for 100% sampling)
    • Flush Interval: Time in seconds to wait before sending traces (default 5)
    • Ignore URLs: (Optional) Paths to exclude from tracing
  6. Finnaly, click Create configuration

Add configuration

Step 3: Add GCP Trace observability to your agent

  1. Navigate to your agent you want to trace
  2. Click Edit Agent
  3. Click Next to go to the observability config
  4. Select GCP Trace in observability
  5. Click on the configuration you just created.
  6. Click Next
  7. Finnalize with Save changes

Finnaly, on your agent page, click đŸ”„Restart to reload the agent configuration.

Viewing Observability Data

Once your agent is running with observability enabled:

  1. Interact with your agent
  2. Go to the Google Cloud Console
  3. Navigate to Trace -> Trace List

You will see the traces generated by your agent's execution, allowing you to analyze latency and performance bottlenecks.

GCP Trace viewing




Best Practices

  • Adjust Sampling Rate: For high-traffic agents, lower the sampling rate to reduce costs and noise.
  • Use meaningful Trace Names: Helps in filtering traces in the GCP Console.

Troubleshooting

Traces not showing up?

  1. Check API: Is the Cloud Trace API enabled in your project?
  2. Check Permissions: Does the agent's service account have Cloud Trace Agent role?
  3. Wait for flush: Traces are sent in batches; wait a few seconds (based on flush interval) after execution.