#
google_cloud_pubsub/generated/gapic_dataplane/
tracing.rs

    1// Copyright 2025 Google LLC
    2//
    3// Licensed under the Apache License, Version 2.0 (the "License");
    4// you may not use this file except in compliance with the License.
    5// You may obtain a copy of the License at
    6//
    7//     https://www.apache.org/licenses/LICENSE-2.0
    8//
    9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14//
    15// Code generated by sidekick. DO NOT EDIT.
    16use crate::Result;
    17
    18/// Implements a [Publisher](super::stub::Publisher) decorator for logging and tracing.
    19#[derive(Clone, Debug)]
    20pub struct Publisher<T>
    21where
    22    T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
    23{
    24    inner: T,
    25}
    26
    27impl<T> Publisher<T>
    28where
    29    T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
    30{
    31    pub fn new(inner: T) -> Self {
    32        Self { inner }
    33    }
    34}
    35
    36impl<T> super::stub::Publisher for Publisher<T>
    37where
    38    T: super::stub::Publisher + std::fmt::Debug + Send + Sync,
    39{
    40    #[tracing::instrument(ret)]
    41    async fn publish(
    42        &self,
    43        req: crate::model::PublishRequest,
    44        options: gax::options::RequestOptions,
    45    ) -> Result<gax::response::Response<crate::model::PublishResponse>> {
    46        self.inner.publish(req, options).await
    47    }
    48}
    49
    50/// Implements a [Subscriber](super::stub::Subscriber) decorator for logging and tracing.
    51#[derive(Clone, Debug)]
    52pub struct Subscriber<T>
    53where
    54    T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
    55{
    56    inner: T,
    57}
    58
    59impl<T> Subscriber<T>
    60where
    61    T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
    62{
    63    pub fn new(inner: T) -> Self {
    64        Self { inner }
    65    }
    66}
    67
    68impl<T> super::stub::Subscriber for Subscriber<T>
    69where
    70    T: super::stub::Subscriber + std::fmt::Debug + Send + Sync,
    71{
    72    #[tracing::instrument(ret)]
    73    async fn modify_ack_deadline(
    74        &self,
    75        req: crate::model::ModifyAckDeadlineRequest,
    76        options: gax::options::RequestOptions,
    77    ) -> Result<gax::response::Response<()>> {
    78        self.inner.modify_ack_deadline(req, options).await
    79    }
    80
    81    #[tracing::instrument(ret)]
    82    async fn acknowledge(
    83        &self,
    84        req: crate::model::AcknowledgeRequest,
    85        options: gax::options::RequestOptions,
    86    ) -> Result<gax::response::Response<()>> {
    87        self.inner.acknowledge(req, options).await
    88    }
    89}