Skip to content

Commit 46aaac9

Browse files
committed
replace logs with span where relevant
1 parent 0f38bd4 commit 46aaac9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

opentelemetry-sdk/src/trace/span_processor.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl BatchSpanProcessor {
346346
},
347347
Err(RecvTimeoutError::Timeout) => {
348348
otel_debug!(
349-
name: "BatchLogProcessor.ExportingDueToTimer",
349+
name: "BatchSpanProcessor.ExportingDueToTimer",
350350
);
351351

352352
let _ = Self::get_spans_and_export(
@@ -416,23 +416,23 @@ impl BatchSpanProcessor {
416416
where
417417
E: SpanExporter + Send + Sync + 'static,
418418
{
419-
// Get upto `max_export_batch_size` amount of logs log records from the channel and push them to the logs vec
420-
while let Ok(log) = spans_receiver.try_recv() {
421-
spans.push(log);
419+
// Get upto `max_export_batch_size` amount of spans from the channel and push them to the span vec
420+
while let Ok(span) = spans_receiver.try_recv() {
421+
spans.push(span);
422422
if spans.len() == config.max_export_batch_size {
423423
break;
424424
}
425425
}
426426

427-
let count_of_logs = spans.len(); // Count of logs that will be exported
427+
let count_of_spans = spans.len(); // Count of spans that will be exported
428428
let result = Self::export_with_timeout_sync(
429429
config.max_export_timeout,
430430
exporter,
431431
spans,
432432
last_export_time,
433-
); // This method clears the logs vec after exporting
433+
); // This method clears the spans vec after exporting
434434

435-
current_batch_size.fetch_sub(count_of_logs, Ordering::Relaxed);
435+
current_batch_size.fetch_sub(count_of_spans, Ordering::Relaxed);
436436
result
437437
}
438438

@@ -459,7 +459,7 @@ impl BatchSpanProcessor {
459459
Ok(_) => TraceResult::Ok(()),
460460
Err(err) => {
461461
otel_error!(
462-
name: "BatchLogProcessor.ExportError",
462+
name: "BatchSpanProcessor.ExportError",
463463
error = format!("{}", err)
464464
);
465465
TraceResult::Err(err)
@@ -494,17 +494,17 @@ impl SpanProcessor for BatchSpanProcessor {
494494
message = "BatchSpanProcessor dropped a Span due to queue full/internal errors. No further internal log will be emitted for further drops until Shutdown. During Shutdown time, a log will be emitted with exact count of total Spans dropped.");
495495
}
496496
}
497-
// At this point, sending the log record to the data channel was successful.
497+
// At this point, sending the span to the data channel was successful.
498498
// Increment the current batch size and check if it has reached the max export batch size.
499499
if self.current_batch_size.fetch_add(1, Ordering::Relaxed) + 1 >= self.max_export_batch_size
500500
{
501-
// Check if the a control message for exporting logs is already sent to the worker thread.
502-
// If not, send a control message to export logs.
501+
// Check if the a control message for exporting spans is already sent to the worker thread.
502+
// If not, send a control message to export spans.
503503
// `export_span_message_sent` is set to false ONLY when the worker thread has processed the control message.
504504

505505
if !self.export_span_message_sent.load(Ordering::Relaxed) {
506506
// This is a cost-efficient check as atomic load operations do not require exclusive access to cache line.
507-
// Perform atomic swap to `export_log_message_sent` ONLY when the atomic load operation above returns false.
507+
// Perform atomic swap to `export_span_message_sent` ONLY when the atomic load operation above returns false.
508508
// Atomic swap/compare_exchange operations require exclusive access to cache line on most processor architectures.
509509
// We could have used compare_exchange as well here, but it's more verbose than swap.
510510
if !self.export_span_message_sent.swap(true, Ordering::Relaxed) {
@@ -516,7 +516,7 @@ impl SpanProcessor for BatchSpanProcessor {
516516
}
517517
Err(_err) => {
518518
// TODO: Log error
519-
// If the control message could not be sent, reset the `export_log_message_sent` flag.
519+
// If the control message could not be sent, reset the `export_span_message_sent` flag.
520520
self.export_span_message_sent
521521
.store(false, Ordering::Relaxed);
522522
}
@@ -550,7 +550,7 @@ impl SpanProcessor for BatchSpanProcessor {
550550
let max_queue_size = self.max_queue_size;
551551
if dropped_spans > 0 {
552552
otel_warn!(
553-
name: "BatchSpanProcessor.LogsDropped",
553+
name: "BatchSpanProcessor.SpansDropped",
554554
dropped_span_count = dropped_spans,
555555
max_queue_size = max_queue_size,
556556
message = "Spans were dropped due to a queue being full or other error. The count represents the total count of spans dropped in the lifetime of this BatchSpanProcessor. Consider increasing the queue size and/or decrease delay between intervals."

0 commit comments

Comments
 (0)