Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/gax-internal/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

use google_cloud_gax::client_builder::Error as BuilderError;
#[cfg(any(test, feature = "_internal-http-client"))]
use google_cloud_gax::error::Error;
use http::Uri;
use std::str::FromStr;
Expand Down Expand Up @@ -98,6 +99,7 @@ impl HostError {
}
}

#[cfg(any(test, feature = "_internal-http-client"))]
pub fn gax(self) -> Error {
match self {
Self::Uri(e) => Error::io(e),
Expand Down
7 changes: 5 additions & 2 deletions src/gax-internal/src/observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ mod client_signals;
#[cfg(google_cloud_unstable_tracing)]
pub use client_signals::{
ClientRequestAttributes, DurationMetric, RequestRecorder, TransportMetric, WithClientLogging,
WithClientMetric, WithClientSpan, WithTransportLogging, WithTransportMetric, WithTransportSpan,
WithClientMetric, WithClientSpan, WithTransportMetric,
};

#[cfg(google_cloud_unstable_tracing)]
#[cfg(all(google_cloud_unstable_tracing, feature = "_internal-http-client"))]
pub use client_signals::{WithTransportLogging, WithTransportSpan};

#[doc(hidden)]
#[cfg(google_cloud_unstable_tracing)]
pub use attributes::{GCP_CLIENT_REPO_GOOGLEAPIS, SCHEMA_URL_VALUE};
7 changes: 6 additions & 1 deletion src/gax-internal/src/observability/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub mod keys {
pub const OTEL_STATUS_DESCRIPTION: &str = "otel.status_description";

/// The string representation of the gRPC status code.
#[allow(dead_code)]
pub const GRPC_STATUS: &str = "grpc.status";

/// The Remote Procedure Call (RPC) system.
Expand Down Expand Up @@ -83,6 +84,7 @@ pub mod keys {
/// The number of times this same gRPC request has been resent due to retries.
///
/// 1 for the first retry.
#[cfg(feature = "_internal-grpc-client")]
pub const GCP_GRPC_RESEND_COUNT: &str = "gcp.grpc.resend_count";
/// The Google Cloud error domain.
///
Expand All @@ -97,15 +99,17 @@ pub mod keys {
// macro.
pub use opentelemetry_semantic_conventions::trace::{
ERROR_TYPE, HTTP_REQUEST_METHOD, HTTP_REQUEST_RESEND_COUNT, HTTP_RESPONSE_STATUS_CODE,
RPC_METHOD, SERVER_ADDRESS, SERVER_PORT, URL_FULL, URL_SCHEME,
RPC_METHOD, SERVER_ADDRESS, SERVER_PORT, URL_FULL,
};
}

/// Value for [keys::OTEL_KIND].
pub const OTEL_KIND_CLIENT: &str = "Client";
/// Value for `rpc.system`.
#[allow(dead_code)]
pub const RPC_SYSTEM_HTTP: &str = "http";
/// Value for `rpc.system`.
#[cfg(feature = "_internal-grpc-client")]
pub const RPC_SYSTEM_GRPC: &str = "grpc";
/// The GitHub repository hosting the client libraries.
pub const GCP_CLIENT_REPO_GOOGLEAPIS: &str = "googleapis/google-cloud-rust";
Expand All @@ -120,6 +124,7 @@ pub mod error_type_values {
/// A client-configured timeout was reached.
pub const CLIENT_TIMEOUT: &str = "CLIENT_TIMEOUT";
/// The operation was cancelled by the caller.
#[cfg(feature = "_internal-grpc-client")]
pub const CLIENT_CANCELLED: &str = "CLIENT_CANCELLED";
/// Failure to establish the network connection (DNS, TCP, TLS).
pub const CLIENT_CONNECTION_ERROR: &str = "CLIENT_CONNECTION_ERROR";
Expand Down
4 changes: 4 additions & 0 deletions src/gax-internal/src/observability/client_signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ mod transport_metric;
mod with_client_logging;
mod with_client_metric;
mod with_client_span;
#[cfg(feature = "_internal-http-client")]
mod with_transport_logging;
mod with_transport_metric;
#[cfg(feature = "_internal-http-client")]
mod with_transport_span;

pub use duration_metric::DurationMetric;
Expand All @@ -28,8 +30,10 @@ pub use transport_metric::TransportMetric;
pub use with_client_logging::WithClientLogging;
pub use with_client_metric::WithClientMetric;
pub use with_client_span::WithClientSpan;
#[cfg(feature = "_internal-http-client")]
pub use with_transport_logging::WithTransportLogging;
pub use with_transport_metric::WithTransportMetric;
#[cfg(feature = "_internal-http-client")]
pub use with_transport_span::WithTransportSpan;

/// Creates a [Span] and decorated future for a client request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ where
{ HTTP_RESPONSE_STATUS_CODE } = error.http_status_code().map(|v| v as i64),
{ GCP_ERRORS_DOMAIN } = error_domain,
{ GCP_ERRORS_METADATA } = error_metadata,
{ HTTP_REQUEST_RESEND_COUNT } = snapshot.http_resend_count().map(|v| v as i64),
{ URL_SCHEME } = snapshot.url_scheme()
{ HTTP_REQUEST_RESEND_COUNT } = snapshot.http_resend_count().map(|v| v as i64)
);
}
}
Expand Down
Loading