canonical: https://jentic.com/apis/googleapis.com/cloudtrace

# Google Cloud Trace API

Cloud Trace is Google Cloud's distributed tracing backend. The v2 API accepts trace spans from instrumented applications via a single batchWrite endpoint and exposes a span create endpoint, while collected traces are queryable through the Cloud Trace UI and the broader observability stack. App Engine applications send trace data automatically; other workloads push spans through this API or via OpenTelemetry exporters that hit the same endpoints.

## For AI agents

Submit distributed trace spans into Google Cloud Trace from any instrumented service. Lets agents push end-to-end latency data into Google's tracing backend for analysis alongside logs and metrics.

## Scope

Does not store logs or metrics, render dashboards, or query trace data - use for ingesting distributed trace spans into Google Cloud Trace only.

## Capabilities

- Batch-write trace spans for a completed request via traces:batchWrite
- Create individual spans with parent IDs, timestamps, and attributes
- Push OpenTelemetry spans through the official Cloud Trace exporter
- Send traces from non-App-Engine workloads such as Cloud Run and GKE
- Tag spans with build IDs and labels for regression analysis

## Use cases

### Distributed Tracing For Microservices

Instrument a multi-service application with OpenTelemetry and ship spans to Cloud Trace via the batchWrite endpoint. Each request shows up as an end-to-end trace with latency at every hop, letting platform teams find regressions across service boundaries that would be invisible in single-service profilers.

Example prompt: Batch-write 50 spans representing a single user request through three services to projects/acme via /v2/{name}/traces:batchWrite

### Latency Regression Detection

Continuously push trace data into Cloud Trace so the analysis tools can detect latency regressions for a specific RPC after a deploy. Because every span carries start and end timestamps and labels, regression queries can scope to the exact endpoint that changed and surface offending releases without manual log spelunking.

Example prompt: Push spans tagged with build_id=2026-06-10 so Cloud Trace's analysis can compare its p95 latency against the previous build

### Spans From Cloud Run And GKE Workloads

Send traces from Cloud Run, Cloud Functions, and GKE workloads that do not benefit from App Engine's automatic tracing. The v2 API takes batched spans with parent IDs, so workloads outside the App Engine runtime can participate in the same traces as the App Engine front end and downstream services.

Example prompt: From a Cloud Run service, batch-write three spans for /api/checkout, the downstream payment call, and the database write under one trace ID

### Agent-Submitted Trace Data

An AI agent that orchestrates downstream API calls can submit a trace to Cloud Trace describing each step of its workflow. Through Jentic the agent searches for 'send trace span', loads the spans.batchWrite schema, and pushes its own spans so engineers can see what the agent actually did and where it spent time.

Example prompt: Use Jentic to call traces.batchWrite under projects/acme with five spans representing the agent's plan, search, load, execute, and finalize steps

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v2/{+name}/traces:batchWrite | Batch-write multiple spans across one or more traces |
| POST | /v2/{+name} | Create a single span under a parent trace |

## Key resources

- **Traces** — Batch-write spans that belong to one or many traces under a project
- **Spans** — Create individual spans with parent IDs, timestamps, and attributes

## Why Jentic

- **Setup:** Wiring the Cloud Trace API by hand means setting up Google OAuth 2.0, minting short-lived tokens against the trace.append scope, and addressing each project by resource name against cloudtrace.googleapis.com yourself. Through Jentic you install once, import the Cloud Trace API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Cloud Trace puts the project resource name in the URL path (/v2/{+name}/traces:batchWrite), so a rule can pin your agent to one project: it can write trace spans there and nothing else. You choose the operations it may call, so only the span-write operations you allow are available to the agent.
- **Credential handling:** Your Cloud Trace OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'send a trace span to Cloud Trace', and Jentic returns the matching Cloud Trace operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Cloud Logging API** — Stores logs that often need to be correlated with trace spans for root-cause analysis
- **Cloud Monitoring API** — Stores metrics that complement trace data when investigating regressions
- **Compute Engine API** — Hosts the VM workloads whose application code emits Cloud Trace spans

## FAQ

### What authentication does the Cloud Trace API use?

It uses Google OAuth 2.0 with the https://www.googleapis.com/auth/trace.append scope for ingestion and https://www.googleapis.com/auth/cloud-platform for the broader read paths. Through Jentic the OAuth credentials are stored encrypted in your Jentic One instance and never reach the agent runtime.

### Can I push OpenTelemetry spans to Cloud Trace?

Yes. Use the official OpenTelemetry exporter for Cloud Trace, or send spans directly to /v2/{name}/traces:batchWrite. The endpoint accepts a list of spans with their parent IDs, start time, end time, and attributes.

### What are the rate limits for the Cloud Trace API?

Span ingestion is limited per project per minute and individual spans are capped in size. Batch your spans into the batchWrite endpoint instead of calling spans.create individually to stay well under the per-minute quota.

### How do I send a trace span through Jentic?

Search Jentic for 'send trace span', load the traces.batchWrite schema, and execute the call against /v2/{name}/traces:batchWrite with a list of spans. Jentic returns the schema so the agent does not need to read the Cloud Trace discovery doc.

### Is the Cloud Trace API free?

Cloud Trace gives a generous monthly free tier of trace spans per billing account and charges a small fee per million spans beyond that. The API itself has no per-call surcharge.

### Can I limit what my agent is allowed to do with the Cloud Trace API?

Yes. Because Cloud Trace carries the project resource name in the URL path (/v2/{+name}/traces:batchWrite), your self-hosted Jentic One instance lets you pin your agent to a single project so it can write trace spans there and nowhere else. You decide which operations are exposed, so you can allow only the batch span-write call and withhold the single-span create endpoint, or the reverse. The OAuth credential stays with the operator and is injected at execution time, so the agent can call exactly the span-ingestion operations your rules permit and nothing more.
