Query aggregated long tasks
https://api.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.us3.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.us5.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.datadoghq.eu/api/v2/rum/query/insight/aggregated_long_taskshttps://api.ap1.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.ap2.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.uk1.datadoghq.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.ddog-gov.com/api/v2/rum/query/insight/aggregated_long_taskshttps://api.us2.ddog-gov.com/api/v2/rum/query/insight/aggregated_long_tasksOverview
Get aggregated long task data for a RUM view, grouped by invoker type and sampled across multiple view instances.
Request
Body Data (required)
data [required]Data envelope for an aggregated long tasks request.
attributes [required]Attributes for an aggregated long tasks query.
application_id [required]The RUM application ID to analyze.
criteriaPerformance criteria to filter view instances by a metric threshold.
maxMaximum threshold in seconds (inclusive).
metric [required]Performance metric used to filter view instances by threshold.
loading_time, largest_contentful_paint, first_contentful_paint, interaction_to_next_paintminMinimum threshold in seconds (inclusive).
filterRUM query string to filter events (for example, @session.type:user @geo.country:US).
from [required]Start of the time range as a Unix timestamp in seconds.
sample_size [required]Number of view instances to sample, between 1 and 500.
to [required]End of the time range as a Unix timestamp in seconds.
view_name [required]The RUM view name to analyze (for example, /account/login).
type [required]The JSON:API type for aggregated long tasks requests.
aggregated_long_tasks{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"criteria": {
"max": 5,
"metric": "largest_contentful_paint",
"min": 2.5
},
"filter": "@session.type:user",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}Response
Successful response
Response body for the aggregated long tasks endpoint.
data [required]Data envelope for an aggregated long tasks response.
attributes [required]Attributes of an aggregated long tasks response.
application_id [required]The RUM application ID that was analyzed.
criteria [required]Performance criteria used to filter view instances by a metric threshold, or null if no criteria were applied.
maxMaximum threshold in seconds (inclusive).
metric [required]Performance metric used to filter view instances by threshold.
loading_time, largest_contentful_paint, first_contentful_paint, interaction_to_next_paintminMinimum threshold in seconds (inclusive).
from [required]Start of the analyzed time range as a Unix timestamp in seconds.
long_tasks_by_invoker_type [required]Long task statistics grouped by invoker type, sorted by impact score descending.
criteria_view_occurrencesNumber of sampled views where this invoker type had long tasks contributing to the criteria metric.
impact_scoreRank-product impact score combining view frequency and blocking time severity.
invoker_type [required]Category of the long task invoker (for example, resolve-promise, user-callback).
stats_per_view [required]Statistical distributions of long task metrics computed per view across sampled views.
fcp_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
fcp_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
inp_overlap_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
inp_overlap_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
lcp_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
lcp_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
loading_time_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
loading_time_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
total_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
total_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
top_invokers [required]Top invokers within this invoker type, sorted by impact score descending.
criteria_view_occurrencesNumber of sampled views where this invoker had long tasks contributing to the criteria metric.
fileCleaned source file path for the invoker script.
impact_scoreRank-product impact score combining view frequency and blocking time severity.
invoker [required]Name of the invoker function or script.
stats_per_view [required]Statistical distributions of long task metrics computed per view across sampled views.
fcp_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
fcp_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
inp_overlap_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
inp_overlap_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
lcp_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
lcp_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
loading_time_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
loading_time_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
total_blocking_time_msStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
total_countStatistical distribution (average, min, max) of a long task metric across sampled views.
average [required]Average value across sampled views.
max [required]Maximum value across sampled views.
min [required]Minimum value across sampled views.
view_occurrences [required]Number of sampled views where this invoker had any long tasks.
view_occurrences [required]Number of sampled views where this invoker type had any long tasks.
sampled_view_ids [required]List of RUM view IDs sampled for this aggregation, capped at 50.
to [required]End of the analyzed time range as a Unix timestamp in seconds.
view_count [required]Number of view instances included in the analysis.
view_name [required]The RUM view name that was analyzed.
id [required]Hash-based unique identifier for this aggregation.
type [required]The JSON:API type for aggregated long tasks requests.
aggregated_long_tasks{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"criteria": {
"max": 5,
"metric": "largest_contentful_paint",
"min": 2.5
},
"from": 1762437564,
"long_tasks_by_invoker_type": [
{
"criteria_view_occurrences": 40,
"impact_score": 0.4,
"invoker_type": "resolve-promise",
"stats_per_view": {
"fcp_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"fcp_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"inp_overlap_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"inp_overlap_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"lcp_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"lcp_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"loading_time_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"loading_time_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"total_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"total_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
}
},
"top_invokers": [
{
"criteria_view_occurrences": 40,
"file": "src/pages/Gallery.tsx",
"impact_score": 0.67,
"invoker": "Response.json.then",
"stats_per_view": {
"fcp_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"fcp_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"inp_overlap_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"inp_overlap_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"lcp_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"lcp_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"loading_time_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"loading_time_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"total_blocking_time_ms": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
},
"total_count": {
"average": 3504.1,
"max": 3517.8,
"min": 3500.1
}
},
"view_occurrences": 68
}
],
"view_occurrences": 68
}
],
"sampled_view_ids": [
"6fbf69b6-9455-436a-b894-a6bf64126d40"
],
"to": 1762523964,
"view_count": 50,
"view_name": "/account/login(/:type)"
},
"id": "2f0b3455",
"type": "aggregated_long_tasks"
}
}Bad Request
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Unauthorized
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Code Example
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/rum/query/insight/aggregated_long_tasks" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"application_id": "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
"from": 1762437564,
"sample_size": 20,
"to": 1762523964,
"view_name": "/account/login(/:type)"
},
"type": "aggregated_long_tasks"
}
}
EOF// Query aggregated long tasks returns "Successful response" response
package main
import (
"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"
)
func main() {
body := datadogV2.AggregatedLongTasksRequest{
Data: datadogV2.AggregatedLongTasksRequestData{
Attributes: datadogV2.AggregatedLongTasksRequestAttributes{
ApplicationId: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
Criteria: &datadogV2.AggregatedWaterfallPerformanceCriteria{
Max: datadog.PtrFloat64(5.0),
Metric: datadogV2.AGGREGATEDWATERFALLPERFORMANCECRITERIAMETRIC_LARGEST_CONTENTFUL_PAINT,
Min: datadog.PtrFloat64(2.5),
},
Filter: datadog.PtrString("@session.type:user"),
From: 1762437564,
SampleSize: 20,
To: 1762523964,
ViewName: "/account/login(/:type)",
},
Type: datadogV2.AGGREGATEDLONGTASKSREQUESTTYPE_AGGREGATED_LONG_TASKS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.QueryAggregatedLongTasks", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewRUMInsightsApi(apiClient)
resp, r, err := api.QueryAggregatedLongTasks(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `RUMInsightsApi.QueryAggregatedLongTasks`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `RUMInsightsApi.QueryAggregatedLongTasks`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Query aggregated long tasks returns "Successful response" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.RumInsightsApi;
import com.datadog.api.client.v2.model.AggregatedLongTasksRequest;
import com.datadog.api.client.v2.model.AggregatedLongTasksRequestAttributes;
import com.datadog.api.client.v2.model.AggregatedLongTasksRequestData;
import com.datadog.api.client.v2.model.AggregatedLongTasksRequestType;
import com.datadog.api.client.v2.model.AggregatedLongTasksResponse;
import com.datadog.api.client.v2.model.AggregatedWaterfallPerformanceCriteria;
import com.datadog.api.client.v2.model.AggregatedWaterfallPerformanceCriteriaMetric;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.queryAggregatedLongTasks", true);
RumInsightsApi apiInstance = new RumInsightsApi(defaultClient);
AggregatedLongTasksRequest body =
new AggregatedLongTasksRequest()
.data(
new AggregatedLongTasksRequestData()
.attributes(
new AggregatedLongTasksRequestAttributes()
.applicationId("ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b")
.criteria(
new AggregatedWaterfallPerformanceCriteria()
.max(5.0)
.metric(
AggregatedWaterfallPerformanceCriteriaMetric
.LARGEST_CONTENTFUL_PAINT)
.min(2.5))
.filter("@session.type:user")
.from(1762437564L)
.sampleSize(20)
.to(1762523964L)
.viewName("/account/login(/:type)"))
.type(AggregatedLongTasksRequestType.AGGREGATED_LONG_TASKS));
try {
AggregatedLongTasksResponse result = apiInstance.queryAggregatedLongTasks(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RumInsightsApi#queryAggregatedLongTasks");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Query aggregated long tasks returns "Successful response" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_insights_api import RUMInsightsApi
from datadog_api_client.v2.model.aggregated_long_tasks_request import AggregatedLongTasksRequest
from datadog_api_client.v2.model.aggregated_long_tasks_request_attributes import AggregatedLongTasksRequestAttributes
from datadog_api_client.v2.model.aggregated_long_tasks_request_data import AggregatedLongTasksRequestData
from datadog_api_client.v2.model.aggregated_long_tasks_request_type import AggregatedLongTasksRequestType
from datadog_api_client.v2.model.aggregated_waterfall_performance_criteria import AggregatedWaterfallPerformanceCriteria
from datadog_api_client.v2.model.aggregated_waterfall_performance_criteria_metric import (
AggregatedWaterfallPerformanceCriteriaMetric,
)
body = AggregatedLongTasksRequest(
data=AggregatedLongTasksRequestData(
attributes=AggregatedLongTasksRequestAttributes(
application_id="ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
criteria=AggregatedWaterfallPerformanceCriteria(
max=5.0,
metric=AggregatedWaterfallPerformanceCriteriaMetric.LARGEST_CONTENTFUL_PAINT,
min=2.5,
),
filter="@session.type:user",
_from=1762437564,
sample_size=20,
to=1762523964,
view_name="/account/login(/:type)",
),
type=AggregatedLongTasksRequestType.AGGREGATED_LONG_TASKS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["query_aggregated_long_tasks"] = True
with ApiClient(configuration) as api_client:
api_instance = RUMInsightsApi(api_client)
response = api_instance.query_aggregated_long_tasks(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Query aggregated long tasks returns "Successful response" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.query_aggregated_long_tasks".to_sym] = true
end
api_instance = DatadogAPIClient::V2::RUMInsightsAPI.new
body = DatadogAPIClient::V2::AggregatedLongTasksRequest.new({
data: DatadogAPIClient::V2::AggregatedLongTasksRequestData.new({
attributes: DatadogAPIClient::V2::AggregatedLongTasksRequestAttributes.new({
application_id: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
criteria: DatadogAPIClient::V2::AggregatedWaterfallPerformanceCriteria.new({
max: 5.0,
metric: DatadogAPIClient::V2::AggregatedWaterfallPerformanceCriteriaMetric::LARGEST_CONTENTFUL_PAINT,
min: 2.5,
}),
filter: "@session.type:user",
from: 1762437564,
sample_size: 20,
to: 1762523964,
view_name: "/account/login(/:type)",
}),
type: DatadogAPIClient::V2::AggregatedLongTasksRequestType::AGGREGATED_LONG_TASKS,
}),
})
p api_instance.query_aggregated_long_tasks(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Query aggregated long tasks returns "Successful response" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_insights::RUMInsightsAPI;
use datadog_api_client::datadogV2::model::AggregatedLongTasksRequest;
use datadog_api_client::datadogV2::model::AggregatedLongTasksRequestAttributes;
use datadog_api_client::datadogV2::model::AggregatedLongTasksRequestData;
use datadog_api_client::datadogV2::model::AggregatedLongTasksRequestType;
use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteria;
use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteriaMetric;
#[tokio::main]
async fn main() {
let body = AggregatedLongTasksRequest::new(AggregatedLongTasksRequestData::new(
AggregatedLongTasksRequestAttributes::new(
"ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b".to_string(),
1762437564,
20,
1762523964,
"/account/login(/:type)".to_string(),
)
.criteria(
AggregatedWaterfallPerformanceCriteria::new(
AggregatedWaterfallPerformanceCriteriaMetric::LARGEST_CONTENTFUL_PAINT,
)
.max(5.0 as f64)
.min(2.5 as f64),
)
.filter("@session.type:user".to_string()),
AggregatedLongTasksRequestType::AGGREGATED_LONG_TASKS,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.query_aggregated_long_tasks", true);
let api = RUMInsightsAPI::with_config(configuration);
let resp = api.query_aggregated_long_tasks(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Query aggregated long tasks returns "Successful response" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.queryAggregatedLongTasks"] = true;
const apiInstance = new v2.RUMInsightsApi(configuration);
const params: v2.RUMInsightsApiQueryAggregatedLongTasksRequest = {
body: {
data: {
attributes: {
applicationId: "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b",
criteria: {
max: 5.0,
metric: "largest_contentful_paint",
min: 2.5,
},
filter: "@session.type:user",
from: 1762437564,
sampleSize: 20,
to: 1762523964,
viewName: "/account/login(/:type)",
},
type: "aggregated_long_tasks",
},
},
};
apiInstance
.queryAggregatedLongTasks(params)
.then((data: v2.AggregatedLongTasksResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"