Struct datadog_api_client::datadogV2::api::api_logs_metrics::LogsMetricsAPI
source · pub struct LogsMetricsAPI { /* private fields */ }Expand description
Manage configuration of log-based metrics for your organization.
Implementations§
source§impl LogsMetricsAPI
impl LogsMetricsAPI
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 "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.get_logs_metric(logs_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 "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.delete_logs_metric(logs_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
async fn main() {
let body = LogsMetricCreateRequest::new(LogsMetricCreateData::new(
LogsMetricCreateAttributes::new(
LogsMetricCompute::new(LogsMetricComputeAggregationType::DISTRIBUTION)
.include_percentiles(true)
.path("@duration".to_string()),
),
"ExampleLogsMetric".to_string(),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.create_logs_metric(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
async fn main() {
// there is a valid "logs_metric_percentile" in the system
let logs_metric_percentile_data_id = std::env::var("LOGS_METRIC_PERCENTILE_DATA_ID").unwrap();
let body = LogsMetricUpdateRequest::new(LogsMetricUpdateData::new(
LogsMetricUpdateAttributes::new()
.compute(LogsMetricUpdateCompute::new().include_percentiles(false)),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api
.update_logs_metric(logs_metric_percentile_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
async fn main() {
// there is a valid "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let body = LogsMetricUpdateRequest::new(LogsMetricUpdateData::new(
LogsMetricUpdateAttributes::new().filter(
LogsMetricFilter::new()
.query("service:web* AND @http.status_code:[200 TO 299]-updated".to_string()),
),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api
.update_logs_metric(logs_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_logs_metric(
&self,
body: LogsMetricCreateRequest,
) -> Result<LogsMetricResponse, Error<CreateLogsMetricError>>
pub async fn create_logs_metric( &self, body: LogsMetricCreateRequest, ) -> Result<LogsMetricResponse, Error<CreateLogsMetricError>>
Create a metric based on your ingested logs in your organization. Returns the log-based metric object from the request body when the request is successful.
Examples found in repository?
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
async fn main() {
let body = LogsMetricCreateRequest::new(LogsMetricCreateData::new(
LogsMetricCreateAttributes::new(
LogsMetricCompute::new(LogsMetricComputeAggregationType::DISTRIBUTION)
.include_percentiles(true)
.path("@duration".to_string()),
),
"ExampleLogsMetric".to_string(),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.create_logs_metric(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn create_logs_metric_with_http_info(
&self,
body: LogsMetricCreateRequest,
) -> Result<ResponseContent<LogsMetricResponse>, Error<CreateLogsMetricError>>
pub async fn create_logs_metric_with_http_info( &self, body: LogsMetricCreateRequest, ) -> Result<ResponseContent<LogsMetricResponse>, Error<CreateLogsMetricError>>
Create a metric based on your ingested logs in your organization. Returns the log-based metric object from the request body when the request is successful.
sourcepub async fn delete_logs_metric(
&self,
metric_id: String,
) -> Result<(), Error<DeleteLogsMetricError>>
pub async fn delete_logs_metric( &self, metric_id: String, ) -> Result<(), Error<DeleteLogsMetricError>>
Delete a specific log-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 "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.delete_logs_metric(logs_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn delete_logs_metric_with_http_info(
&self,
metric_id: String,
) -> Result<ResponseContent<()>, Error<DeleteLogsMetricError>>
pub async fn delete_logs_metric_with_http_info( &self, metric_id: String, ) -> Result<ResponseContent<()>, Error<DeleteLogsMetricError>>
Delete a specific log-based metric from your organization.
sourcepub async fn get_logs_metric(
&self,
metric_id: String,
) -> Result<LogsMetricResponse, Error<GetLogsMetricError>>
pub async fn get_logs_metric( &self, metric_id: String, ) -> Result<LogsMetricResponse, Error<GetLogsMetricError>>
Get a specific log-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 "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api.get_logs_metric(logs_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn get_logs_metric_with_http_info(
&self,
metric_id: String,
) -> Result<ResponseContent<LogsMetricResponse>, Error<GetLogsMetricError>>
pub async fn get_logs_metric_with_http_info( &self, metric_id: String, ) -> Result<ResponseContent<LogsMetricResponse>, Error<GetLogsMetricError>>
Get a specific log-based metric from your organization.
sourcepub async fn list_logs_metrics(
&self,
) -> Result<LogsMetricsResponse, Error<ListLogsMetricsError>>
pub async fn list_logs_metrics( &self, ) -> Result<LogsMetricsResponse, Error<ListLogsMetricsError>>
Get the list of configured log-based metrics with their definitions.
sourcepub async fn list_logs_metrics_with_http_info(
&self,
) -> Result<ResponseContent<LogsMetricsResponse>, Error<ListLogsMetricsError>>
pub async fn list_logs_metrics_with_http_info( &self, ) -> Result<ResponseContent<LogsMetricsResponse>, Error<ListLogsMetricsError>>
Get the list of configured log-based metrics with their definitions.
sourcepub async fn update_logs_metric(
&self,
metric_id: String,
body: LogsMetricUpdateRequest,
) -> Result<LogsMetricResponse, Error<UpdateLogsMetricError>>
pub async fn update_logs_metric( &self, metric_id: String, body: LogsMetricUpdateRequest, ) -> Result<LogsMetricResponse, Error<UpdateLogsMetricError>>
Update a specific log-based metric from your organization. Returns the log-based metric object from the request body when the request is successful.
Examples found in repository?
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
async fn main() {
// there is a valid "logs_metric_percentile" in the system
let logs_metric_percentile_data_id = std::env::var("LOGS_METRIC_PERCENTILE_DATA_ID").unwrap();
let body = LogsMetricUpdateRequest::new(LogsMetricUpdateData::new(
LogsMetricUpdateAttributes::new()
.compute(LogsMetricUpdateCompute::new().include_percentiles(false)),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api
.update_logs_metric(logs_metric_percentile_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}More examples
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
async fn main() {
// there is a valid "logs_metric" in the system
let logs_metric_data_id = std::env::var("LOGS_METRIC_DATA_ID").unwrap();
let body = LogsMetricUpdateRequest::new(LogsMetricUpdateData::new(
LogsMetricUpdateAttributes::new().filter(
LogsMetricFilter::new()
.query("service:web* AND @http.status_code:[200 TO 299]-updated".to_string()),
),
LogsMetricType::LOGS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = LogsMetricsAPI::with_config(configuration);
let resp = api
.update_logs_metric(logs_metric_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub async fn update_logs_metric_with_http_info(
&self,
metric_id: String,
body: LogsMetricUpdateRequest,
) -> Result<ResponseContent<LogsMetricResponse>, Error<UpdateLogsMetricError>>
pub async fn update_logs_metric_with_http_info( &self, metric_id: String, body: LogsMetricUpdateRequest, ) -> Result<ResponseContent<LogsMetricResponse>, Error<UpdateLogsMetricError>>
Update a specific log-based metric from your organization. Returns the log-based metric object from the request body when the request is successful.
Trait Implementations§
source§impl Clone for LogsMetricsAPI
impl Clone for LogsMetricsAPI
source§fn clone(&self) -> LogsMetricsAPI
fn clone(&self) -> LogsMetricsAPI
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for LogsMetricsAPI
impl Debug for LogsMetricsAPI
Auto Trait Implementations§
impl Freeze for LogsMetricsAPI
impl !RefUnwindSafe for LogsMetricsAPI
impl Send for LogsMetricsAPI
impl Sync for LogsMetricsAPI
impl Unpin for LogsMetricsAPI
impl !UnwindSafe for LogsMetricsAPI
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)