godo.Insights.GetTrace()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.Insights.GetTrace(ctx context.Context, region string, traceID string, opt *godo.TraceGetOptions) (*godo.Trace, *godo.Response, error)

Description

GetTrace retrieves a trace and its spans by trace ID. A trace is only resolvable in the region that ingested it, and only spans that started within the lookup window are returned. Trace.Truncated reports whether the trace has more spans than were returned.

This method sends a GET request to /v2/insights/query/{}/traces/{}.

Parameters

region string required
traceID string required
opt *godo.TraceGetOptions

Fields of godo.TraceGetOptions

TraceGetOptions narrows the lookup window for GetTrace. Both bounds accept the same relative and absolute formats as TracesTimeBound. The window defaults to the last seven days and must not exceed seven days.

From string
To string

Returns

*godo.Trace
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.Trace

Trace is a single trace and its spans, ordered by start time.

TraceID string

JSON key: trace_id

Spans []godo.TraceSpan

Omitted from JSON when empty. JSON key: spans

Truncated bool

Omitted from JSON when empty. JSON key: truncated

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.Insights.GetTrace(ctx, "<your-region>", "<your-trace-id>", &godo.TraceGetOptions{
		From: "<your-from>",
		To: "<your-to>",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

More Information

See GET /v2/insights/query/{}/traces/{} in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.