Retrieve a pruned, hierarchical view of an APM trace by its trace ID.
The trace is summarized as a tree of spans rooted at the trace root and reduced in size
to keep rendering large traces in the UI practical.
This endpoint is rate limited to 60 requests per minute per organization.
This endpoint requires the apm_read permission.
OAuth apps require the apm_read authorization scope to access this endpoint.
Arguments
Path Parameters
Name
Type
Description
trace_id [required]
string
The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace ID)
or a decimal string of up to 39 digits.
Query Strings
Name
Type
Description
expand_span_id
integer
Span ID to expand and preserve in the pruned tree even when its branch would
normally be summarized.
time_hint
integer
Optional Unix time hint, in seconds, used to optimize the lookup of the trace
in long-term storage.
force_source
string
Force the trace to be loaded from a specific source. When unset, the API picks
the source automatically.
include_path
array
Restrict the pruned tree to spans matching the given key:value pairs.
Values may be passed as repeated query parameters.
tag_include
array
Regex patterns of tag keys whose values must be included in the pruned spans.
Values may be passed as repeated query parameters.
tag_exclude
array
Regex patterns of tag keys whose values must be excluded from the pruned spans.
Values may be passed as repeated query parameters.
only_service_entry_spans
boolean
When set to true, only service entry spans are included in the pruned tree.
"""
Get a pruned trace by ID returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.apm_trace_apiimportAPMTraceApiconfiguration=Configuration()configuration.unstable_operations["get_pruned_trace_by_id"]=TruewithApiClient(configuration)asapi_client:api_instance=APMTraceApi(api_client)response=api_instance.get_pruned_trace_by_id(trace_id="trace_id",)print(response)
# Get a pruned trace by ID returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.unstable_operations["v2.get_pruned_trace_by_id".to_sym]=trueendapi_instance=DatadogAPIClient::V2::APMTraceAPI.newpapi_instance.get_pruned_trace_by_id("trace_id")
// Get a pruned trace by ID returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()configuration.SetUnstableOperationEnabled("v2.GetPrunedTraceByID",true)apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAPMTraceApi(apiClient)resp,r,err:=api.GetPrunedTraceByID(ctx,"trace_id",*datadogV2.NewGetPrunedTraceByIDOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `APMTraceApi.GetPrunedTraceByID`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `APMTraceApi.GetPrunedTraceByID`:\n%s\n",responseContent)}
// Get a pruned trace by ID returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ApmTraceApi;importcom.datadog.api.client.v2.model.PrunedTraceResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setUnstableOperationEnabled("v2.getPrunedTraceByID",true);ApmTraceApiapiInstance=newApmTraceApi(defaultClient);try{PrunedTraceResponseresult=apiInstance.getPrunedTraceByID("0000000000000000abc1230000000000");System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ApmTraceApi#getPrunedTraceByID");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get a pruned trace by ID returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_apm_trace::APMTraceAPI;usedatadog_api_client::datadogV2::api_apm_trace::GetPrunedTraceByIDOptionalParams;#[tokio::main]asyncfnmain(){letmutconfiguration=datadog::Configuration::new();configuration.set_unstable_operation_enabled("v2.GetPrunedTraceByID",true);letapi=APMTraceAPI::with_config(configuration);letresp=api.get_pruned_trace_by_id("trace_id".to_string(),GetPrunedTraceByIDOptionalParams::default(),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get a pruned trace by ID returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.getPrunedTraceByID"]=true;constapiInstance=newv2.APMTraceApi(configuration);constparams: v2.APMTraceApiGetPrunedTraceByIDRequest={traceId:"trace_id",};apiInstance.getPrunedTraceByID(params).then((data: v2.PrunedTraceResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));