Skip to content

Commit 8ae3f08

Browse files
authored
feat: Add event name to missing otel_error logs (#1978)
# Change Summary Add eventName to missing logs. ## What issue does this PR close? Part of #1972 * Closes #N/A ## How are these changes tested? local builds and tests ## Are there any user-facing changes? No
1 parent 84f5069 commit 8ae3f08

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

rust/otap-dataflow/crates/otap/src/console_exporter.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,28 +131,34 @@ impl ConsoleExporter {
131131
self.formatter.print_logs_data(&logs_view).await;
132132
}
133133
Err(e) => {
134-
otel_error!("Failed to create OTLP logs view", error = ?e);
134+
otel_error!("console.logs_view.otlp_create_failed", error = ?e, message = "Failed to create OTLP logs view");
135135
}
136136
},
137137
OtapPayload::OtapArrowRecords(records) => match OtapLogsView::try_from(records) {
138138
Ok(logs_view) => {
139139
self.formatter.print_logs_data(&logs_view).await;
140140
}
141141
Err(e) => {
142-
otel_error!("Failed to create OTAP logs view", error = ?e);
142+
otel_error!("console.logs_view.otap_create_failed", error = ?e, message = "Failed to create OTAP logs view");
143143
}
144144
},
145145
}
146146
}
147147

148148
async fn export_traces(&self, _payload: &OtapPayload) {
149149
// TODO: Implement traces formatting.
150-
otel_error!("Traces formatting not yet implemented");
150+
otel_error!(
151+
"console.traces.not_implemented",
152+
message = "Traces formatting not yet implemented"
153+
);
151154
}
152155

153156
async fn export_metrics(&self, _payload: &OtapPayload) {
154157
// TODO: Implement metrics formatting.
155-
otel_error!("Metrics formatting not yet implemented");
158+
otel_error!(
159+
"console.metrics.not_implemented",
160+
message = "Metrics formatting not yet implemented"
161+
);
156162
}
157163
}
158164

@@ -209,7 +215,7 @@ impl HierarchicalFormatter {
209215
use tokio::io::AsyncWriteExt;
210216

211217
if let Err(err) = tokio::io::stdout().write_all(&output).await {
212-
otel_error!("could not write to console", error = ?err);
218+
otel_error!("console.write_failed", error = ?err, message = "Could not write to console");
213219
}
214220
}
215221

rust/otap-dataflow/crates/otap/src/otap_grpc.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ where
290290
{
291291
let batch_id = batch.batch_id;
292292
let batch = consumer.consume_bar(&mut batch).map_err(|e| {
293-
otel_error!("Error decoding OTAP Batch. Closing stream", error = ?e);
293+
otel_error!("otap.batch.decode_failed", error = ?e, message = "Error decoding OTAP Batch. Closing stream");
294294
})?;
295295

296296
let batch = from_record_messages::<T>(batch);
@@ -305,15 +305,18 @@ where
305305
match guard_result {
306306
Ok(mut guard) => guard.allocate(|| oneshot::channel()),
307307
Err(_) => {
308-
otel_error!("Mutex poisoned");
308+
otel_error!("otap.mutex.poisoned", message = "Mutex poisoned");
309309
return Err(());
310310
}
311311
}
312312
}; // MutexGuard is dropped here
313313

314314
let (key, rx) = match allocation_result {
315315
None => {
316-
otel_error!("Too many concurrent requests");
316+
otel_error!(
317+
"otap.request.concurrency_limit",
318+
message = "Too many concurrent requests"
319+
);
317320

318321
// Send backpressure response
319322
tx.send(Ok(BatchStatus {
@@ -326,7 +329,7 @@ where
326329
}))
327330
.await
328331
.map_err(|e| {
329-
otel_error!("Error sending BatchStatus response", error = ?e);
332+
otel_error!("otap.response.send_failed", error = ?e, message = "Error sending BatchStatus response");
330333
})?;
331334

332335
return Ok(());
@@ -352,7 +355,7 @@ where
352355
{
353356
Ok(_) => {}
354357
Err(e) => {
355-
otel_error!("Failed to send to pipeline", error = ?e);
358+
otel_error!("otap.pipeline.send_failed", error = ?e, message = "Failed to send to pipeline");
356359
return Err(());
357360
}
358361
};
@@ -378,13 +381,16 @@ where
378381
}))
379382
.await
380383
.map_err(|e| {
381-
otel_error!("Error sending BatchStatus response", error = ?e);
384+
otel_error!("otap.response.send_failed", error = ?e, message = "Error sending BatchStatus response");
382385
})?;
383386

384387
return Ok(());
385388
}
386389
Err(_) => {
387-
otel_error!("Response channel closed unexpectedly");
390+
otel_error!(
391+
"otap.response.channel_closed",
392+
message = "Response channel closed unexpectedly"
393+
);
388394
return Err(());
389395
}
390396
}
@@ -397,7 +403,7 @@ where
397403
}))
398404
.await
399405
.map_err(|e| {
400-
otel_error!("Error sending BatchStatus response", error = ?e);
406+
otel_error!("otap.response.send_failed", error = ?e, message = "Error sending BatchStatus response");
401407
})
402408
}
403409

0 commit comments

Comments
 (0)