Skip to content

Commit a56bb53

Browse files
committed
feat(sidekick/rust): remove google_cloud_unstable_tracing guards
1 parent d7ea2ac commit a56bb53

3 files changed

Lines changed: 3 additions & 13 deletions

File tree

internal/sidekick/rust/templates/crate/src/tracing.rs.mustache

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub struct {{Codec.Name}}<T>
3434
where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
3535
inner: T,
3636
{{#Codec.DetailedTracingAttributes}}
37-
#[cfg(google_cloud_unstable_tracing)]
3837
{{! Use a fully qualified name to avoid conflicts with any client called `DurationMetric` }}
3938
duration: gaxi::observability::DurationMetric,
4039
{{/Codec.DetailedTracingAttributes}}
@@ -49,7 +48,6 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
4948
Self {
5049
inner,
5150
{{#Codec.DetailedTracingAttributes}}
52-
#[cfg(google_cloud_unstable_tracing)]
5351
duration: gaxi::observability::DurationMetric::new(
5452
&info::INSTRUMENTATION_CLIENT_INFO,
5553
),
@@ -77,7 +75,6 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
7775
options: crate::RequestOptions,
7876
) -> Result<crate::Response<{{Codec.ReturnType}}>> {
7977
{{#Codec.DetailedTracingAttributes}}
80-
#[cfg(google_cloud_unstable_tracing)]
8178
{
8279
let (_span, pending) = gaxi::client_request_signals!(
8380
metric: self.duration.clone(),
@@ -86,9 +83,10 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
8683
self.inner.{{Codec.Name}}(req, options));
8784
pending.await
8885
}
89-
#[cfg(not(google_cloud_unstable_tracing))]
90-
{{/Codec.DetailedTracingAttributes }}
86+
{{/Codec.DetailedTracingAttributes}}
87+
{{^Codec.DetailedTracingAttributes}}
9188
self.inner.{{Codec.Name}}(req, options).await
89+
{{/Codec.DetailedTracingAttributes}}
9290
}
9391
{{/Codec.Methods}}
9492
{{#Codec.HasLROs}}
@@ -112,7 +110,6 @@ where T: super::stub::{{Codec.Name}} + std::fmt::Debug + Send + Sync {
112110
{{/Codec.Services}}
113111
{{#Codec.HasServices}}
114112
{{#Codec.DetailedTracingAttributes}}
115-
#[cfg(google_cloud_unstable_tracing)]
116113
pub(crate) mod info {
117114
const NAME: &str = env!("CARGO_PKG_NAME");
118115
const VERSION: &str = env!("CARGO_PKG_VERSION");

internal/sidekick/rust/templates/crate/src/transport.rs.mustache

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ impl std::fmt::Debug for {{Codec.Name}} {
5454
impl {{Codec.Name}} {
5555
pub async fn new(config: gaxi::options::ClientConfig) -> crate::ClientBuilderResult<Self> {
5656
{{#Codec.DetailedTracingAttributes}}
57-
#[cfg(google_cloud_unstable_tracing)]
5857
let tracing_is_enabled = gaxi::options::tracing_enabled(&config);
5958
let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
60-
#[cfg(google_cloud_unstable_tracing)]
6159
let inner = if tracing_is_enabled {
6260
inner.with_instrumentation(&super::tracing::info::INSTRUMENTATION_CLIENT_INFO)
6361
} else {
@@ -201,7 +199,6 @@ impl super::stub::{{Codec.Name}} for {{Codec.Name}} {
201199
google_cloud_gax::error::Error::binding(BindingError { paths })
202200
})??;
203201
{{#Codec.DetailedTracingAttributes}}
204-
#[cfg(google_cloud_unstable_tracing)]
205202
if let Some(recorder) = gaxi::observability::RequestRecorder::current() {
206203
recorder.on_client_request(
207204
gaxi::observability::ClientRequestAttributes::default()

internal/sidekick/rust/templates/grpc-client/transport.rs.mustache

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,11 @@ impl std::fmt::Debug for {{Codec.Name}} {
8484
impl {{Codec.Name}} {
8585
pub async fn new(config: gaxi::options::ClientConfig) -> crate::ClientBuilderResult<Self> {
8686
{{#Codec.DetailedTracingAttributes}}
87-
#[cfg(google_cloud_unstable_tracing)]
8887
let inner = if gaxi::options::tracing_enabled(&config) {
8988
gaxi::grpc::Client::new_with_instrumentation(config, DEFAULT_HOST, &super::tracing::info::INSTRUMENTATION_CLIENT_INFO).await?
9089
} else {
9190
gaxi::grpc::Client::new(config, DEFAULT_HOST).await?
9291
};
93-
#[cfg(not(google_cloud_unstable_tracing))]
94-
let inner = gaxi::grpc::Client::new(config, DEFAULT_HOST).await?;
9592
{{/Codec.DetailedTracingAttributes}}
9693
{{^Codec.DetailedTracingAttributes}}
9794
let inner = gaxi::grpc::Client::new(config, DEFAULT_HOST).await?;
@@ -164,7 +161,6 @@ impl super::stub::{{Codec.Name}} for {{Codec.Name}} {
164161
type TR = crate::{{OutputType.Codec.PackageModuleName}}::{{OutputType.Codec.Name}};
165162
{{/ReturnsEmpty}}
166163
{{#Codec.DetailedTracingAttributes}}
167-
#[cfg(google_cloud_unstable_tracing)]
168164
if let Some(recorder) = gaxi::observability::RequestRecorder::current() {
169165
let attributes = gaxi::observability::ClientRequestAttributes::default()
170166
.set_rpc_method("{{SourceService.Package}}.{{SourceService.Name}}/{{Name}}");

0 commit comments

Comments
 (0)