Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
336 changes: 336 additions & 0 deletions src/firestore/src/generated/gapic/tracing.rs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/firestore/src/generated/gapic/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ impl std::fmt::Debug for Firestore {

impl Firestore {
pub async fn new(config: gaxi::options::ClientConfig) -> gax::client_builder::Result<Self> {
#[cfg(google_cloud_unstable_tracing)]
let inner = if gaxi::options::tracing_enabled(&config) {
gaxi::grpc::Client::new_with_instrumentation(
config,
DEFAULT_HOST,
&super::tracing::info::INSTRUMENTATION_CLIENT_INFO,
)
.await?
} else {
gaxi::grpc::Client::new(config, DEFAULT_HOST).await?
};
#[cfg(not(google_cloud_unstable_tracing))]
let inner = gaxi::grpc::Client::new(config, DEFAULT_HOST).await?;
Ok(Self { inner })
}
Expand Down
3 changes: 3 additions & 0 deletions src/generated/api/apikeys/v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ keywords.workspace = true
categories.workspace = true
rust-version.workspace = true

[lints]
workspace = true

[dependencies]
async-trait.workspace = true
bytes.workspace = true
Expand Down
273 changes: 273 additions & 0 deletions src/generated/api/apikeys/v2/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ impl<T> super::stub::ApiKeys for ApiKeys<T>
where
T: super::stub::ApiKeys + std::fmt::Debug + Send + Sync,
{
#[cfg(google_cloud_unstable_tracing)]
async fn create_key(
&self,
req: crate::model::CreateKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<longrunning::model::Operation>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::create_key"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"create_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.create_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn create_key(
&self,
Expand All @@ -45,7 +75,36 @@ where
) -> Result<gax::response::Response<longrunning::model::Operation>> {
self.inner.create_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn list_keys(
&self,
req: crate::model::ListKeysRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<crate::model::ListKeysResponse>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::list_keys"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"list_keys",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.list_keys(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn list_keys(
&self,
Expand All @@ -54,7 +113,31 @@ where
) -> Result<gax::response::Response<crate::model::ListKeysResponse>> {
self.inner.list_keys(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn get_key(
&self,
req: crate::model::GetKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<crate::model::Key>> {
use tracing::Instrument;
let span_name = concat!(env!("CARGO_PKG_NAME"), "::client::", "ApiKeys", "::get_key");
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"get_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.get_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn get_key(
&self,
Expand All @@ -63,7 +146,36 @@ where
) -> Result<gax::response::Response<crate::model::Key>> {
self.inner.get_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn get_key_string(
&self,
req: crate::model::GetKeyStringRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<crate::model::GetKeyStringResponse>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::get_key_string"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"get_key_string",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.get_key_string(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn get_key_string(
&self,
Expand All @@ -72,7 +184,36 @@ where
) -> Result<gax::response::Response<crate::model::GetKeyStringResponse>> {
self.inner.get_key_string(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn update_key(
&self,
req: crate::model::UpdateKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<longrunning::model::Operation>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::update_key"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"update_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.update_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn update_key(
&self,
Expand All @@ -81,7 +222,36 @@ where
) -> Result<gax::response::Response<longrunning::model::Operation>> {
self.inner.update_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn delete_key(
&self,
req: crate::model::DeleteKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<longrunning::model::Operation>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::delete_key"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"delete_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.delete_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn delete_key(
&self,
Expand All @@ -90,7 +260,36 @@ where
) -> Result<gax::response::Response<longrunning::model::Operation>> {
self.inner.delete_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn undelete_key(
&self,
req: crate::model::UndeleteKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<longrunning::model::Operation>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::undelete_key"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"undelete_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.undelete_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn undelete_key(
&self,
Expand All @@ -99,7 +298,36 @@ where
) -> Result<gax::response::Response<longrunning::model::Operation>> {
self.inner.undelete_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn lookup_key(
&self,
req: crate::model::LookupKeyRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<crate::model::LookupKeyResponse>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::lookup_key"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"lookup_key",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.lookup_key(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn lookup_key(
&self,
Expand All @@ -108,7 +336,36 @@ where
) -> Result<gax::response::Response<crate::model::LookupKeyResponse>> {
self.inner.lookup_key(req, options).await
}
#[cfg(google_cloud_unstable_tracing)]
async fn get_operation(
&self,
req: longrunning::model::GetOperationRequest,
options: gax::options::RequestOptions,
) -> Result<gax::response::Response<longrunning::model::Operation>> {
use tracing::Instrument;
let span_name = concat!(
env!("CARGO_PKG_NAME"),
"::client::",
"ApiKeys",
"::get_operation"
);
let client_request_span = gaxi::observability::create_client_request_span(
span_name,
"get_operation",
&info::INSTRUMENTATION_CLIENT_INFO,
);

let result = self
.inner
.get_operation(req, options)
.instrument(client_request_span.clone())
.await;

gaxi::observability::record_client_request_span(&result, &client_request_span);
result
}

#[cfg(not(google_cloud_unstable_tracing))]
#[tracing::instrument(ret)]
async fn get_operation(
&self,
Expand All @@ -132,3 +389,19 @@ where
self.inner.get_polling_backoff_policy(options)
}
}

#[cfg(google_cloud_unstable_tracing)]
pub(crate) mod info {
const NAME: &str = env!("CARGO_PKG_NAME");
const VERSION: &str = env!("CARGO_PKG_VERSION");
lazy_static::lazy_static! {
pub(crate) static ref INSTRUMENTATION_CLIENT_INFO: gaxi::options::InstrumentationClientInfo = {
let mut info = gaxi::options::InstrumentationClientInfo::default();
info.service_name = "apikeys";
info.client_version = VERSION;
info.client_artifact = NAME;
info.default_host = "apikeys";
info
};
}
}
Loading