pub struct TracesApi { /* private fields */ }Expand description
API client for Datadog APM/Traces endpoints.
Enables distributed tracing, service performance monitoring, and dependency mapping.
Implementations§
Source§impl TracesApi
impl TracesApi
Sourcepub const fn new(client: DatadogClient) -> Self
pub const fn new(client: DatadogClient) -> Self
Creates a new traces API client.
Sourcepub async fn send_traces(
&self,
traces: Vec<Vec<Span>>,
) -> Result<TraceSubmitResponse>
pub async fn send_traces( &self, traces: Vec<Vec<Span>>, ) -> Result<TraceSubmitResponse>
Submit traces to Datadog APM.
§Arguments
traces- Array of traces (each trace is an array of spans)
§Errors
Returns an error if the API request fails.
§Example
use datadog_api::{DatadogClient, DatadogConfig, models::Span};
use datadog_api::apis::TracesApi;
let config = DatadogConfig::from_env()?;
let client = DatadogClient::new(config)?;
let traces_api = TracesApi::new(client);
let span = Span {
span_id: 12345,
trace_id: 67890,
parent_id: 0,
service: "my-service".to_string(),
resource: "GET /api/users".to_string(),
name: "web.request".to_string(),
start: 1234567890000000000,
duration: 15000000,
error: 0,
meta: Default::default(),
metrics: Default::default(),
span_type: Some("web".to_string()),
};
traces_api.send_traces(vec![vec![span]]).await?;Sourcepub async fn search_traces(
&self,
query: &TraceQuery,
) -> Result<TraceSearchResponse>
pub async fn search_traces( &self, query: &TraceQuery, ) -> Result<TraceSearchResponse>
Sourcepub async fn get_service_stats(
&self,
service: &str,
start: i64,
end: i64,
) -> Result<ServiceStats>
pub async fn get_service_stats( &self, service: &str, start: i64, end: i64, ) -> Result<ServiceStats>
Sourcepub async fn get_service_dependencies(
&self,
service: &str,
start: i64,
end: i64,
) -> Result<ServiceDependencies>
pub async fn get_service_dependencies( &self, service: &str, start: i64, end: i64, ) -> Result<ServiceDependencies>
Auto Trait Implementations§
impl Freeze for TracesApi
impl !RefUnwindSafe for TracesApi
impl Send for TracesApi
impl Sync for TracesApi
impl Unpin for TracesApi
impl !UnwindSafe for TracesApi
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
Mutably borrows from an owned value. Read more