Skip to content

Commit

Permalink
refactor: some renaming (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
hseeberger authored Jul 23, 2024
1 parent 8d0acf0 commit 4aff0f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hello-tracing-backend/proto/hello-tracing-backend-v0.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ service Hello { rpc Hello(HelloRequest) returns (HelloResponse); }

message HelloRequest {}

message HelloResponse { string msg = 1; }
message HelloResponse { string message = 1; }
10 changes: 5 additions & 5 deletions hello-tracing-backend/src/api/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use tonic::{Request, Response, Status};
use tracing::{debug, instrument};

const MSGS: [&str; 2] = [
const MESSAGES: [&str; 2] = [
"Hello, I'm a tracing demo!",
"Hello, I'm built with Rust, Axum and tonic!",
];
Expand All @@ -34,10 +34,10 @@ impl Hello for HelloService {
self.0.store(current, Ordering::Release);

// Get message for this response.
let msg = if current { MSGS[0] } else { MSGS[1] };
let msg = msg.to_string();
debug!(msg, "answering with msg");
let message = if current { MESSAGES[0] } else { MESSAGES[1] };
let message = message.to_string();
debug!(message, "answering");

Ok(Response::new(HelloResponse { msg }))
Ok(Response::new(HelloResponse { message }))
}
}
2 changes: 1 addition & 1 deletion hello-tracing-gateway/proto/hello-tracing-backend-v0.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ service Hello { rpc Hello(HelloRequest) returns (HelloResponse); }

message HelloRequest {}

message HelloResponse { string msg = 1; }
message HelloResponse { string message = 1; }
12 changes: 6 additions & 6 deletions hello-tracing-gateway/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ impl Backend {
.with_context(|| format!("connect to endpoint {}", self.endpoint))?;
let mut client = HelloClient::with_interceptor(channel, send_trace);

let msg = client
let message = client
.hello(HelloRequest {})
.await
.with_context(|| format!("call rpc Hello on endpoint {}", self.endpoint))?
.with_context(|| format!("call Hello on endpoint {}", self.endpoint))?
.into_inner()
.msg;
.message;

debug!(
msg,
message,
endpoint = self.endpoint,
"received response from rpc Hello"
"received response from Hello"
);

Ok(msg)
Ok(message)
}
}

Expand Down

0 comments on commit 4aff0f7

Please sign in to comment.