|
| 1 | +// Query aggregated signals and problems returns "Successful response" response |
| 2 | +use datadog_api_client::datadog; |
| 3 | +use datadog_api_client::datadogV2::api_rum_insights::RUMInsightsAPI; |
| 4 | +use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequest; |
| 5 | +use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestAttributes; |
| 6 | +use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestData; |
| 7 | +use datadog_api_client::datadogV2::model::AggregatedSignalsProblemsRequestType; |
| 8 | +use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteria; |
| 9 | +use datadog_api_client::datadogV2::model::AggregatedWaterfallPerformanceCriteriaMetric; |
| 10 | + |
| 11 | +#[tokio::main] |
| 12 | +async fn main() { |
| 13 | + let body = AggregatedSignalsProblemsRequest::new(AggregatedSignalsProblemsRequestData::new( |
| 14 | + AggregatedSignalsProblemsRequestAttributes::new( |
| 15 | + "ccbc53b1-74f2-496b-bdd7-9a8fa7b7376b".to_string(), |
| 16 | + 1762437564, |
| 17 | + 30, |
| 18 | + 1762523964, |
| 19 | + "/account/login(/:type)".to_string(), |
| 20 | + ) |
| 21 | + .criteria( |
| 22 | + AggregatedWaterfallPerformanceCriteria::new( |
| 23 | + AggregatedWaterfallPerformanceCriteriaMetric::LARGEST_CONTENTFUL_PAINT, |
| 24 | + ) |
| 25 | + .max(5.0 as f64) |
| 26 | + .min(2.5 as f64), |
| 27 | + ) |
| 28 | + .detection_types(vec![ |
| 29 | + "high_script_evaluations".to_string(), |
| 30 | + "uncompressed_resources".to_string(), |
| 31 | + ]) |
| 32 | + .filter("@session.type:user".to_string()), |
| 33 | + AggregatedSignalsProblemsRequestType::AGGREGATED_SIGNALS_PROBLEMS, |
| 34 | + )); |
| 35 | + let mut configuration = datadog::Configuration::new(); |
| 36 | + configuration.set_unstable_operation_enabled("v2.QueryAggregatedSignalsProblems", true); |
| 37 | + let api = RUMInsightsAPI::with_config(configuration); |
| 38 | + let resp = api.query_aggregated_signals_problems(body).await; |
| 39 | + if let Ok(value) = resp { |
| 40 | + println!("{:#?}", value); |
| 41 | + } else { |
| 42 | + println!("{:#?}", resp.unwrap_err()); |
| 43 | + } |
| 44 | +} |
0 commit comments