Skip to content

Commit c557349

Browse files
committed
Made Compilable with telemetry
1 parent 883b33a commit c557349

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

my-http-server-core/src/http_server.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,18 @@ pub async fn handle_requests(
158158
.write_fail(
159159
&ctx,
160160
started,
161-
format!("[{}]{}", method, path),
161+
format!("[{}]{}", method, path.as_str().to_string()),
162162
format!("Panic: {:?}", err),
163163
TelemetryEventTagsBuilder::new()
164-
.add_ip(ip.to_string())
164+
.add_ip(ip.as_str().to_string())
165165
.build(),
166166
)
167167
.await;
168168

169169
let mut ctx = HashMap::new();
170170
ctx.insert("path".to_string(), path.as_str().to_string());
171171
ctx.insert("method".to_string(), method.to_string());
172-
ctx.insert("ip".to_string(), ip.to_string());
172+
ctx.insert("ip".to_string(), ip.as_str().to_string());
173173

174174
logger.write_error(
175175
"HttpRequest".to_string(),
@@ -198,7 +198,7 @@ pub async fn handle_requests(
198198
.write_success(
199199
&ctx,
200200
started,
201-
format!("[{}]{}", method, path),
201+
format!("[{}]{}", method, path.as_str().to_string()),
202202
format!("Status code: {}", ok_result.output.get_status_code()),
203203
tags.into(),
204204
)
@@ -215,9 +215,9 @@ pub async fn handle_requests(
215215
if err_result.write_telemetry {
216216
if err_result.write_to_log {
217217
let mut ctx = HashMap::new();
218-
ctx.insert("path".to_string(), path.to_string());
218+
ctx.insert("path".to_string(), path.as_str().to_string());
219219
ctx.insert("method".to_string(), request_ctx.request.method.to_string());
220-
ctx.insert("ip".to_string(), ip.to_string());
220+
ctx.insert("ip".to_string(), ip.as_str().to_string());
221221
ctx.insert("httpCode".to_string(), err_result.status_code.to_string());
222222

223223
if let Some(credentials) = &request_ctx.credentials {
@@ -246,7 +246,7 @@ pub async fn handle_requests(
246246
.write_fail(
247247
&ctx,
248248
started,
249-
format!("[{}]{}", method, path),
249+
format!("[{}]{}", method, path.as_str()),
250250
format!("Status code: {}", err_result.status_code),
251251
tags.into(),
252252
)

0 commit comments

Comments
 (0)