File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
internal/sidekick/internal/rust/templates/crate/src Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,15 @@ pub(crate) mod info {
119119 ac.rest_header_value()
120120 };
121121 }
122+ { {#Codec.DetailedTracingAttributes} }
123+ pub(crate) static INSTRUMENTATION_CLIENT_INFO: gaxi::options::InstrumentationClientInfo = gaxi::options::InstrumentationClientInfo {
124+ service_name: " {{Name}}" ,
125+ client_version: VERSION,
126+ client_artifact: NAME,
127+ default_host: " {{Codec.DefaultHostShort}}" ,
128+ ..Default::default ()
129+ } ;
130+ { {/Codec.DetailedTracingAttributes} }
122131}
123132
124133{ {/Codec.HasServices} }
Original file line number Diff line number Diff line change @@ -53,8 +53,20 @@ impl std::fmt::Debug for {{Codec.Name}} {
5353{{/Codec.PerServiceFeatures}}
5454impl {{Codec.Name}} {
5555 pub async fn new(config: gaxi::options::ClientConfig) -> gax::client_builder::Result<Self> {
56+ {{#Codec.DetailedTracingAttributes}}
57+ let tracing_is_enabled = gaxi::options::tracing_enabled(&config);
58+ let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
59+ let inner = if tracing_is_enabled {
60+ inner.with_instrumentation(Some(crate::info::INSTRUMENTATION_CLIENT_INFO))
61+ } else {
62+ inner
63+ };
64+ Ok(Self { inner })
65+ {{/Codec.DetailedTracingAttributes}}
66+ {{^Codec.DetailedTracingAttributes}}
5667 let inner = gaxi::http::ReqwestClient::new(config, crate::DEFAULT_HOST).await?;
5768 Ok(Self { inner })
69+ {{/Codec.DetailedTracingAttributes}}
5870 }
5971}
6072
You can’t perform that action at this time.
0 commit comments