pub struct TraceService { /* private fields */ }Expand description
Implements a client for the Cloud Trace API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
async fn sample(
) -> anyhow::Result<()> {
let client = TraceService::builder().build().await?;
let mut list = client.list_traces()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}§Service Description
This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. Spans for a single trace may span multiple services.
§Configuration
To configure TraceService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://cloudtrace.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured with Private Google Access with VPC Service Controls) may want to override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
TraceService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap TraceService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl TraceService
impl TraceService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for TraceService.
let client = TraceService::builder().build().await?;Sourcepub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: TraceService + 'static,
pub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: TraceService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn list_traces(&self) -> ListTraces
pub fn list_traces(&self) -> ListTraces
Returns of a list of traces that match the specified filter conditions.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_trace_v1::Result;
async fn sample(
client: &TraceService
) -> Result<()> {
let mut list = client.list_traces()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_trace(&self) -> GetTrace
pub fn get_trace(&self) -> GetTrace
Gets a single trace by its ID.
§Example
use google_cloud_trace_v1::Result;
async fn sample(
client: &TraceService
) -> Result<()> {
let response = client.get_trace()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn patch_traces(&self) -> PatchTraces
pub fn patch_traces(&self) -> PatchTraces
Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.
§Example
use google_cloud_trace_v1::Result;
async fn sample(
client: &TraceService
) -> Result<()> {
client.patch_traces()
/* set fields */
.send().await?;
Ok(())
}Trait Implementations§
Source§impl Clone for TraceService
impl Clone for TraceService
Source§fn clone(&self) -> TraceService
fn clone(&self) -> TraceService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more