Skip to content

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed
 

‎opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class LogExportResult(enum.Enum):
5454
FAILURE = 1
5555

5656

57-
5857
class LogExporter(abc.ABC):
5958
"""Interface for exporting logs.
6059
Interface to be implemented by services that want to export logs received
@@ -79,6 +78,7 @@ def shutdown(self):
7978
Called when the SDK is shut down.
8079
"""
8180

81+
8282
class ConsoleLogExporter(LogExporter):
8383
"""Implementation of :class:`LogExporter` that prints log records to the
8484
console.

‎opentelemetry-sdk/src/opentelemetry/sdk/_shared_internal/__init__.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(
7171
# Deque is thread safe.
7272
self._queue = collections.deque([], max_queue_size)
7373
self._worker_thread = threading.Thread(
74-
name="OtelBatch{}RecordProcessor".format(exporting),
74+
name=f"OtelBatch{exporting}RecordProcessor",
7575
target=self.worker,
7676
daemon=True,
7777
)
@@ -105,7 +105,7 @@ def _at_fork_reinit(self):
105105
self._worker_awaken = threading.Event()
106106
self._queue.clear()
107107
self._worker_thread = threading.Thread(
108-
name="OtelBatch{}RecordProcessor".format(self._exporting),
108+
name=f"OtelBatch{self._exporting}RecordProcessor",
109109
target=self.worker,
110110
daemon=True,
111111
)
@@ -151,23 +151,19 @@ def _export(self, batch_strategy: BatchExportStrategy) -> None:
151151
)
152152
except Exception: # pylint: disable=broad-exception-caught
153153
self._logger.exception(
154-
"Exception while exporting {}.".format(self._exporting)
154+
"Exception while exporting %s.", self._exporting
155155
)
156156
detach(token)
157157

158158
def emit(self, data: Union["LogRecord" | "Span"]) -> None:
159159
if self._shutdown:
160-
self._logger.info(
161-
"Shutdown called, ignoring {}.".format(self._exporting)
162-
)
160+
self._logger.info("Shutdown called, ignoring %s.", self._exporting)
163161
return
164162
if self._pid != os.getpid():
165-
self.bsp_reset_once.do_once(self._at_fork_reinit)
163+
self._bsp_reset_once.do_once(self._at_fork_reinit)
166164

167165
if len(self._queue) == self._max_queue_size:
168-
self._logger.warning(
169-
"Queue full, dropping {}.".format(self._exporting)
170-
)
166+
self._logger.warning("Queue full, dropping %s.", self._exporting)
171167
self._queue.appendleft(data)
172168
if len(self._queue) >= self._max_export_batch_size:
173169
self._worker_awaken.set()

‎opentelemetry-sdk/tests/logs/test_export.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
# pylint: disable=protected-access
16-
import gc
1716
import logging
1817
import os
1918
import time
@@ -43,7 +42,6 @@
4342
)
4443
from opentelemetry.sdk.resources import Resource as SDKResource
4544
from opentelemetry.sdk.util.instrumentation import InstrumentationScope
46-
from opentelemetry.test.concurrency_test import ConcurrencyTestBase
4745
from opentelemetry.trace import TraceFlags
4846
from opentelemetry.trace.span import INVALID_SPAN_CONTEXT
4947

@@ -467,6 +465,7 @@ def test_validation_negative_max_queue_size(self):
467465
max_export_batch_size=101,
468466
)
469467

468+
470469
class TestConsoleLogExporter(unittest.TestCase):
471470
def test_export(self): # pylint: disable=no-self-use
472471
"""Check that the console exporter prints log records."""

0 commit comments

Comments
 (0)
Please sign in to comment.