Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify name for worker threads for logging and metrics #2724

Merged
merged 4 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2714](https://github.com/open-telemetry/opentelemetry-python/pull/2714))
- narrow protobuf dependencies to exclude protobuf >= 4
([#2720](https://github.com/open-telemetry/opentelemetry-python/pull/2720))
- Specify worker thread names
([#2720](https://github.com/open-telemetry/opentelemetry-python/pull/2720))
lzchen marked this conversation as resolved.
Show resolved Hide resolved

## [1.12.0rc1-0.31b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc1-0.31b0) - 2022-05-17



- Fix LoggingHandler to handle LogRecord with exc_info=False
([#2690](https://github.com/open-telemetry/opentelemetry-python/pull/2690))
- Make metrics components public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ def __init__(
self._max_export_batch_size = max_export_batch_size
self._export_timeout_millis = export_timeout_millis
self._queue = collections.deque() # type: Deque[LogData]
self._worker_thread = threading.Thread(target=self.worker, daemon=True)
self._worker_thread = threading.Thread(
name="OtelBatchLogProcessor",
target=self.worker,
daemon=True,
)
self._condition = threading.Condition(threading.Lock())
self._shutdown = False
self._flush_request = None # type: Optional[_FlushRequest]
Expand All @@ -164,7 +168,11 @@ def __init__(
def _at_fork_reinit(self):
self._condition = threading.Condition(threading.Lock())
self._queue.clear()
self._worker_thread = threading.Thread(target=self.worker, daemon=True)
self._worker_thread = threading.Thread(
name="OtelBatchLogProcessor",
target=self.worker,
daemon=True,
)
self._worker_thread.start()

def worker(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,23 @@ def __init__(
self._shutdown = False
self._shutdown_event = Event()
self._shutdown_once = Once()
self._daemon_thread = Thread(target=self._ticker, daemon=True)
self._daemon_thread = Thread(
name="OtelPeriodicExportingMetricReader",
target=self._ticker,
daemon=True,
)
self._daemon_thread.start()
if hasattr(os, "register_at_fork"):
os.register_at_fork(
after_in_child=self._at_fork_reinit
) # pylint: disable=protected-access

def _at_fork_reinit(self):
self._daemon_thread = Thread(target=self._ticker, daemon=True)
self._daemon_thread = Thread(
name="OtelPeriodicExportingMetricReader",
target=self._ticker,
daemon=True,
)
self._daemon_thread.start()

def _ticker(self) -> None:
Expand Down