Skip to content

Commit

Permalink
fixes for precommit.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindaugas Vinkelis committed Sep 29, 2024
1 parent bf24bca commit badd0c6
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ pub struct ExportLogsPartialSuccess {
/// Generated client implementations.
#[cfg(feature = "gen-tonic")]
pub mod logs_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service that can be used to push logs between one Application instrumented with
Expand Down Expand Up @@ -160,8 +166,7 @@ pub mod logs_service_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -184,7 +189,13 @@ pub mod logs_service_client {
/// Generated server implementations.
#[cfg(feature = "gen-tonic")]
pub mod logs_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with LogsServiceServer.
#[async_trait]
Expand Down Expand Up @@ -325,17 +336,19 @@ pub mod logs_service_server {
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ pub struct ExportMetricsPartialSuccess {
/// Generated client implementations.
#[cfg(feature = "gen-tonic")]
pub mod metrics_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service that can be used to push metrics between one Application
Expand Down Expand Up @@ -160,8 +166,7 @@ pub mod metrics_service_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -184,7 +189,13 @@ pub mod metrics_service_client {
/// Generated server implementations.
#[cfg(feature = "gen-tonic")]
pub mod metrics_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with MetricsServiceServer.
#[async_trait]
Expand Down Expand Up @@ -325,17 +336,19 @@ pub mod metrics_service_server {
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ pub struct ExportTracePartialSuccess {
/// Generated client implementations.
#[cfg(feature = "gen-tonic")]
pub mod trace_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service that can be used to push spans between one Application instrumented with
Expand Down Expand Up @@ -160,8 +166,7 @@ pub mod trace_service_client {
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
Expand All @@ -184,7 +189,13 @@ pub mod trace_service_client {
/// Generated server implementations.
#[cfg(feature = "gen-tonic")]
pub mod trace_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with TraceServiceServer.
#[async_trait]
Expand Down Expand Up @@ -325,17 +336,19 @@ pub mod trace_service_server {
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-proto/tests/grpc_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn build_tonic() {

builder
.out_dir(out_dir.path())
.compile(TONIC_PROTO_FILES, TONIC_INCLUDES)
.compile_protos(TONIC_PROTO_FILES, TONIC_INCLUDES)
.expect("cannot compile protobuf using tonic");

let after_build = build_content_map(out_dir.path(), true);
Expand Down

0 comments on commit badd0c6

Please sign in to comment.