Skip to content

Commit c52c479

Browse files
frailltMindaugas Vinkelis
authored and
Mindaugas Vinkelis
committed
fixes for precommit.sh
1 parent bf24bca commit c52c479

4 files changed

+85
-46
lines changed

opentelemetry-proto/src/proto/tonic/opentelemetry.proto.collector.logs.v1.rs

+28-15
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ pub struct ExportLogsPartialSuccess {
6161
/// Generated client implementations.
6262
#[cfg(feature = "gen-tonic")]
6363
pub mod logs_service_client {
64-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
64+
#![allow(
65+
unused_variables,
66+
dead_code,
67+
missing_docs,
68+
clippy::wildcard_imports,
69+
clippy::let_unit_value,
70+
)]
6571
use tonic::codegen::*;
6672
use tonic::codegen::http::Uri;
6773
/// Service that can be used to push logs between one Application instrumented with
@@ -160,8 +166,7 @@ pub mod logs_service_client {
160166
.ready()
161167
.await
162168
.map_err(|e| {
163-
tonic::Status::new(
164-
tonic::Code::Unknown,
169+
tonic::Status::unknown(
165170
format!("Service was not ready: {}", e.into()),
166171
)
167172
})?;
@@ -184,7 +189,13 @@ pub mod logs_service_client {
184189
/// Generated server implementations.
185190
#[cfg(feature = "gen-tonic")]
186191
pub mod logs_service_server {
187-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
192+
#![allow(
193+
unused_variables,
194+
dead_code,
195+
missing_docs,
196+
clippy::wildcard_imports,
197+
clippy::let_unit_value,
198+
)]
188199
use tonic::codegen::*;
189200
/// Generated trait containing gRPC methods that should be implemented for use with LogsServiceServer.
190201
#[async_trait]
@@ -325,17 +336,19 @@ pub mod logs_service_server {
325336
}
326337
_ => {
327338
Box::pin(async move {
328-
Ok(
329-
http::Response::builder()
330-
.status(200)
331-
.header("grpc-status", tonic::Code::Unimplemented as i32)
332-
.header(
333-
http::header::CONTENT_TYPE,
334-
tonic::metadata::GRPC_CONTENT_TYPE,
335-
)
336-
.body(empty_body())
337-
.unwrap(),
338-
)
339+
let mut response = http::Response::new(empty_body());
340+
let headers = response.headers_mut();
341+
headers
342+
.insert(
343+
tonic::Status::GRPC_STATUS,
344+
(tonic::Code::Unimplemented as i32).into(),
345+
);
346+
headers
347+
.insert(
348+
http::header::CONTENT_TYPE,
349+
tonic::metadata::GRPC_CONTENT_TYPE,
350+
);
351+
Ok(response)
339352
})
340353
}
341354
}

opentelemetry-proto/src/proto/tonic/opentelemetry.proto.collector.metrics.v1.rs

+28-15
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ pub struct ExportMetricsPartialSuccess {
6161
/// Generated client implementations.
6262
#[cfg(feature = "gen-tonic")]
6363
pub mod metrics_service_client {
64-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
64+
#![allow(
65+
unused_variables,
66+
dead_code,
67+
missing_docs,
68+
clippy::wildcard_imports,
69+
clippy::let_unit_value,
70+
)]
6571
use tonic::codegen::*;
6672
use tonic::codegen::http::Uri;
6773
/// Service that can be used to push metrics between one Application
@@ -160,8 +166,7 @@ pub mod metrics_service_client {
160166
.ready()
161167
.await
162168
.map_err(|e| {
163-
tonic::Status::new(
164-
tonic::Code::Unknown,
169+
tonic::Status::unknown(
165170
format!("Service was not ready: {}", e.into()),
166171
)
167172
})?;
@@ -184,7 +189,13 @@ pub mod metrics_service_client {
184189
/// Generated server implementations.
185190
#[cfg(feature = "gen-tonic")]
186191
pub mod metrics_service_server {
187-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
192+
#![allow(
193+
unused_variables,
194+
dead_code,
195+
missing_docs,
196+
clippy::wildcard_imports,
197+
clippy::let_unit_value,
198+
)]
188199
use tonic::codegen::*;
189200
/// Generated trait containing gRPC methods that should be implemented for use with MetricsServiceServer.
190201
#[async_trait]
@@ -325,17 +336,19 @@ pub mod metrics_service_server {
325336
}
326337
_ => {
327338
Box::pin(async move {
328-
Ok(
329-
http::Response::builder()
330-
.status(200)
331-
.header("grpc-status", tonic::Code::Unimplemented as i32)
332-
.header(
333-
http::header::CONTENT_TYPE,
334-
tonic::metadata::GRPC_CONTENT_TYPE,
335-
)
336-
.body(empty_body())
337-
.unwrap(),
338-
)
339+
let mut response = http::Response::new(empty_body());
340+
let headers = response.headers_mut();
341+
headers
342+
.insert(
343+
tonic::Status::GRPC_STATUS,
344+
(tonic::Code::Unimplemented as i32).into(),
345+
);
346+
headers
347+
.insert(
348+
http::header::CONTENT_TYPE,
349+
tonic::metadata::GRPC_CONTENT_TYPE,
350+
);
351+
Ok(response)
339352
})
340353
}
341354
}

opentelemetry-proto/src/proto/tonic/opentelemetry.proto.collector.trace.v1.rs

+28-15
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ pub struct ExportTracePartialSuccess {
6161
/// Generated client implementations.
6262
#[cfg(feature = "gen-tonic")]
6363
pub mod trace_service_client {
64-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
64+
#![allow(
65+
unused_variables,
66+
dead_code,
67+
missing_docs,
68+
clippy::wildcard_imports,
69+
clippy::let_unit_value,
70+
)]
6571
use tonic::codegen::*;
6672
use tonic::codegen::http::Uri;
6773
/// Service that can be used to push spans between one Application instrumented with
@@ -160,8 +166,7 @@ pub mod trace_service_client {
160166
.ready()
161167
.await
162168
.map_err(|e| {
163-
tonic::Status::new(
164-
tonic::Code::Unknown,
169+
tonic::Status::unknown(
165170
format!("Service was not ready: {}", e.into()),
166171
)
167172
})?;
@@ -184,7 +189,13 @@ pub mod trace_service_client {
184189
/// Generated server implementations.
185190
#[cfg(feature = "gen-tonic")]
186191
pub mod trace_service_server {
187-
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
192+
#![allow(
193+
unused_variables,
194+
dead_code,
195+
missing_docs,
196+
clippy::wildcard_imports,
197+
clippy::let_unit_value,
198+
)]
188199
use tonic::codegen::*;
189200
/// Generated trait containing gRPC methods that should be implemented for use with TraceServiceServer.
190201
#[async_trait]
@@ -325,17 +336,19 @@ pub mod trace_service_server {
325336
}
326337
_ => {
327338
Box::pin(async move {
328-
Ok(
329-
http::Response::builder()
330-
.status(200)
331-
.header("grpc-status", tonic::Code::Unimplemented as i32)
332-
.header(
333-
http::header::CONTENT_TYPE,
334-
tonic::metadata::GRPC_CONTENT_TYPE,
335-
)
336-
.body(empty_body())
337-
.unwrap(),
338-
)
339+
let mut response = http::Response::new(empty_body());
340+
let headers = response.headers_mut();
341+
headers
342+
.insert(
343+
tonic::Status::GRPC_STATUS,
344+
(tonic::Code::Unimplemented as i32).into(),
345+
);
346+
headers
347+
.insert(
348+
http::header::CONTENT_TYPE,
349+
tonic::metadata::GRPC_CONTENT_TYPE,
350+
);
351+
Ok(response)
339352
})
340353
}
341354
}

opentelemetry-proto/tests/grpc_build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn build_tonic() {
125125

126126
builder
127127
.out_dir(out_dir.path())
128-
.compile(TONIC_PROTO_FILES, TONIC_INCLUDES)
128+
.compile_protos(TONIC_PROTO_FILES, TONIC_INCLUDES)
129129
.expect("cannot compile protobuf using tonic");
130130

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

0 commit comments

Comments
 (0)