You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by yi...@apache.org on 2023/03/17 01:08:02 UTC
[skywalking-python] branch master updated: Don't init profile / meter damon threads when not active. (#295)
This is an automated email from the ASF dual-hosted git repository.
yihaochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git
The following commit(s) were added to refs/heads/master by this push:
new 46a0f8b Don't init profile / meter damon threads when not active. (#295)
46a0f8b is described below
commit 46a0f8b8501901e8fca89b4f115094a1f4a363d1
Author: ZEAL <ze...@gmail.com>
AuthorDate: Fri Mar 17 09:07:55 2023 +0800
Don't init profile / meter damon threads when not active. (#295)
* only init profile / meter when active
Don't init profile / meter damon threads when not active, since thread is expensive in python.
* only profiling when active
Don't run profiling when config.agent_profile_active set to False.
---
skywalking/agent/__init__.py | 6 ++++--
skywalking/trace/context.py | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/skywalking/agent/__init__.py b/skywalking/agent/__init__.py
index 743d04a..5daf271 100644
--- a/skywalking/agent/__init__.py
+++ b/skywalking/agent/__init__.py
@@ -259,8 +259,10 @@ class SkyWalkingAgent(Singleton):
import grpc.experimental.gevent as grpc_gevent
grpc_gevent.init_gevent()
- profile.init()
- meter.init(force=True) # force re-init after fork()
+ if config.agent_profile_active:
+ profile.init()
+ if config.agent_meter_reporter_active:
+ meter.init(force=True) # force re-init after fork()
self.__bootstrap() # calls init_threading
diff --git a/skywalking/trace/context.py b/skywalking/trace/context.py
index 7f4528d..4b9e796 100644
--- a/skywalking/trace/context.py
+++ b/skywalking/trace/context.py
@@ -149,7 +149,7 @@ class SpanContext:
parent = self.peek()
# start profiling if profile_context is set
- if self.profile_status is None:
+ if config.agent_profile_active and self.profile_status is None:
self.profile_status = profile.profile_task_execution_service.add_profiling(self,
self.segment.segment_id,
op)
@@ -192,6 +192,8 @@ class SpanContext:
return span
def profiling_recheck(self, span: Span, op_name: str):
+ if not config.agent_profile_active:
+ return
# only check first span, e.g, first opname is correct.
if span.sid != 0:
return