Struct datadog_api_client::datadogV2::api::api_spans_metrics::SpansMetricsAPI
source · pub struct SpansMetricsAPI { /* private fields */ }Expand description
Manage configuration of span-based metrics for your organization. See Generate Metrics from Spans for more information.
Implementations§
source§impl SpansMetricsAPI
impl SpansMetricsAPI
pub fn new() -> Self
sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.get_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.delete_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
async fn main() {
let body = SpansMetricCreateRequest::new(SpansMetricCreateData::new(
SpansMetricCreateAttributes::new(
SpansMetricCompute::new(SpansMetricComputeAggregationType::DISTRIBUTION)
.include_percentiles(false)
.path("@duration".to_string()),
)
.filter(
SpansMetricFilter::new().query("@http.status_code:200 service:my-service".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
"ExampleSpansMetric".to_string(),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.create_spans_metric(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let body = SpansMetricUpdateRequest::new(SpansMetricUpdateData::new(
SpansMetricUpdateAttributes::new()
.compute(SpansMetricUpdateCompute::new().include_percentiles(false))
.filter(
SpansMetricFilter::new()
.query("@http.status_code:200 service:my-service-updated".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api
.update_spans_metric(spans_metric_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn create_spans_metric(
&self,
body: SpansMetricCreateRequest,
) -> Result<SpansMetricResponse, Error<CreateSpansMetricError>>
pub async fn create_spans_metric( &self, body: SpansMetricCreateRequest, ) -> Result<SpansMetricResponse, Error<CreateSpansMetricError>>
Create a metric based on your ingested spans in your organization. Returns the span-based metric object from the request body when the request is successful.
Examples found in repository?
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
async fn main() {
let body = SpansMetricCreateRequest::new(SpansMetricCreateData::new(
SpansMetricCreateAttributes::new(
SpansMetricCompute::new(SpansMetricComputeAggregationType::DISTRIBUTION)
.include_percentiles(false)
.path("@duration".to_string()),
)
.filter(
SpansMetricFilter::new().query("@http.status_code:200 service:my-service".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
"ExampleSpansMetric".to_string(),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.create_spans_metric(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn create_spans_metric_with_http_info(
&self,
body: SpansMetricCreateRequest,
) -> Result<ResponseContent<SpansMetricResponse>, Error<CreateSpansMetricError>>
pub async fn create_spans_metric_with_http_info( &self, body: SpansMetricCreateRequest, ) -> Result<ResponseContent<SpansMetricResponse>, Error<CreateSpansMetricError>>
Create a metric based on your ingested spans in your organization. Returns the span-based metric object from the request body when the request is successful.
sourcepub async fn delete_spans_metric(
&self,
metric_id: String,
) -> Result<(), Error<DeleteSpansMetricError>>
pub async fn delete_spans_metric( &self, metric_id: String, ) -> Result<(), Error<DeleteSpansMetricError>>
Delete a specific span-based metric from your organization.
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.delete_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn delete_spans_metric_with_http_info(
&self,
metric_id: String,
) -> Result<ResponseContent<()>, Error<DeleteSpansMetricError>>
pub async fn delete_spans_metric_with_http_info( &self, metric_id: String, ) -> Result<ResponseContent<()>, Error<DeleteSpansMetricError>>
Delete a specific span-based metric from your organization.
sourcepub async fn get_spans_metric(
&self,
metric_id: String,
) -> Result<SpansMetricResponse, Error<GetSpansMetricError>>
pub async fn get_spans_metric( &self, metric_id: String, ) -> Result<SpansMetricResponse, Error<GetSpansMetricError>>
Get a specific span-based metric from your organization.
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.get_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn get_spans_metric_with_http_info(
&self,
metric_id: String,
) -> Result<ResponseContent<SpansMetricResponse>, Error<GetSpansMetricError>>
pub async fn get_spans_metric_with_http_info( &self, metric_id: String, ) -> Result<ResponseContent<SpansMetricResponse>, Error<GetSpansMetricError>>
Get a specific span-based metric from your organization.
sourcepub async fn list_spans_metrics(
&self,
) -> Result<SpansMetricsResponse, Error<ListSpansMetricsError>>
pub async fn list_spans_metrics( &self, ) -> Result<SpansMetricsResponse, Error<ListSpansMetricsError>>
Get the list of configured span-based metrics with their definitions.
sourcepub async fn list_spans_metrics_with_http_info(
&self,
) -> Result<ResponseContent<SpansMetricsResponse>, Error<ListSpansMetricsError>>
pub async fn list_spans_metrics_with_http_info( &self, ) -> Result<ResponseContent<SpansMetricsResponse>, Error<ListSpansMetricsError>>
Get the list of configured span-based metrics with their definitions.
sourcepub async fn update_spans_metric(
&self,
metric_id: String,
body: SpansMetricUpdateRequest,
) -> Result<SpansMetricResponse, Error<UpdateSpansMetricError>>
pub async fn update_spans_metric( &self, metric_id: String, body: SpansMetricUpdateRequest, ) -> Result<SpansMetricResponse, Error<UpdateSpansMetricError>>
Update a specific span-based metric from your organization. Returns the span-based metric object from the request body when the request is successful.
Examples found in repository?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let body = SpansMetricUpdateRequest::new(SpansMetricUpdateData::new(
SpansMetricUpdateAttributes::new()
.compute(SpansMetricUpdateCompute::new().include_percentiles(false))
.filter(
SpansMetricFilter::new()
.query("@http.status_code:200 service:my-service-updated".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api
.update_spans_metric(spans_metric_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn update_spans_metric_with_http_info(
&self,
metric_id: String,
body: SpansMetricUpdateRequest,
) -> Result<ResponseContent<SpansMetricResponse>, Error<UpdateSpansMetricError>>
pub async fn update_spans_metric_with_http_info( &self, metric_id: String, body: SpansMetricUpdateRequest, ) -> Result<ResponseContent<SpansMetricResponse>, Error<UpdateSpansMetricError>>
Update a specific span-based metric from your organization. Returns the span-based metric object from the request body when the request is successful.
Trait Implementations§
source§impl Clone for SpansMetricsAPI
impl Clone for SpansMetricsAPI
source§fn clone(&self) -> SpansMetricsAPI
fn clone(&self) -> SpansMetricsAPI
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SpansMetricsAPI
impl Debug for SpansMetricsAPI
Auto Trait Implementations§
impl Freeze for SpansMetricsAPI
impl !RefUnwindSafe for SpansMetricsAPI
impl Send for SpansMetricsAPI
impl Sync for SpansMetricsAPI
impl Unpin for SpansMetricsAPI
impl !UnwindSafe for SpansMetricsAPI
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)