You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/10/23 02:31:17 UTC

[skywalking-python] branch master updated: Introduce stricter coding style (#171)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 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 9b0f83d  Introduce stricter coding style (#171)
9b0f83d is described below

commit 9b0f83d74f37650dcff6082ff2d738dd2aee49d9
Author: Superskyyy <Su...@outlook.com>
AuthorDate: Fri Oct 22 22:31:10 2021 -0400

    Introduce stricter coding style (#171)
---
 .asf.yaml                                          |  4 +-
 .flake8                                            |  1 +
 Makefile                                           |  5 +-
 docs/en/contribution/CodingStyle.md                | 36 ++++++++++
 docs/en/contribution/PluginTest.md                 |  6 +-
 docs/menu.yml                                      |  2 +
 requirements.txt                                   |  2 +
 setup.py                                           | 68 +++++++++----------
 skywalking/agent/__init__.py                       | 12 ++--
 skywalking/agent/protocol/grpc.py                  | 28 ++++----
 skywalking/agent/protocol/http.py                  |  9 +--
 skywalking/agent/protocol/kafka.py                 | 18 ++---
 skywalking/bootstrap/cli/sw_python.py              | 12 ++--
 skywalking/bootstrap/cli/utility/runner.py         | 10 +--
 skywalking/bootstrap/loader/sitecustomize.py       | 54 +++++++--------
 skywalking/client/grpc.py                          | 28 ++++----
 skywalking/client/http.py                          | 33 +++++----
 skywalking/client/kafka.py                         | 39 ++++++-----
 skywalking/command/base_command.py                 |  4 +-
 skywalking/command/command_service.py              |  8 +--
 skywalking/command/profile_task_command.py         | 26 +++----
 skywalking/config.py                               | 14 ++--
 skywalking/decorators.py                           |  2 +-
 skywalking/log/formatter.py                        |  2 +-
 skywalking/log/sw_logging.py                       | 10 +--
 skywalking/loggings.py                             |  1 +
 skywalking/plugins/__init__.py                     | 20 +++---
 skywalking/plugins/sw_aiohttp.py                   | 19 +++---
 skywalking/plugins/sw_celery.py                    | 16 ++---
 skywalking/plugins/sw_django.py                    | 14 ++--
 skywalking/plugins/sw_elasticsearch.py             | 14 ++--
 skywalking/plugins/sw_falcon.py                    | 10 +--
 skywalking/plugins/sw_flask.py                     | 12 ++--
 skywalking/plugins/sw_http_server.py               | 34 +++++-----
 skywalking/plugins/sw_kafka.py                     | 18 ++---
 skywalking/plugins/sw_psycopg.py                   | 70 +++++++++----------
 skywalking/plugins/sw_psycopg2.py                  | 38 +++++------
 skywalking/plugins/sw_pymongo.py                   | 54 +++++++--------
 skywalking/plugins/sw_pymysql.py                   | 20 +++---
 skywalking/plugins/sw_pyramid.py                   |  6 +-
 skywalking/plugins/sw_rabbitmq.py                  | 16 ++---
 skywalking/plugins/sw_redis.py                     | 12 ++--
 skywalking/plugins/sw_requests.py                  |  8 +--
 skywalking/plugins/sw_sanic.py                     | 18 ++---
 skywalking/plugins/sw_tornado.py                   | 14 ++--
 skywalking/plugins/sw_urllib3.py                   |  8 +--
 skywalking/plugins/sw_urllib_request.py            |  8 +--
 skywalking/profile/profile_context.py              | 10 +--
 skywalking/profile/profile_service.py              | 61 +++++++++--------
 skywalking/profile/profile_task.py                 |  4 +-
 skywalking/trace/carrier.py                        | 10 +--
 skywalking/trace/segment.py                        |  3 +-
 skywalking/utils/array.py                          |  6 +-
 skywalking/utils/filter.py                         |  2 +-
 skywalking/utils/lang.py                           |  8 +--
 tests/orchestrator.py                              |  4 +-
 tests/plugin/conftest.py                           |  5 +-
 .../data/sw_elasticsearch/services/consumer.py     | 10 +--
 tests/plugin/data/sw_kafka/services/consumer.py    |  8 +--
 tests/plugin/data/sw_kafka/services/producer.py    |  4 +-
 tests/plugin/data/sw_psycopg/services/consumer.py  |  4 +-
 tests/plugin/data/sw_psycopg/services/provider.py  |  8 +--
 tests/plugin/data/sw_psycopg2/services/consumer.py |  4 +-
 tests/plugin/data/sw_psycopg2/services/provider.py |  8 +--
 tests/plugin/data/sw_pymongo/services/consumer.py  |  8 +--
 tests/plugin/data/sw_pymongo/services/provider.py  | 22 +++---
 tests/plugin/data/sw_pymysql/services/consumer.py  |  4 +-
 tests/plugin/data/sw_pymysql/services/provider.py  |  8 +--
 tests/plugin/data/sw_rabbitmq/services/consumer.py |  8 +--
 tests/plugin/data/sw_rabbitmq/services/producer.py | 12 ++--
 tests/plugin/data/sw_redis/services/consumer.py    |  4 +-
 tests/plugin/data/sw_redis/services/provider.py    |  4 +-
 tests/plugin/http/sw_aiohttp/services/consumer.py  |  2 +-
 tests/plugin/http/sw_aiohttp/services/provider.py  |  2 +-
 tests/plugin/http/sw_http/services/consumer.py     |  4 +-
 tests/plugin/http/sw_http/services/provider.py     |  2 +-
 .../plugin/http/sw_http_wsgi/services/consumer.py  |  4 +-
 .../plugin/http/sw_http_wsgi/services/provider.py  |  2 +-
 tests/plugin/http/sw_requests/services/consumer.py |  6 +-
 tests/plugin/http/sw_requests/services/provider.py |  2 +-
 tests/plugin/http/sw_urllib3/services/consumer.py  |  4 +-
 tests/plugin/http/sw_urllib3/services/provider.py  |  4 +-
 tests/plugin/web/sw_django/services/consumer.py    |  4 +-
 tests/plugin/web/sw_django/services/provider.py    |  6 +-
 tests/plugin/web/sw_falcon/services/consumer.py    |  2 +-
 tests/plugin/web/sw_flask/services/consumer.py     | 10 +--
 tests/plugin/web/sw_flask/services/provider.py     |  4 +-
 tests/plugin/web/sw_sanic/services/consumer.py     |  4 +-
 tests/plugin/web/sw_sanic/services/provider.py     |  4 +-
 tests/plugin/web/sw_tornado/services/consumer.py   |  6 +-
 tests/plugin/web/sw_tornado/services/provider.py   |  4 +-
 tests/unit/test_ant_matcher.py                     | 60 ++++++++--------
 tests/unit/test_version_check.py                   | 79 +++++++++++-----------
 tools/check-license-header.py                      |  4 +-
 tools/codegen.py                                   |  8 +--
 tools/doc/plugin_doc_gen.py                        | 18 ++---
 96 files changed, 696 insertions(+), 641 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 63461a5..817a1e4 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -35,4 +35,6 @@ github:
         strict: true
         contexts:
           - CheckStatus
-
+      required_pull_request_reviews:
+        dismiss_stale_reviews: true
+        required_approving_review_count: 1
diff --git a/.flake8 b/.flake8
index c0a1452..97bd339 100644
--- a/.flake8
+++ b/.flake8
@@ -17,6 +17,7 @@
 [flake8]
 # careful with E303, which may cause too many blank lines in pycharm formatted code
 ignore = E501, E126, W503
+extend-ignore = FS003
 max-line-length = 120
 max-complexity = 20
 exclude = venv*,*egg_info,protocol
diff --git a/Makefile b/Makefile
index c62dd3d..8ee600b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,12 +29,13 @@ gen:
 	python3 -m grpc_tools.protoc --version || python3 -m pip install grpcio-tools
 	python3 tools/codegen.py
 
+# flake8 configurations should go to the file .flake8
 lint: clean
-	flake8 --version || python3 -m pip install flake8
+	flake8 --version || python3 -m pip install flake8 flake8-quotes flake8-use-fstring
 	flake8 .
 
 dev-check:
-	flake8 --version || python3 -m pip install flake8
+	flake8 --version || python3 -m pip install flake8 flake8-quotes flake8-use-fstring
 	flake8 .
 
 license: clean
diff --git a/docs/en/contribution/CodingStyle.md b/docs/en/contribution/CodingStyle.md
new file mode 100644
index 0000000..076fc5c
--- /dev/null
+++ b/docs/en/contribution/CodingStyle.md
@@ -0,0 +1,36 @@
+# Coding Style for SkyWalking Python
+
+## String formatting
+
+Since Python 3.5 is end of life, we fully utilize the clarity and performance boost brought by [f-strings](https://docs.python.org/3/reference/lexical_analysis.html#f-strings).
+Please do not use other styles - `+`, `%` or `.format` unless f-string is absolutely unfeasible in the context, or
+it is a logger message, which is [optimized](https://docs.python.org/3/howto/logging.html#optimization) for the `%` style
+
+Run [flynt](https://github.com/ikamensh/flynt) to convert other formats to f-string, pay **extra care** to possible corner 
+cases leading to a semantically different conversion.
+
+### Quotes 
+
+As we know both single quotes and double quotes are both acceptable in Python. 
+For a better coding style, we enforce a check for using single quotes when possible.
+
+Please only use double quotes on the outside when there are inevitable single quotes inside the string, or when there
+are nest quotes.
+
+For example - 
+```python
+foo = f"I'm a string"
+bar = f"This repo is called 'skywalking-python'"
+```
+
+Run [unify](https://github.com/myint/unify) `unify -r your_target --in-place` to fix your quotes if flake8 complaints about it.
+
+## Debug messages
+Please import the `logger_debug_enabled` variable and wrap your debug messages with a check.
+
+This should be done for all performance critical components.
+
+```python
+if logger_debug_enabled:
+    logger.debug('Message - %s', some_func())
+```
\ No newline at end of file
diff --git a/docs/en/contribution/PluginTest.md b/docs/en/contribution/PluginTest.md
index 540c9a2..934b814 100644
--- a/docs/en/contribution/PluginTest.md
+++ b/docs/en/contribution/PluginTest.md
@@ -32,11 +32,11 @@ they match. This can be done through the `/dataValidate` of the mock collector,
 If we want to test the plugin for the built-in library `http`, we will:
 
 1. Build a tested service, which sets up an HTTP server by `http` library, and exposes an HTTP endpoint to be triggered in the test codes, say `/trigger`, 
-take this [provider service](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/services/provider.py) as example.
+take this [provider service](https://github.com/apache/skywalking-python/blob/master/tests/plugin/http/sw_http/services/provider.py) as example.
 2. Compose a `docker-compose.yml` file, orchestrating the service built in step 1 and the mock collector, 
-take this [docker-compose.yml](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/docker-compose.yml) as an example.
+take this [docker-compose.yml](https://github.com/apache/skywalking-python/blob/master/tests/plugin/http/sw_http/docker-compose.yml) as an example.
 3. Write test codes to trigger the endpoint in step 1, and send the expected data file to the mock collector to verify, 
-take this [test](https://github.com/apache/skywalking-python/blob/master/tests/plugin/sw_http/test_http.py) as example.
+take this [test](https://github.com/apache/skywalking-python/blob/master/tests/plugin/http/sw_http/test_http.py) as example.
 
 ## Notes
 
diff --git a/docs/menu.yml b/docs/menu.yml
index d3252ec..c6087a6 100644
--- a/docs/menu.yml
+++ b/docs/menu.yml
@@ -50,6 +50,8 @@ catalog:
     catalog:
       - name: "Developer Guidance"
         path: "/en/contribution/Developer"
+      - name: "Developer Coding Style"
+        path: "/en/contribution/CodingStyle"
       - name: "Plugin Testing Guidance"
         path: "/en/contribution/PluginTest"
       - name: "Release Guidance"
diff --git a/requirements.txt b/requirements.txt
index daa7800..3c54cbf 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,6 @@
 pytest
+unify
+flynt
 grpcio_tools==1.41.0
 wrapt==1.13.2
 requests==2.26.0
diff --git a/setup.py b/setup.py
index 22544ac..8132709 100644
--- a/setup.py
+++ b/setup.py
@@ -21,58 +21,58 @@ from setuptools import setup, find_packages
 
 HERE = pathlib.Path(__file__).parent
 
-README = (HERE / "README.md").read_text()
+README = (HERE / 'README.md').read_text()
 
 setup(
-    name="apache-skywalking",
-    version="0.7.0",
-    description="Python Agent for Apache SkyWalking",
+    name='apache-skywalking',
+    version='0.7.0',
+    description='Python Agent for Apache SkyWalking',
     long_description=README,
-    long_description_content_type="text/markdown",
-    url="https://github.com/apache/skywalking-python/",
-    author="Apache",
-    author_email="dev@skywalking.apache.org",
-    license="Apache 2.0",
-    packages=find_packages(exclude=("tests", "tests.*")),
+    long_description_content_type='text/markdown',
+    url='https://github.com/apache/skywalking-python/',
+    author='Apache',
+    author_email='dev@skywalking.apache.org',
+    license='Apache 2.0',
+    packages=find_packages(exclude=('tests', 'tests.*')),
     include_package_data=True,
     install_requires=[
-        "grpcio",
-        "grpcio-tools",
-        "packaging",
-        "wrapt",
+        'grpcio',
+        'grpcio-tools',
+        'packaging',
+        'wrapt',
     ],
     extras_require={
-        "test": [
-            "testcontainers",
-            "pyyaml",
-            "pytest",
+        'test': [
+            'testcontainers',
+            'pyyaml',
+            'pytest',
         ],
-        "http": [
-            "requests>=2.26.0",
+        'http': [
+            'requests>=2.26.0',
         ],
-        "kafka": [
-            "kafka",
+        'kafka': [
+            'kafka',
         ],
     },
     classifiers=[
-        "Framework :: Flake8",
+        'Framework :: Flake8',
 
-        "License :: OSI Approved :: Apache Software License",
+        'License :: OSI Approved :: Apache Software License',
 
-        "Operating System :: OS Independent",
+        'Operating System :: OS Independent',
 
-        "Programming Language :: Python",
-        "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.6",
-        "Programming Language :: Python :: 3.7",
-        "Programming Language :: Python :: 3.8",
-        "Programming Language :: Python :: 3.9",
-        "Programming Language :: Python :: 3.10",
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
 
-        "Topic :: Software Development",
+        'Topic :: Software Development',
     ],
     entry_points={
-        "console_scripts": [
+        'console_scripts': [
             'sw-python = skywalking.bootstrap.cli.sw_python:start'
         ]
     },
diff --git a/skywalking/agent/__init__.py b/skywalking/agent/__init__.py
index 8a6aa99..580937d 100644
--- a/skywalking/agent/__init__.py
+++ b/skywalking/agent/__init__.py
@@ -25,10 +25,10 @@ from skywalking.protocol.logging.Logging_pb2 import LogData
 
 from skywalking import config, plugins
 from skywalking import loggings
+from skywalking import profile
 from skywalking.agent.protocol import Protocol
 from skywalking.command import command_service
 from skywalking.loggings import logger
-from skywalking import profile
 from skywalking.profile.profile_task import ProfileTask
 from skywalking.profile.snapshot import TracingThreadSnapshot
 
@@ -124,7 +124,7 @@ def __init_threading():
     __finished = Event()
     __heartbeat_thread = Thread(name='HeartbeatThread', target=__heartbeat, daemon=True)
     __report_thread = Thread(name='ReportThread', target=__report, daemon=True)
-    __command_dispatch_thread = Thread(name="CommandDispatchThread", target=__command_dispatch, daemon=True)
+    __command_dispatch_thread = Thread(name='CommandDispatchThread', target=__command_dispatch, daemon=True)
 
     __heartbeat_thread.start()
     __report_thread.start()
@@ -153,7 +153,7 @@ def __init():
     elif config.protocol == 'http':
         from skywalking.agent.protocol.http import HttpProtocol
         __protocol = HttpProtocol()
-    elif config.protocol == "kafka":
+    elif config.protocol == 'kafka':
         from skywalking.agent.protocol.kafka import KafkaProtocol
         __protocol = KafkaProtocol()
 
@@ -182,7 +182,7 @@ def __fini():
 
 def __fork_before():
     if config.protocol != 'http':
-        logger.warning('fork() not currently supported with %s protocol' % config.protocol)
+        logger.warning(f'fork() not currently supported with {config.protocol} protocol')
 
     # TODO: handle __queue and __finished correctly (locks, mutexes, etc...), need to lock before fork and unlock after
     # if possible, or ensure they are not locked in threads (end threads and restart after fork?)
@@ -208,7 +208,7 @@ def start():
     flag = False
     try:
         from gevent import monkey
-        flag = monkey.is_module_patched("socket")
+        flag = monkey.is_module_patched('socket')
     except ModuleNotFoundError:
         logger.debug("it was found that no gevent was used, if you don't use, please ignore.")
     if flag:
@@ -266,4 +266,4 @@ def notify_profile_finish(task: ProfileTask):
     try:
         __protocol.notify_profile_task_finish(task)
     except Exception as e:
-        logger.error("notify profile task finish to backend fail. " + str(e))
+        logger.error(f'notify profile task finish to backend fail. {str(e)}')
diff --git a/skywalking/agent/protocol/grpc.py b/skywalking/agent/protocol/grpc.py
index 69c0ebb..d15e62a 100644
--- a/skywalking/agent/protocol/grpc.py
+++ b/skywalking/agent/protocol/grpc.py
@@ -21,20 +21,20 @@ from queue import Queue, Empty
 from time import time
 
 import grpc
-from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
-from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
-from skywalking.protocol.logging.Logging_pb2 import LogData
-from skywalking.protocol.profile.Profile_pb2 import ThreadSnapshot, ThreadStack
 
 from skywalking import config
 from skywalking.agent import Protocol
 from skywalking.agent.protocol.interceptors import header_adder_interceptor
 from skywalking.client.grpc import GrpcServiceManagementClient, GrpcTraceSegmentReportService, \
     GrpcProfileTaskChannelService, GrpcLogDataReportService
-from skywalking.loggings import logger
-from skywalking.trace.segment import Segment
-from skywalking.profile.snapshot import TracingThreadSnapshot
+from skywalking.loggings import logger, logger_debug_enabled
 from skywalking.profile.profile_task import ProfileTask
+from skywalking.profile.snapshot import TracingThreadSnapshot
+from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
+from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
+from skywalking.protocol.logging.Logging_pb2 import LogData
+from skywalking.protocol.profile.Profile_pb2 import ThreadSnapshot, ThreadStack
+from skywalking.trace.segment import Segment
 
 
 class GrpcProtocol(Protocol):
@@ -59,11 +59,13 @@ class GrpcProtocol(Protocol):
         self.log_reporter = GrpcLogDataReportService(self.channel)
 
     def _cb(self, state):
-        logger.debug('grpc channel connectivity changed, [%s -> %s]', self.state, state)
+        if logger_debug_enabled:
+            logger.debug('grpc channel connectivity changed, [%s -> %s]', self.state, state)
         self.state = state
 
     def query_profile_commands(self):
-        logger.debug("query profile commands")
+        if logger_debug_enabled:
+            logger.debug('query profile commands')
         self.profile_channel.do_query()
 
     def notify_profile_task_finish(self, task: ProfileTask):
@@ -107,7 +109,8 @@ class GrpcProtocol(Protocol):
 
                 queue.task_done()
 
-                logger.debug('reporting segment %s', segment)
+                if logger_debug_enabled:
+                    logger.debug('reporting segment %s', segment)
 
                 s = SegmentObject(
                     traceId=str(segment.related_traces[0]),
@@ -134,7 +137,7 @@ class GrpcProtocol(Protocol):
                             value=str(tag.val),
                         ) for tag in span.iter_tags()],
                         refs=[SegmentReference(
-                            refType=0 if ref.ref_type == "CrossProcess" else 1,
+                            refType=0 if ref.ref_type == 'CrossProcess' else 1,
                             traceId=ref.trace_id,
                             parentTraceSegmentId=ref.segment_id,
                             parentSpanId=ref.span_id,
@@ -175,7 +178,8 @@ class GrpcProtocol(Protocol):
 
                 queue.task_done()
 
-                logger.debug('Reporting Log')
+                if logger_debug_enabled:
+                    logger.debug('Reporting Log')
 
                 yield log_data
 
diff --git a/skywalking/agent/protocol/http.py b/skywalking/agent/protocol/http.py
index 943c6f7..7b4235b 100644
--- a/skywalking/agent/protocol/http.py
+++ b/skywalking/agent/protocol/http.py
@@ -21,7 +21,7 @@ from time import time
 from skywalking import config
 from skywalking.agent import Protocol
 from skywalking.client.http import HttpServiceManagementClient, HttpTraceSegmentReportService, HttpLogDataReportService
-from skywalking.loggings import logger
+from skywalking.loggings import logger, logger_debug_enabled
 from skywalking.protocol.logging.Logging_pb2 import LogData
 from skywalking.trace.segment import Segment
 
@@ -64,7 +64,8 @@ class HttpProtocol(Protocol):
 
                 queue.task_done()
 
-                logger.debug('reporting segment %s', segment)
+                if logger_debug_enabled:
+                    logger.debug('reporting segment %s', segment)
 
                 yield segment
 
@@ -92,8 +93,8 @@ class HttpProtocol(Protocol):
                 except Empty:
                     return
                 queue.task_done()
-
-                logger.debug('Reporting Log')
+                if logger_debug_enabled:
+                    logger.debug('Reporting Log')
 
                 yield log_data
 
diff --git a/skywalking/agent/protocol/kafka.py b/skywalking/agent/protocol/kafka.py
index d7ebca1..dc2c2d2 100644
--- a/skywalking/agent/protocol/kafka.py
+++ b/skywalking/agent/protocol/kafka.py
@@ -19,15 +19,14 @@ import logging
 from queue import Queue, Empty
 from time import time
 
-from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
-from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
-from skywalking.protocol.logging.Logging_pb2 import LogData
-
 from skywalking import config
 from skywalking.agent import Protocol
 from skywalking.client.kafka import KafkaServiceManagementClient, KafkaTraceSegmentReportService, \
     KafkaLogDataReportService
-from skywalking.loggings import logger, getLogger
+from skywalking.loggings import logger, getLogger, logger_debug_enabled
+from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
+from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
+from skywalking.protocol.logging.Logging_pb2 import LogData
 from skywalking.trace.segment import Segment
 
 # avoid too many kafka logs
@@ -64,8 +63,8 @@ class KafkaProtocol(Protocol):
                     return
 
                 queue.task_done()
-
-                logger.debug('reporting segment %s', segment)
+                if logger_debug_enabled:
+                    logger.debug('reporting segment %s', segment)
 
                 s = SegmentObject(
                     traceId=str(segment.related_traces[0]),
@@ -92,7 +91,7 @@ class KafkaProtocol(Protocol):
                             value=str(tag.val),
                         ) for tag in span.iter_tags()],
                         refs=[SegmentReference(
-                            refType=0 if ref.ref_type == "CrossProcess" else 1,
+                            refType=0 if ref.ref_type == 'CrossProcess' else 1,
                             traceId=ref.trace_id,
                             parentTraceSegmentId=ref.segment_id,
                             parentSpanId=ref.span_id,
@@ -128,7 +127,8 @@ class KafkaProtocol(Protocol):
                     return
                 queue.task_done()
 
-                logger.debug('Reporting Log')
+                if logger_debug_enabled:
+                    logger.debug('Reporting Log')
 
                 yield log_data
 
diff --git a/skywalking/bootstrap/cli/sw_python.py b/skywalking/bootstrap/cli/sw_python.py
index 77fc44c..88c3b1f 100644
--- a/skywalking/bootstrap/cli/sw_python.py
+++ b/skywalking/bootstrap/cli/sw_python.py
@@ -53,17 +53,16 @@ def start() -> None:
 
     cli_logger.setLevel(logging.DEBUG if args.debug else logging.INFO)
 
-    cli_logger.debug("Args received {}".format(args))
+    cli_logger.debug(f'Args received {args}')
 
     if not args.command:
-        cli_logger.error("Command is not provided, please type `sw-python -h` for the list of command line arguments")
+        cli_logger.error('Command is not provided, please type `sw-python -h` for the list of command line arguments')
         return
     try:
         dispatch(args)
     except SWRunnerFailure:
-        cli_logger.debug('Failed to run the given user application command `{}`, '
-                         'please make sure given command is valid.'.
-                         format(' '.join(args.command)))
+        cli_logger.error(f"Failed to run the given user application command `{' '.join(args.command)}`, "
+                         f'please make sure given command is valid.')
         return
 
 
@@ -71,8 +70,7 @@ def dispatch(args: argparse.Namespace) -> None:
     """ Dispatches parsed args to a worker """
     cli_option, actual_command = args.option, args.command
 
-    cli_logger.debug("SkyWalking Python agent with CLI option '{}' and command {}".format
-                     (cli_option, actual_command))
+    cli_logger.debug(f"SkyWalking Python agent with CLI option '{cli_option}' and command {actual_command}")
 
     # Dispatch actual user application command to runner
     _options[cli_option].execute(actual_command)
diff --git a/skywalking/bootstrap/cli/utility/runner.py b/skywalking/bootstrap/cli/utility/runner.py
index 451e2bd..d9330b8 100644
--- a/skywalking/bootstrap/cli/utility/runner.py
+++ b/skywalking/bootstrap/cli/utility/runner.py
@@ -29,14 +29,14 @@ from skywalking.bootstrap.cli import SWRunnerFailure
 def execute(command: List[str]) -> None:
     """ Set up environ and invokes the given command to replace current process """
 
-    cli_logger.debug("SkyWalking Python agent `runner` received command {}".format(command))
+    cli_logger.debug(f'SkyWalking Python agent `runner` received command {command}')
 
-    cli_logger.debug("Adding sitecustomize.py to PYTHONPATH")
+    cli_logger.debug('Adding sitecustomize.py to PYTHONPATH')
 
     from skywalking.bootstrap.loader import __file__ as loader_dir
 
     loader_path = os.path.dirname(loader_dir)
-    new_path = ""
+    new_path = ''
 
     python_path = os.environ.get('PYTHONPATH')
     if python_path:  # If there is already a different PYTHONPATH, PREPEND to it as we must get loaded first.
@@ -47,7 +47,7 @@ def execute(command: List[str]) -> None:
     # When constructing sys.path PYTHONPATH is always
     # before other paths and after interpreter invoker path, which is here or none
     os.environ['PYTHONPATH'] = new_path if new_path else loader_path
-    cli_logger.debug("Updated PYTHONPATH - {}".format(os.environ['PYTHONPATH']))
+    cli_logger.debug(f"Updated PYTHONPATH - {os.environ['PYTHONPATH']}")
 
     # Used in sitecustomize to compare command's Python installation with CLI
     # If not match, need to stop agent from loading, and kill the process
@@ -58,7 +58,7 @@ def execute(command: List[str]) -> None:
     os.environ['SW_PYTHON_CLI_DEBUG_ENABLED'] = 'True' if cli_logger.level == logging.DEBUG else 'False'
 
     try:
-        cli_logger.debug('New process starting with file - `{}` args - `{}`'.format(command[0], command))
+        cli_logger.debug(f'New process starting with file - `{command[0]}` args - `{command}`')
         os.execvp(command[0], command)
     except OSError:
         raise SWRunnerFailure
diff --git a/skywalking/bootstrap/loader/sitecustomize.py b/skywalking/bootstrap/loader/sitecustomize.py
index 1bd8aeb..a2a1f9d 100644
--- a/skywalking/bootstrap/loader/sitecustomize.py
+++ b/skywalking/bootstrap/loader/sitecustomize.py
@@ -51,18 +51,18 @@ def _get_sw_loader_logger():
 
 
 _sw_loader_logger = _get_sw_loader_logger()
-
+_sw_loader_logger_debug_enabled = _sw_loader_logger.isEnabledFor(logging.DEBUG)
 # DEBUG messages in case execution goes wrong
-_sw_loader_logger.debug('---------------sitecustomize.py---------------')
-_sw_loader_logger.debug("Successfully imported sitecustomize.py from `{}`".format(__file__))
-_sw_loader_logger.debug('You are inside working dir - {}'.format(os.getcwd()))
-_sw_loader_logger.debug('Using Python version - {} '.format(sys.version))
-_sw_loader_logger.debug('Using executable at - {}'.format(sys.executable))
-_sw_loader_logger.debug('System Base Python executable location {}'.format(sys.base_prefix))
+if _sw_loader_logger_debug_enabled:
+    _sw_loader_logger.debug('---------------sitecustomize.py---------------')
+    _sw_loader_logger.debug(f'Successfully imported sitecustomize.py from `{__file__}`')
+    _sw_loader_logger.debug(f'You are inside working dir - {os.getcwd()}')
+    _sw_loader_logger.debug(f'Using Python version - {sys.version} ')
+    _sw_loader_logger.debug(f'Using executable at - {sys.executable}')
+    _sw_loader_logger.debug(f'System Base Python executable location {sys.base_prefix}')
 
 if sys.prefix != sys.base_prefix:
-    _sw_loader_logger.debug("[The SkyWalking agent bootstrapper is running inside a virtual environment]")
-
+    _sw_loader_logger.debug('[The SkyWalking agent bootstrapper is running inside a virtual environment]')
 
 # It is possible that someone else also has a sitecustomize.py
 # in sys.path either set by .pth files or manually, we need to run them as well
@@ -76,13 +76,12 @@ loaded = sys.modules.pop('sitecustomize', None)  # pop sitecustomize from loaded
 # now try to find the original sitecustomize provided in user env
 try:
     loaded = importlib.import_module('sitecustomie')
-    _sw_loader_logger.debug("Found user sitecustomize file {}, imported".format(loaded))
+    _sw_loader_logger.debug(f'Found user sitecustomize file {loaded}, imported')
 except ImportError:  # ModuleNotFoundError
-    _sw_loader_logger.debug("Original sitecustomize module not found, skipping.")
+    _sw_loader_logger.debug('Original sitecustomize module not found, skipping.')
 finally:  # surprise the import error by adding loaded back
     sys.modules['sitecustomize'] = loaded
 
-
 # This sitecustomize by default doesn't remove the loader dir from PYTHONPATH,
 # Thus, subprocesses and multiprocessing also inherits this sitecustomize.py
 # This behavior can be turned off using a user provided env below
@@ -94,9 +93,8 @@ if os.environ.get('SW_PYTHON_BOOTSTRAP_PROPAGATE') == 'False':
         loader_path = os.path.dirname(__file__)
         if loader_path in partitioned:  # check if we are already removed by a third-party
             partitioned.remove(loader_path)
-            os.environ["PYTHONPATH"] = os.path.pathsep.join(partitioned)
-            _sw_loader_logger.debug("Removed loader from PYTHONPATH, spawned process will not have agent enabled")
-
+            os.environ['PYTHONPATH'] = os.path.pathsep.join(partitioned)
+            _sw_loader_logger.debug('Removed loader from PYTHONPATH, spawned process will not have agent enabled')
 
 # Note that users could be misusing the CLI to call a Python program that
 # their Python env doesn't have SkyWalking installed. Or even call another
@@ -115,19 +113,17 @@ prefix_match = cli_python_prefix.lower() == os.path.realpath(os.path.normpath(sy
 if not (version_match and prefix_match):
 
     _sw_loader_logger.error(
-        "\nPython used by sw-python CLI - v{} at {}\n"
-        "Python used by your actual program - v{} at {}".format(
-            cli_python_version, cli_python_prefix, platform.python_version(),
-            os.path.realpath(os.path.normpath(sys.prefix))
-        )
+        f'\nPython used by sw-python CLI - v{cli_python_version} at {cli_python_prefix}\n'
+        f'Python used by your actual program - v{platform.python_version()} '
+        f'at {os.path.realpath(os.path.normpath(sys.prefix))}'
     )
-    _sw_loader_logger.error("The sw-python CLI was instructed to run a program "
-                            "using an different Python installation "
-                            "this is not safe and loader will not proceed. "
-                            "Please make sure that sw-python cli, skywalking agent and your "
-                            "application are using the same Python installation, "
-                            "Rerun with debug flag, `sw-python -d run yourapp` for some troubleshooting information."
-                            "use `which sw-python` to find out the invoked CLI location")
+    _sw_loader_logger.error('The sw-python CLI was instructed to run a program '
+                            'using an different Python installation '
+                            'this is not safe and loader will not proceed. '
+                            'Please make sure that sw-python cli, skywalking agent and your '
+                            'application are using the same Python installation, '
+                            'Rerun with debug flag, `sw-python -d run yourapp` for some troubleshooting information.'
+                            'use `which sw-python` to find out the invoked CLI location')
     os._exit(1)  # do not go further
 
 else:
@@ -147,7 +143,7 @@ else:
 
     # noinspection PyBroadException
     try:
-        _sw_loader_logger.debug("SkyWalking Python Agent starting, loader finished.")
+        _sw_loader_logger.debug('SkyWalking Python Agent starting, loader finished.')
         agent.start()
     except Exception:
-        _sw_loader_logger.error("SkyWalking Python Agent failed to start, please inspect your package installation")
+        _sw_loader_logger.error('SkyWalking Python Agent failed to start, please inspect your package installation')
diff --git a/skywalking/client/grpc.py b/skywalking/client/grpc.py
index 5ffc24a..aa3c78a 100644
--- a/skywalking/client/grpc.py
+++ b/skywalking/client/grpc.py
@@ -16,21 +16,21 @@
 #
 
 import grpc
-from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
-from skywalking.protocol.language_agent.Tracing_pb2_grpc import TraceSegmentReportServiceStub
-from skywalking.protocol.profile.Profile_pb2_grpc import ProfileTaskStub
-from skywalking.protocol.profile.Profile_pb2 import ProfileTaskCommandQuery, ProfileTaskFinishReport
-from skywalking.protocol.logging.Logging_pb2_grpc import LogReportServiceStub
-from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties
-from skywalking.protocol.management.Management_pb2_grpc import ManagementServiceStub
 
 from skywalking import config
 from skywalking.client import ServiceManagementClient, TraceSegmentReportService, ProfileTaskChannelService, \
     LogDataReportService
 from skywalking.command import command_service
-from skywalking.loggings import logger
+from skywalking.loggings import logger, logger_debug_enabled
 from skywalking.profile import profile_task_execution_service
 from skywalking.profile.profile_task import ProfileTask
+from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
+from skywalking.protocol.language_agent.Tracing_pb2_grpc import TraceSegmentReportServiceStub
+from skywalking.protocol.logging.Logging_pb2_grpc import LogReportServiceStub
+from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties
+from skywalking.protocol.management.Management_pb2_grpc import ManagementServiceStub
+from skywalking.protocol.profile.Profile_pb2 import ProfileTaskCommandQuery, ProfileTaskFinishReport
+from skywalking.protocol.profile.Profile_pb2_grpc import ProfileTaskStub
 
 
 class GrpcServiceManagementClient(ServiceManagementClient):
@@ -45,11 +45,12 @@ class GrpcServiceManagementClient(ServiceManagementClient):
         ))
 
     def send_heart_beat(self):
-        logger.debug(
-            'service heart beats, [%s], [%s]',
-            config.service_name,
-            config.service_instance,
-        )
+        if logger_debug_enabled:
+            logger.debug(
+                'service heart beats, [%s], [%s]',
+                config.service_name,
+                config.service_instance,
+            )
         self.service_stub.keepAlive(InstancePingPkg(
             service=config.service_name,
             serviceInstance=config.service_instance,
@@ -77,7 +78,6 @@ class GrpcProfileTaskChannelService(ProfileTaskChannelService):
         self.profile_stub = ProfileTaskStub(channel)
 
     def do_query(self):
-
         query = ProfileTaskCommandQuery(
             service=config.service_name,
             serviceInstance=config.service_instance,
diff --git a/skywalking/client/http.py b/skywalking/client/http.py
index 153eba1..89589e2 100644
--- a/skywalking/client/http.py
+++ b/skywalking/client/http.py
@@ -21,14 +21,14 @@ from google.protobuf import json_format
 
 from skywalking import config
 from skywalking.client import ServiceManagementClient, TraceSegmentReportService, LogDataReportService
-from skywalking.loggings import logger
+from skywalking.loggings import logger, logger_debug_enabled
 
 
 class HttpServiceManagementClient(ServiceManagementClient):
     def __init__(self):
         proto = 'https://' if config.force_tls else 'http://'
-        self.url_instance_props = proto + config.collector_address.rstrip('/') + '/v3/management/reportProperties'
-        self.url_heart_beat = proto + config.collector_address.rstrip('/') + '/v3/management/keepAlive'
+        self.url_instance_props = f"{proto}{config.collector_address.rstrip('/')}/v3/management/reportProperties"
+        self.url_heart_beat = f"{proto}{config.collector_address.rstrip('/')}/v3/management/keepAlive"
         self.session = requests.Session()
 
     def fork_after_in_child(self):
@@ -43,25 +43,28 @@ class HttpServiceManagementClient(ServiceManagementClient):
                 'language': 'Python',
             }]
         })
-        logger.debug('heartbeat response: %s', res)
+        if logger_debug_enabled:
+            logger.debug('heartbeat response: %s', res)
 
     def send_heart_beat(self):
-        logger.debug(
-            'service heart beats, [%s], [%s]',
-            config.service_name,
-            config.service_instance,
-        )
+        if logger_debug_enabled:
+            logger.debug(
+                'service heart beats, [%s], [%s]',
+                config.service_name,
+                config.service_instance,
+            )
         res = self.session.post(self.url_heart_beat, json={
             'service': config.service_name,
             'serviceInstance': config.service_instance,
         })
-        logger.debug('heartbeat response: %s', res)
+        if logger_debug_enabled:
+            logger.debug('heartbeat response: %s', res)
 
 
 class HttpTraceSegmentReportService(TraceSegmentReportService):
     def __init__(self):
         proto = 'https://' if config.force_tls else 'http://'
-        self.url_report = proto + config.collector_address.rstrip('/') + '/v3/segment'
+        self.url_report = f"{proto}{config.collector_address.rstrip('/')}/v3/segment"
         self.session = requests.Session()
 
     def fork_after_in_child(self):
@@ -109,13 +112,14 @@ class HttpTraceSegmentReportService(TraceSegmentReportService):
                     } for ref in span.refs if ref.trace_id]
                 } for span in segment.spans]
             })
-            logger.debug('report traces response: %s', res)
+            if logger_debug_enabled:
+                logger.debug('report traces response: %s', res)
 
 
 class HttpLogDataReportService(LogDataReportService):
     def __init__(self):
         proto = 'https://' if config.force_tls else 'http://'
-        self.url_report = proto + config.collector_address.rstrip('/') + '/v3/logs'
+        self.url_report = f"{proto}{config.collector_address.rstrip('/')}/v3/logs"
         self.session = requests.Session()
 
     def fork_after_in_child(self):
@@ -126,4 +130,5 @@ class HttpLogDataReportService(LogDataReportService):
         log_batch = [json.loads(json_format.MessageToJson(log_data)) for log_data in generator]
         if log_batch:  # prevent empty batches
             res = self.session.post(self.url_report, json=log_batch)
-            logger.debug('report batch log response: %s', res)
+            if logger_debug_enabled:
+                logger.debug('report batch log response: %s', res)
diff --git a/skywalking/client/kafka.py b/skywalking/client/kafka.py
index bf8e96e..b0c93f0 100644
--- a/skywalking/client/kafka.py
+++ b/skywalking/client/kafka.py
@@ -18,21 +18,21 @@
 import ast
 import os
 
-from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
-from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties
-
 from kafka import KafkaProducer
+
 from skywalking import config
 from skywalking.client import ServiceManagementClient, TraceSegmentReportService, LogDataReportService
-from skywalking.loggings import logger
+from skywalking.loggings import logger, logger_debug_enabled
+from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
+from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties
 
 kafka_configs = {}
 
 
 def __init_kafka_configs():
-    kafka_configs["bootstrap_servers"] = config.kafka_bootstrap_servers.split(",")
+    kafka_configs['bootstrap_servers'] = config.kafka_bootstrap_servers.split(',')
     # process all kafka configs in env
-    kafka_keys = [key for key in os.environ.keys() if key.startswith("SW_KAFKA_REPORTER_CONFIG_")]
+    kafka_keys = [key for key in os.environ.keys() if key.startswith('SW_KAFKA_REPORTER_CONFIG_')]
     for kafka_key in kafka_keys:
         key = kafka_key[25:]
         val = os.environ.get(kafka_key)
@@ -40,7 +40,7 @@ def __init_kafka_configs():
         if val is not None:
             if val.isnumeric():
                 val = int(val)
-            elif val in ["True", "False"]:
+            elif val in ['True', 'False']:
                 val = ast.literal_eval(val)
         else:
             continue
@@ -57,9 +57,10 @@ __init_kafka_configs()
 
 class KafkaServiceManagementClient(ServiceManagementClient):
     def __init__(self):
-        logger.debug("kafka reporter configs: %s", kafka_configs)
+        if logger_debug_enabled:
+            logger.debug('kafka reporter configs: %s', kafka_configs)
         self.producer = KafkaProducer(**kafka_configs)
-        self.topic_key_register = "register-"
+        self.topic_key_register = 'register-'
         self.topic = config.kafka_topic_management
 
         self.send_instance_props()
@@ -76,22 +77,24 @@ class KafkaServiceManagementClient(ServiceManagementClient):
         self.producer.send(topic=self.topic, key=key, value=value)
 
     def send_heart_beat(self):
-        logger.debug(
-            'service heart beats, [%s], [%s]',
-            config.service_name,
-            config.service_instance,
-        )
+        if logger_debug_enabled:
+            logger.debug(
+                'service heart beats, [%s], [%s]',
+                config.service_name,
+                config.service_instance,
+            )
 
         instance_ping_pkg = InstancePingPkg(
             service=config.service_name,
             serviceInstance=config.service_instance,
         )
 
-        key = bytes(instance_ping_pkg.serviceInstance, encoding="utf-8")
+        key = bytes(instance_ping_pkg.serviceInstance, encoding='utf-8')
         value = bytes(instance_ping_pkg.SerializeToString())
         future = self.producer.send(topic=self.topic, key=key, value=value)
         res = future.get(timeout=10)
-        logger.debug('heartbeat response: %s', res)
+        if logger_debug_enabled:
+            logger.debug('heartbeat response: %s', res)
 
 
 class KafkaTraceSegmentReportService(TraceSegmentReportService):
@@ -101,7 +104,7 @@ class KafkaTraceSegmentReportService(TraceSegmentReportService):
 
     def report(self, generator):
         for segment in generator:
-            key = bytes(segment.traceSegmentId, encoding="utf-8")
+            key = bytes(segment.traceSegmentId, encoding='utf-8')
             value = bytes(segment.SerializeToString())
             self.producer.send(topic=self.topic, key=key, value=value)
 
@@ -113,7 +116,7 @@ class KafkaLogDataReportService(LogDataReportService):
 
     def report(self, generator):
         for log_data in generator:
-            key = bytes(log_data.traceContext.traceSegmentId, encoding="utf-8")
+            key = bytes(log_data.traceContext.traceSegmentId, encoding='utf-8')
             value = bytes(log_data.SerializeToString())
             self.producer.send(topic=self.topic, key=key, value=value)
 
diff --git a/skywalking/command/base_command.py b/skywalking/command/base_command.py
index ab76150..d1a83ad 100644
--- a/skywalking/command/base_command.py
+++ b/skywalking/command/base_command.py
@@ -18,7 +18,7 @@
 
 class BaseCommand:
     def __init__(self,
-                 command: str = "",
-                 serial_number: str = ""):
+                 command: str = '',
+                 serial_number: str = ''):
         self.command = command  # type: str
         self.serial_number = serial_number  # type: str
diff --git a/skywalking/command/command_service.py b/skywalking/command/command_service.py
index 8f9244e..384acba 100644
--- a/skywalking/command/command_service.py
+++ b/skywalking/command/command_service.py
@@ -49,19 +49,19 @@ class CommandService:
         for command in commands.commands:
             try:
                 base_command = CommandDeserializer.deserialize(command)
-                logger.debug("received command [{%s} {%s}]", base_command.command, base_command.serial_number)
+                logger.debug('received command [{%s} {%s}]', base_command.command, base_command.serial_number)
 
                 if self.__is_command_executed(base_command):
-                    logger.warning("command[{%s}] is executed, ignored.", base_command.command)
+                    logger.warning('command[{%s}] is executed, ignored.', base_command.command)
                     continue
 
                 try:
                     self._commands.put(base_command)
                 except queue.Full:
-                    logger.warning("command[{%s}, {%s}] cannot add to command list. because the command list is full.",
+                    logger.warning('command[{%s}, {%s}] cannot add to command list. because the command list is full.',
                                    base_command.command, base_command.serial_number)
             except UnsupportedCommandException as e:
-                logger.warning("received unsupported command[{%s}].", e.command.command)
+                logger.warning('received unsupported command[{%s}].', e.command.command)
 
 
 class CommandSerialNumberCache:
diff --git a/skywalking/command/profile_task_command.py b/skywalking/command/profile_task_command.py
index 88607a0..9808a64 100644
--- a/skywalking/command/profile_task_command.py
+++ b/skywalking/command/profile_task_command.py
@@ -23,12 +23,12 @@ from skywalking.utils.lang import tostring
 
 @tostring
 class ProfileTaskCommand(BaseCommand):
-    NAME = "ProfileTaskQuery"
+    NAME = 'ProfileTaskQuery'
 
     def __init__(self,
-                 serial_number: str = "",
-                 task_id: str = "",
-                 endpoint_name: str = "",
+                 serial_number: str = '',
+                 task_id: str = '',
+                 endpoint_name: str = '',
                  duration: int = -1,
                  min_duration_threshold: int = -1,
                  dump_period: int = -1,
@@ -60,23 +60,23 @@ class ProfileTaskCommand(BaseCommand):
         create_time = None
 
         for pair in command.args:
-            if pair.key == "SerialNumber":
+            if pair.key == 'SerialNumber':
                 serial_number = pair.value
-            elif pair.key == "EndpointName":
+            elif pair.key == 'EndpointName':
                 endpoint_name = pair.value
-            elif pair.key == "TaskId":
+            elif pair.key == 'TaskId':
                 task_id = pair.value
-            elif pair.key == "Duration":
+            elif pair.key == 'Duration':
                 duration = pair.value
-            elif pair.key == "MinDurationThreshold":
+            elif pair.key == 'MinDurationThreshold':
                 min_duration_threshold = pair.value
-            elif pair.key == "DumpPeriod":
+            elif pair.key == 'DumpPeriod':
                 dump_period = pair.value
-            elif pair.key == "MaxSamplingCount":
+            elif pair.key == 'MaxSamplingCount':
                 max_sampling_count = pair.value
-            elif pair.key == "StartTime":
+            elif pair.key == 'StartTime':
                 start_time = pair.value
-            elif pair.key == "CreateTime":
+            elif pair.key == 'CreateTime':
                 create_time = pair.value
 
         return ProfileTaskCommand(serial_number=serial_number, task_id=task_id,
diff --git a/skywalking/config.py b/skywalking/config.py
index 59865cc..47de026 100644
--- a/skywalking/config.py
+++ b/skywalking/config.py
@@ -59,17 +59,17 @@ correlation_value_max_length = int(os.getenv('SW_CORRELATION_VALUE_MAX_LENGTH')
 trace_ignore_path = os.getenv('SW_TRACE_IGNORE_PATH') or ''  # type: str
 elasticsearch_trace_dsl = True if os.getenv('SW_ELASTICSEARCH_TRACE_DSL') and \
                                   os.getenv('SW_ELASTICSEARCH_TRACE_DSL') == 'True' else False  # type: bool
-kafka_bootstrap_servers = os.getenv('SW_KAFKA_REPORTER_BOOTSTRAP_SERVERS') or "localhost:9092"  # type: str
-kafka_topic_management = os.getenv('SW_KAFKA_REPORTER_TOPIC_MANAGEMENT') or "skywalking-managements"  # type: str
-kafka_topic_segment = os.getenv('SW_KAFKA_REPORTER_TOPIC_SEGMENT') or "skywalking-segments"  # type: str
-kafka_topic_log = os.getenv('SW_KAFKA_REPORTER_TOPIC_LOG') or "skywalking-logs"  # type: str
+kafka_bootstrap_servers = os.getenv('SW_KAFKA_REPORTER_BOOTSTRAP_SERVERS') or 'localhost:9092'  # type: str
+kafka_topic_management = os.getenv('SW_KAFKA_REPORTER_TOPIC_MANAGEMENT') or 'skywalking-managements'  # type: str
+kafka_topic_segment = os.getenv('SW_KAFKA_REPORTER_TOPIC_SEGMENT') or 'skywalking-segments'  # type: str
+kafka_topic_log = os.getenv('SW_KAFKA_REPORTER_TOPIC_LOG') or 'skywalking-logs'  # type: str
 celery_parameters_length = int(os.getenv('SW_CELERY_PARAMETERS_LENGTH') or '512')
 
 # profile configs
 get_profile_task_interval = int(os.getenv('SW_PROFILE_TASK_QUERY_INTERVAL') or '20')  # type: int
 profile_active = False if os.getenv('SW_AGENT_PROFILE_ACTIVE') and \
                           os.getenv('SW_AGENT_PROFILE_ACTIVE') == 'False' else True  # type: bool
-profile_max_parallel = int(os.getenv("SW_AGENT_PROFILE_MAX_PARALLEL") or '5')  # type: int
+profile_max_parallel = int(os.getenv('SW_AGENT_PROFILE_MAX_PARALLEL') or '5')  # type: int
 profile_duration = int(os.getenv('SW_AGENT_PROFILE_DURATION') or '10')  # type: int
 profile_dump_max_stack_depth = int(os.getenv('SW_AGENT_PROFILE_DUMP_MAX_STACK_DEPTH') or '500')  # type: int
 profile_snapshot_transport_buffer_size = int(os.getenv('SW_AGENT_PROFILE_SNAPSHOT_TRANSPORT_BUFFER_SIZE') or '50')
@@ -94,7 +94,7 @@ def init(**kwargs):
 
     for key, val in kwargs.items():
         if key not in options:
-            raise KeyError('invalid config option %s' % key)
+            raise KeyError(f'invalid config option {key}')
 
         glob[key] = val
 
@@ -115,7 +115,7 @@ def finalize():
            ) + ')$'
 
     global RE_IGNORE_PATH, RE_HTTP_IGNORE_METHOD
-    RE_IGNORE_PATH = re.compile('%s|%s' % (suffix, path))
+    RE_IGNORE_PATH = re.compile(f'{suffix}|{path}')
     RE_HTTP_IGNORE_METHOD = re.compile(method, re.IGNORECASE)
 
 
diff --git a/skywalking/decorators.py b/skywalking/decorators.py
index 3db36d3..d9fb211 100644
--- a/skywalking/decorators.py
+++ b/skywalking/decorators.py
@@ -77,7 +77,7 @@ def runnable(
 
         @wraps(func)
         def wrapper(*args, **kwargs):
-            _op = op or "Thread/" + func.__name__
+            _op = op or f'Thread/{func.__name__}'
             context = get_context()
             with context.new_local_span(op=_op) as span:
                 context.continued(snapshot)
diff --git a/skywalking/log/formatter.py b/skywalking/log/formatter.py
index c67df1e..bce71d0 100644
--- a/skywalking/log/formatter.py
+++ b/skywalking/log/formatter.py
@@ -33,6 +33,6 @@ class SWFormatter(logging.Formatter):
         traceback.print_exception(ei[0], ei[1], tb, self.tb_limit, sio)
         s = sio.getvalue()
         sio.close()
-        if s[-1:] == "\n":
+        if s[-1:] == '\n':
             s = s[:-1]
         return s
diff --git a/skywalking/log/sw_logging.py b/skywalking/log/sw_logging.py
index 532b873..44080d3 100644
--- a/skywalking/log/sw_logging.py
+++ b/skywalking/log/sw_logging.py
@@ -17,9 +17,10 @@
 
 import logging
 
-from skywalking import config, agent
 from skywalking.protocol.common.Common_pb2 import KeyStringValuePair
 from skywalking.protocol.logging.Logging_pb2 import LogData, LogDataBody, TraceContext, LogTags, TextLog
+
+from skywalking import config, agent
 from skywalking.trace.context import get_context
 from skywalking.utils.filter import sw_traceback, sw_filter
 
@@ -36,7 +37,7 @@ def install():
     log_reporter_level = logging.getLevelName(config.log_reporter_level)  # type: int
 
     def _sw_handle(self, record):
-        if record.name in ["skywalking", "skywalking-cli", "skywalking-loader"]:  # Ignore SkyWalking internal loggers
+        if record.name in ['skywalking', 'skywalking-cli', 'skywalking-loader']:  # Ignore SkyWalking internal loggers
             return _handle(self, record)
 
         if record.levelno < log_reporter_level:
@@ -58,7 +59,7 @@ def install():
                 return l_tags
 
             for i, arg in enumerate(record.args):
-                l_tags.data.append(KeyStringValuePair(key='argument.' + str(i), value=str(arg)))
+                l_tags.data.append(KeyStringValuePair(key=f'argument.{str(i)}', value=str(arg)))
 
             if record.exc_info:
                 l_tags.data.append(KeyStringValuePair(key='exception',
@@ -95,5 +96,6 @@ def install():
         if config.log_reporter_formatted:
             if layout:
                 return formatter.format(record=record)
-            return record.getMessage() + ('\n' + sw_traceback() if record.exc_info else '')
+            newline = '\n'
+            return f"{record.getMessage()}{f'{newline}{sw_traceback()}' if record.exc_info else ''}"
         return str(record.msg)  # convert possible exception to str
diff --git a/skywalking/loggings.py b/skywalking/loggings.py
index 55289ef..a4ed05f 100644
--- a/skywalking/loggings.py
+++ b/skywalking/loggings.py
@@ -32,6 +32,7 @@ def getLogger(name=None):
 
 
 logger = getLogger('skywalking')
+logger_debug_enabled = logger.isEnabledFor(logging.DEBUG)
 
 
 def init():
diff --git a/skywalking/plugins/__init__.py b/skywalking/plugins/__init__.py
index c62a958..3da7a8d 100644
--- a/skywalking/plugins/__init__.py
+++ b/skywalking/plugins/__init__.py
@@ -38,7 +38,7 @@ def install():
         disable_patterns = [re.compile(p.strip()) for p in disable_patterns if p.strip()]
     for importer, modname, ispkg in pkgutil.iter_modules(skywalking.plugins.__path__):
         if any(pattern.match(modname) for pattern in disable_patterns):
-            logger.info('plugin %s is disabled and thus won\'t be installed', modname)
+            logger.info("plugin %s is disabled and thus won't be installed", modname)
             continue
         logger.debug('installing plugin %s', modname)
         plugin = importer.find_module(modname).load_module(modname)
@@ -46,12 +46,12 @@ def install():
         # todo: refactor the version checker, currently it doesn't really work as intended
         supported = pkg_version_check(plugin)
         if not supported:
-            logger.debug('check version for plugin %s\'s corresponding package failed, thus '
-                         'won\'t be installed', modname)
+            logger.debug("check version for plugin %s's corresponding package failed, thus "
+                         "won't be installed", modname)
             continue
 
         if not hasattr(plugin, 'install') or inspect.ismethod(getattr(plugin, 'install')):
-            logger.warning('no `install` method in plugin %s, thus the plugin won\'t be installed', modname)
+            logger.warning("no `install` method in plugin %s, thus the plugin won't be installed", modname)
             continue
 
         # noinspection PyBroadException
@@ -67,11 +67,11 @@ def pkg_version_check(plugin):
     supported = True
 
     # no version rules was set, no checks
-    if not hasattr(plugin, "version_rule"):
+    if not hasattr(plugin, 'version_rule'):
         return supported
 
-    pkg_name = plugin.version_rule.get("name")
-    rules = plugin.version_rule.get("rules")
+    pkg_name = plugin.version_rule.get('name')
+    rules = plugin.version_rule.get('rules')
 
     try:
         current_pkg_version = pkg_resources.get_distribution(pkg_name).version
@@ -82,12 +82,12 @@ def pkg_version_check(plugin):
     current_version = version.parse(current_pkg_version)
     # pass one rule in rules (OR)
     for rule in rules:
-        if rule.find(" ") == -1:
+        if rule.find(' ') == -1:
             if check(rule, current_version):
                 return supported
         else:
             # have to pass all rule_uint in this rule (AND)
-            rule_units = rule.split(" ")
+            rule_units = rule.split(' ')
             results = [check(unit, current_version) for unit in rule_units]
             if False in results:
                 # check failed, try to check next rule
@@ -107,6 +107,6 @@ def check(rule_unit, current_version):
     expect_version = version.parse(expect_pkg_version)
     f = operators.get(symbol) or None
     if not f:
-        raise VersionRuleException("version rule {} error. only allow >,>=,==,<=,<,!= symbols".format(rule_unit))
+        raise VersionRuleException(f'version rule {rule_unit} error. only allow >,>=,==,<=,<,!= symbols')
 
     return f(current_version, expect_version)
diff --git a/skywalking/plugins/sw_aiohttp.py b/skywalking/plugins/sw_aiohttp.py
index aa110c6..8978ce0 100644
--- a/skywalking/plugins/sw_aiohttp.py
+++ b/skywalking/plugins/sw_aiohttp.py
@@ -21,11 +21,11 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://docs.aiohttp.org"]
+link_vector = ['https://docs.aiohttp.org']
 support_matrix = {
-    "aiohttp": {
-        ">=3.10": [],  # waiting for 3.8 release
-        ">=3.6": ["3.7.4"]
+    'aiohttp': {
+        '>=3.10': [],  # waiting for 3.8 release
+        '>=3.6': ['3.7.4']
     }
 }
 note = """"""
@@ -39,10 +39,10 @@ def install():
 
     async def _sw_request(self: ClientSession, method: str, str_or_url, **kwargs):
         url = URL(str_or_url).with_user(None).with_password(None)
-        peer = '%s:%d' % (url.host or '', url.port)
+        peer = f"{url.host or ''}:{url.port or ''}"
 
         span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
-            else get_context().new_exit_span(op=url.path or "/", peer=peer, component=Component.AioHttp)
+            else get_context().new_exit_span(op=url.path or '/', peer=peer, component=Component.AioHttp)
 
         with span:
             span.layer = Layer.Http
@@ -88,8 +88,11 @@ def install():
         with span:
             span.layer = Layer.Http
             span.component = Component.AioHttp
-            span.peer = '%s:%d' % request._transport_peername if isinstance(request._transport_peername, (list, tuple)) \
-                else request._transport_peername
+            peer_name = request._transport_peername
+            if isinstance(peer_name, (list, tuple)):
+                span.peer = f'{peer_name[0]}:{peer_name[1]}'
+            else:
+                span.peer = f'{peer_name}'
 
             span.tag(TagHttpMethod(method))  # pyre-ignore
             span.tag(TagHttpURL(str(request.url)))  # pyre-ignore
diff --git a/skywalking/plugins/sw_celery.py b/skywalking/plugins/sw_celery.py
index 6778a92..0ce6280 100644
--- a/skywalking/plugins/sw_celery.py
+++ b/skywalking/plugins/sw_celery.py
@@ -20,11 +20,11 @@ from skywalking.trace.carrier import Carrier
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagMqBroker, TagCeleryParameters
 
-link_vector = ["https://docs.celeryproject.org"]
+link_vector = ['https://docs.celeryproject.org']
 # TODO: Celery is missing plugin test
 support_matrix = {
-    "celery": {
-        ">=3.6": ["5.1"]
+    'celery': {
+        '>=3.6': ['5.1']
     }
 }
 note = """The celery server running with "celery -A ..." should be run with the HTTP protocol
@@ -44,11 +44,11 @@ def install():
         # exchange = options['exchange']
         # queue = options['routing_key']
         # op = 'celery/{}/{}/{}'.format(exchange or '', queue or '', name)
-        op = 'celery/' + name
+        op = f'celery/{name}'
 
         if broker_url:
             url = urlparse(broker_url)
-            peer = '{}:{}'.format(url.hostname, url.port)
+            peer = f'{url.hostname}:{url.port}'
         else:
             peer = '???'
 
@@ -60,7 +60,7 @@ def install():
             # span.tag(TagMqQueue(queue))
 
             if config.celery_parameters_length:
-                params = '*{}, **{}'.format(args, kwargs)[:config.celery_parameters_length]
+                params = f'*{args}, **{kwargs}'[:config.celery_parameters_length]
                 span.tag(TagCeleryParameters(params))
 
             options = {**options}
@@ -83,7 +83,7 @@ def install():
             # exchange = di and di.get('exchange')
             # queue = di and di.get('routing_key')
             # op = 'celery/{}/{}/{}'.format(exchange or '', queue or '', name)
-            op = 'celery/' + name
+            op = f'celery/{name}'
             carrier = Carrier()
 
             for item in carrier:
@@ -110,7 +110,7 @@ def install():
                 # span.tag(TagMqQueue(queue))
 
                 if config.celery_parameters_length:
-                    params = '*{}, **{}'.format(args, kwargs)[:config.celery_parameters_length]
+                    params = f'*{args}, **{kwargs}'[:config.celery_parameters_length]
                     span.tag(TagCeleryParameters(params))
 
                 return _fun(*args, **kwargs)
diff --git a/skywalking/plugins/sw_django.py b/skywalking/plugins/sw_django.py
index bb3c282..cc5be60 100644
--- a/skywalking/plugins/sw_django.py
+++ b/skywalking/plugins/sw_django.py
@@ -21,10 +21,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode, TagHttpParams
 
-link_vector = ["https://www.djangoproject.com/"]
+link_vector = ['https://www.djangoproject.com/']
 support_matrix = {
-    "django": {
-        ">=3.6": ["3.2"],
+    'django': {
+        '>=3.6': ['3.2'],
         # ">=3.8": ["4.0a1"]  # expected Dec 2021
     }
 }
@@ -50,7 +50,7 @@ def install():
             # Any HTTP headers in the request are converted to META keys by converting all characters to uppercase,
             # replacing any hyphens with underscores and adding an HTTP_ prefix to the name.
             # https://docs.djangoproject.com/en/3.0/ref/request-response/#django.http.HttpRequest.META
-            sw_http_header_key = 'HTTP_%s' % item.key.upper().replace('-', '_')
+            sw_http_header_key = f"HTTP_{item.key.upper().replace('-', '_')}"
             if sw_http_header_key in request.META:
                 item.val = request.META[sw_http_header_key]
 
@@ -60,10 +60,10 @@ def install():
         with span:
             span.layer = Layer.Http
             span.component = Component.Django
-            span.peer = '%s:%s' % (request.META.get('REMOTE_ADDR'), request.META.get('REMOTE_PORT') or "80")
+            span.peer = f"{request.META.get('REMOTE_ADDR')}:{request.META.get('REMOTE_PORT') or '80'}"
 
             span.tag(TagHttpMethod(method))
-            span.tag(TagHttpURL(request.build_absolute_uri().split("?")[0]))
+            span.tag(TagHttpURL(request.build_absolute_uri().split('?')[0]))
 
             # you can get request parameters by `request.GET` even though client are using POST or other methods
             if config.django_collect_http_params and request.GET:
@@ -88,4 +88,4 @@ def install():
 
 
 def params_tostring(params):
-    return "\n".join([k + '=[' + ",".join(params.getlist(k)) + ']' for k, _ in params.items()])
+    return '\n'.join([f"{k}=[{','.join(params.getlist(k))}]" for k, _ in params.items()])
diff --git a/skywalking/plugins/sw_elasticsearch.py b/skywalking/plugins/sw_elasticsearch.py
index 2711d22..2a065a2 100644
--- a/skywalking/plugins/sw_elasticsearch.py
+++ b/skywalking/plugins/sw_elasticsearch.py
@@ -19,10 +19,10 @@ from skywalking import Layer, Component, config
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbStatement
 
-link_vector = ["https://github.com/elastic/elasticsearch-py"]
+link_vector = ['https://github.com/elastic/elasticsearch-py']
 support_matrix = {
-    "elasticsearch": {
-        ">=3.6": ["7.13", "7.14", "7.15"],
+    'elasticsearch': {
+        '>=3.6': ['7.13', '7.14', '7.15'],
     }
 }
 note = """"""
@@ -34,15 +34,15 @@ def install():
 
     def _sw_perform_request(this: Transport, method, url, headers=None, params=None, body=None):
         context = get_context()
-        peer = ",".join([host["host"] + ":" + str(host["port"]) for host in this.hosts])
-        with context.new_exit_span(op="Elasticsearch/" + method + url, peer=peer,
+        peer = ','.join([f"{host['host']}:{str(host['port'])}" for host in this.hosts])
+        with context.new_exit_span(op=f'Elasticsearch/{method}{url}', peer=peer,
                                    component=Component.Elasticsearch) as span:
             span.layer = Layer.Database
             res = _perform_request(this, method, url, headers=headers, params=params, body=body)
 
-            span.tag(TagDbType("Elasticsearch"))
+            span.tag(TagDbType('Elasticsearch'))
             if config.elasticsearch_trace_dsl:
-                span.tag(TagDbStatement("" if body is None else body))
+                span.tag(TagDbStatement('' if body is None else body))
 
             return res
 
diff --git a/skywalking/plugins/sw_falcon.py b/skywalking/plugins/sw_falcon.py
index 8c1b5e9..98765c1 100644
--- a/skywalking/plugins/sw_falcon.py
+++ b/skywalking/plugins/sw_falcon.py
@@ -21,11 +21,11 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpParams, TagHttpStatusCode, TagHttpStatusMsg
 
-link_vector = ["https://falcon.readthedocs.io/en/stable/"]
+link_vector = ['https://falcon.readthedocs.io/en/stable/']
 support_matrix = {
-    "hug": {
-        ">=3.10": ["2.5", "2.6"],  # api deprecated for 3.10
-        ">=3.6": ["2.4.1", "2.5", "2.6"],  # support begins 2.4.1
+    'hug': {
+        '>=3.10': ['2.5', '2.6'],  # api deprecated for 3.10
+        '>=3.6': ['2.4.1', '2.5', '2.6'],  # support begins 2.4.1
     }
 }
 note = """"""
@@ -60,7 +60,7 @@ def install():
             span.tag(TagHttpURL(str(req.url)))
 
             if req.params:
-                span.tag(TagHttpParams(','.join([k + '=' + v for k, v in req.params.items()])))
+                span.tag(TagHttpParams(','.join([f'{k}={v}' for k, v in req.params.items()])))
 
             def _start_response(resp_status, headers):
                 try:
diff --git a/skywalking/plugins/sw_flask.py b/skywalking/plugins/sw_flask.py
index fe55ac2..1db86fc 100644
--- a/skywalking/plugins/sw_flask.py
+++ b/skywalking/plugins/sw_flask.py
@@ -21,10 +21,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode, TagHttpParams
 
-link_vector = ["https://flask.palletsprojects.com"]
+link_vector = ['https://flask.palletsprojects.com']
 support_matrix = {
-    "flask": {
-        ">=3.6": ["1.1", "2.0"]  # 1.1 to be removed in near future
+    'flask': {
+        '>=3.6': ['1.1', '2.0']  # 1.1 to be removed in near future
     }
 }
 note = """"""
@@ -37,7 +37,7 @@ def install():
     _handle_exception = Flask.handle_exception
 
     def params_tostring(params):
-        return "\n".join([k + '=[' + ",".join(params.getlist(k)) + ']' for k, _ in params.items()])
+        return '\n'.join([f"{k}=[{','.join(params.getlist(k))}]" for k, _ in params.items()])
 
     def _sw_full_dispatch_request(this: Flask):
         import flask
@@ -56,9 +56,9 @@ def install():
         with span:
             span.layer = Layer.Http
             span.component = Component.Flask
-            span.peer = '%s:%s' % (req.environ["REMOTE_ADDR"], req.environ["REMOTE_PORT"])
+            span.peer = f"{req.environ['REMOTE_ADDR']}:{req.environ['REMOTE_PORT']}"
             span.tag(TagHttpMethod(method))
-            span.tag(TagHttpURL(req.url.split("?")[0]))
+            span.tag(TagHttpURL(req.url.split('?')[0]))
             if config.flask_collect_http_params and req.values:
                 span.tag(TagHttpParams(params_tostring(req.values)[0:config.http_params_length_threshold]))
             resp = _full_dispatch_request(this)
diff --git a/skywalking/plugins/sw_http_server.py b/skywalking/plugins/sw_http_server.py
index 899ba95..4783ee8 100644
--- a/skywalking/plugins/sw_http_server.py
+++ b/skywalking/plugins/sw_http_server.py
@@ -23,14 +23,14 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://docs.python.org/3/library/http.server.html",
-               "https://werkzeug.palletsprojects.com/"]
+link_vector = ['https://docs.python.org/3/library/http.server.html',
+               'https://werkzeug.palletsprojects.com/']
 support_matrix = {
-    "http_server": {
-        ">=3.6": ["*"]
+    'http_server': {
+        '>=3.6': ['*']
     },
-    "werkzeug": {
-        ">=3.6": ["1.0.1", "2.0"]
+    'werkzeug': {
+        '>=3.6': ['1.0.1', '2.0']
     }
 }
 note = """"""
@@ -43,7 +43,7 @@ def install():
 
     def _sw_handle(handler: BaseHTTPRequestHandler):
         clazz = handler.__class__
-        if 'werkzeug.serving.WSGIRequestHandler' == ".".join([clazz.__module__, clazz.__name__]):
+        if 'werkzeug.serving.WSGIRequestHandler' == '.'.join([clazz.__module__, clazz.__name__]):
             wrap_werkzeug_request_handler(handler)
         else:
             wrap_default_request_handler(handler)
@@ -75,13 +75,14 @@ def wrap_werkzeug_request_handler(handler):
         path = handler.path or '/'
 
         span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
-            else get_context().new_entry_span(op=path.split("?")[0], carrier=carrier)
+            else get_context().new_entry_span(op=path.split('?')[0], carrier=carrier)
 
         with span:
-            url = 'http://' + handler.headers["Host"] + path if 'Host' in handler.headers else path
+            url = f"http://{handler.headers['Host']}{path}" if 'Host' in handler.headers else path
             span.layer = Layer.Http
             span.component = Component.General
-            span.peer = '%s:%s' % handler.client_address
+            client_address = handler.client_address
+            span.peer = f'{client_address[0]}:{client_address[1]}'
             span.tag(TagHttpMethod(method))
             span.tag(TagHttpURL(url))
 
@@ -116,8 +117,8 @@ def wrap_default_request_handler(handler):
 
 
 def _wrap_do_method(handler, method):
-    if hasattr(handler, 'do_' + method) and inspect.ismethod(getattr(handler, 'do_' + method)):
-        _do_method = getattr(handler, 'do_' + method)
+    if hasattr(handler, f'do_{method}') and inspect.ismethod(getattr(handler, f'do_{method}')):
+        _do_method = getattr(handler, f'do_{method}')
 
         def _sw_do_method():
             carrier = Carrier()
@@ -126,13 +127,14 @@ def _wrap_do_method(handler, method):
             path = handler.path or '/'
 
             span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
-                else get_context().new_entry_span(op=path.split("?")[0], carrier=carrier)
+                else get_context().new_entry_span(op=path.split('?')[0], carrier=carrier)
 
             with span:
-                url = 'http://' + handler.headers["Host"] + path if 'Host' in handler.headers else path
+                url = f"http://{handler.headers['Host']}{path}" if 'Host' in handler.headers else path
                 span.layer = Layer.Http
                 span.component = Component.General
-                span.peer = '%s:%s' % handler.client_address
+                client_address = handler.client_address
+                span.peer = f'{client_address[0]}:{client_address[1]}'
                 span.tag(TagHttpMethod(method))
                 span.tag(TagHttpURL(url))
 
@@ -145,4 +147,4 @@ def _wrap_do_method(handler, method):
                         if status_code >= 400:
                             span.error_occurred = True
 
-        setattr(handler, 'do_' + method, _sw_do_method)
+        setattr(handler, f'do_{method}', _sw_do_method)
diff --git a/skywalking/plugins/sw_kafka.py b/skywalking/plugins/sw_kafka.py
index f76daaf..1995ee6 100644
--- a/skywalking/plugins/sw_kafka.py
+++ b/skywalking/plugins/sw_kafka.py
@@ -21,11 +21,11 @@ from skywalking.trace.carrier import Carrier
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagMqBroker, TagMqTopic
 
-link_vector = ["https://kafka-python.readthedocs.io"]
+link_vector = ['https://kafka-python.readthedocs.io']
 
 support_matrix = {
-    "kafka-python": {
-        ">=3.6": ["2.0"]
+    'kafka-python': {
+        '>=3.6': ['2.0']
     }
 }
 note = """"""
@@ -45,13 +45,13 @@ def _sw__poll_once_func(__poll_once):
     def _sw__poll_once(this, timeout_ms, max_records, update_offsets=True):
         res = __poll_once(this, timeout_ms, max_records, update_offsets=update_offsets)
         if res:
-            brokers = ";".join(this.config["bootstrap_servers"])
+            brokers = ';'.join(this.config['bootstrap_servers'])
             context = get_context()
-            topics = ";".join(this._subscription.subscription
+            topics = ';'.join(this._subscription.subscription
                               or [t.topic for t in this._subscription._user_assignment])
 
             with context.new_entry_span(
-                    op="Kafka/" + topics + "/Consumer/" + (this.config["group_id"] or "")) as span:
+                    op=f"Kafka/{topics}/Consumer/{this.config['group_id'] or ''}") as span:
                 for consumerRecords in res.values():
                     for record in consumerRecords:
                         carrier = Carrier()
@@ -80,9 +80,9 @@ def _sw_send_func(_send):
             return _send(this, topic, value=value, key=key, headers=headers, partition=partition,
                          timestamp_ms=timestamp_ms)
 
-        peer = ";".join(this.config["bootstrap_servers"])
+        peer = ';'.join(this.config['bootstrap_servers'])
         context = get_context()
-        with context.new_exit_span(op="Kafka/" + topic + "/Producer" or "/", peer=peer,
+        with context.new_exit_span(op=f'Kafka/{topic}/Producer' or '/', peer=peer,
                                    component=Component.KafkaProducer) as span:
             carrier = span.inject()
             span.layer = Layer.MQ
@@ -90,7 +90,7 @@ def _sw_send_func(_send):
             if headers is None:
                 headers = []
             for item in carrier:
-                headers.append((item.key, item.val.encode("utf-8")))
+                headers.append((item.key, item.val.encode('utf-8')))
 
             res = _send(this, topic, value=value, key=key, headers=headers, partition=partition,
                         timestamp_ms=timestamp_ms)
diff --git a/skywalking/plugins/sw_psycopg.py b/skywalking/plugins/sw_psycopg.py
index 4d37f73..61a770b 100644
--- a/skywalking/plugins/sw_psycopg.py
+++ b/skywalking/plugins/sw_psycopg.py
@@ -19,10 +19,10 @@ from skywalking import Layer, Component, config
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbInstance, TagDbStatement, TagDbSqlParameters
 
-link_vector = ["https://www.psycopg.org/"]
+link_vector = ['https://www.psycopg.org/']
 support_matrix = {
-    "psycopg[binary]": {
-        ">=3.6": ["3.0"]  # psycopg is psycopg3
+    'psycopg[binary]': {
+        '>=3.6': ['3.0']  # psycopg is psycopg3
     }
 }
 note = """"""
@@ -46,13 +46,13 @@ def install_sync():
         def execute(self, query, vars=None, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/execute", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/execute', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -60,22 +60,22 @@ def install_sync():
                     text = ','.join(str(v) for v in vars)
 
                     if len(text) > config.sql_parameters_length:
-                        text = text[:config.sql_parameters_length] + '...'
+                        text = f'{text[:config.sql_parameters_length]}...'
 
-                    span.tag(TagDbSqlParameters('[' + text + ']'))
+                    span.tag(TagDbSqlParameters(f'[{text}]'))
 
                 return self._self_cur.execute(query, vars, *args, **kwargs)
 
         def executemany(self, query, vars_list, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/executemany", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/executemany', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -85,30 +85,30 @@ def install_sync():
                     text_list = []
 
                     for vars in vars_list:
-                        text = '[' + ','.join(str(v) for v in vars) + ']'
+                        text = f"[{','.join(str(v) for v in vars)}]"
                         total_len += len(text)
 
                         if total_len > max_len:
-                            text_list.append(text[:max_len - total_len] + '...')
+                            text_list.append(f'{text[:max_len - total_len]}...')
 
                             break
 
                         text_list.append(text)
 
-                    span.tag(TagDbSqlParameters('[' + ','.join(text_list) + ']'))
+                    span.tag(TagDbSqlParameters(f"[{','.join(text_list)}]"))
 
                 return self._self_cur.executemany(query, vars_list, *args, **kwargs)
 
         def stream(self, query, vars=None, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/stream", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/stream', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -116,9 +116,9 @@ def install_sync():
                     text = ','.join(str(v) for v in vars)
 
                     if len(text) > config.sql_parameters_length:
-                        text = text[:config.sql_parameters_length] + '...'
+                        text = f'{text[:config.sql_parameters_length]}...'
 
-                    span.tag(TagDbSqlParameters('[' + text + ']'))
+                    span.tag(TagDbSqlParameters(f'[{text}]'))
 
                 yield from self._self_cur.stream(query, vars, *args, **kwargs)
 
@@ -161,13 +161,13 @@ def install_async():
         async def execute(self, query, vars=None, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/execute", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/execute', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -175,22 +175,22 @@ def install_async():
                     text = ','.join(str(v) for v in vars)
 
                     if len(text) > config.sql_parameters_length:
-                        text = text[:config.sql_parameters_length] + '...'
+                        text = f'{text[:config.sql_parameters_length]}...'
 
-                    span.tag(TagDbSqlParameters('[' + text + ']'))
+                    span.tag(TagDbSqlParameters(f'[{text}]'))
 
                 return await self._self_cur.execute(query, vars, *args, **kwargs)
 
         async def executemany(self, query, vars_list, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/executemany", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/executemany', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -200,30 +200,30 @@ def install_async():
                     text_list = []
 
                     for vars in vars_list:
-                        text = '[' + ','.join(str(v) for v in vars) + ']'
+                        text = f"[{','.join(str(v) for v in vars)}]"
                         total_len += len(text)
 
                         if total_len > max_len:
-                            text_list.append(text[:max_len - total_len] + '...')
+                            text_list.append(f'{text[:max_len - total_len]}...')
 
                             break
 
                         text_list.append(text)
 
-                    span.tag(TagDbSqlParameters('[' + ','.join(text_list) + ']'))
+                    span.tag(TagDbSqlParameters(f"[{','.join(text_list)}]"))
 
                 return await self._self_cur.executemany(query, vars_list, *args, **kwargs)
 
         async def stream(self, query, vars=None, *args, **kwargs):
             dsn = self.connection.info.get_parameters()
             port = self.connection.info.port
-            peer = dsn['host'] + ':' + str(port)
+            peer = f"{dsn['host']}:{str(port)}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/stream", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/stream', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -231,9 +231,9 @@ def install_async():
                     text = ','.join(str(v) for v in vars)
 
                     if len(text) > config.sql_parameters_length:
-                        text = text[:config.sql_parameters_length] + '...'
+                        text = f'{text[:config.sql_parameters_length]}...'
 
-                    span.tag(TagDbSqlParameters('[' + text + ']'))
+                    span.tag(TagDbSqlParameters(f'[{text}]'))
 
                 async for r in self._self_cur.stream(query, vars, *args, **kwargs):
                     yield r
diff --git a/skywalking/plugins/sw_psycopg2.py b/skywalking/plugins/sw_psycopg2.py
index 65cd780..621cb5a 100644
--- a/skywalking/plugins/sw_psycopg2.py
+++ b/skywalking/plugins/sw_psycopg2.py
@@ -19,11 +19,11 @@ from skywalking import Layer, Component, config
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbInstance, TagDbStatement, TagDbSqlParameters
 
-link_vector = ["https://www.psycopg.org/"]
+link_vector = ['https://www.psycopg.org/']
 support_matrix = {
-    "psycopg2-binary": {
-        ">=3.10": [],
-        ">=3.6": ["2.9"]  # transition to psycopg(3), not working for python 3.10
+    'psycopg2-binary': {
+        '>=3.10': [],
+        '>=3.6': ['2.9']  # transition to psycopg(3), not working for python 3.10
     }
 }
 note = """"""
@@ -44,13 +44,13 @@ def install():
 
         def execute(self, query, vars=None):
             dsn = self.connection.get_dsn_parameters()
-            peer = dsn['host'] + ':' + dsn['port']
+            peer = f"{dsn['host']}:{dsn['port']}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/execute", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/execute', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -58,21 +58,21 @@ def install():
                     text = ','.join(str(v) for v in vars)
 
                     if len(text) > config.sql_parameters_length:
-                        text = text[:config.sql_parameters_length] + '...'
+                        text = f'{text[:config.sql_parameters_length]}...'
 
-                    span.tag(TagDbSqlParameters('[' + text + ']'))
+                    span.tag(TagDbSqlParameters(f'[{text}]'))
 
                 return self._self_cur.execute(query, vars)
 
         def executemany(self, query, vars_list):
             dsn = self.connection.get_dsn_parameters()
-            peer = dsn['host'] + ':' + dsn['port']
+            peer = f"{dsn['host']}:{dsn['port']}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/executemany", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/executemany', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(query))
 
@@ -82,30 +82,30 @@ def install():
                     text_list = []
 
                     for vars in vars_list:
-                        text = '[' + ','.join(str(v) for v in vars) + ']'
+                        text = f"[{','.join(str(v) for v in vars)}]"
                         total_len += len(text)
 
                         if total_len > max_len:
-                            text_list.append(text[:max_len - total_len] + '...')
+                            text_list.append(f'{text[:max_len - total_len]}...')
 
                             break
 
                         text_list.append(text)
 
-                    span.tag(TagDbSqlParameters('[' + ','.join(text_list) + ']'))
+                    span.tag(TagDbSqlParameters(f"[{','.join(text_list)}]"))
 
                 return self._self_cur.executemany(query, vars_list)
 
         def callproc(self, procname, parameters=None):
             dsn = self.connection.get_dsn_parameters()
-            peer = dsn['host'] + ':' + dsn['port']
+            peer = f"{dsn['host']}:{dsn['port']}"
 
-            with get_context().new_exit_span(op="PostgreSLQ/Psycopg/callproc", peer=peer,
+            with get_context().new_exit_span(op='PostgreSLQ/Psycopg/callproc', peer=peer,
                                              component=Component.Psycopg) as span:
                 span.layer = Layer.Database
-                args = '(' + ('' if not parameters else ','.join(parameters)) + ')'
+                args = f"({'' if not parameters else ','.join(parameters)})"
 
-                span.tag(TagDbType("PostgreSQL"))
+                span.tag(TagDbType('PostgreSQL'))
                 span.tag(TagDbInstance(dsn['dbname']))
                 span.tag(TagDbStatement(procname + args))
 
diff --git a/skywalking/plugins/sw_pymongo.py b/skywalking/plugins/sw_pymongo.py
index b4779a7..fc15302 100644
--- a/skywalking/plugins/sw_pymongo.py
+++ b/skywalking/plugins/sw_pymongo.py
@@ -19,10 +19,10 @@ from skywalking import Layer, Component, config
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbInstance, TagDbStatement
 
-link_vector = ["https://pymongo.readthedocs.io"]
+link_vector = ['https://pymongo.readthedocs.io']
 support_matrix = {
-    "pymongo": {
-        ">=3.6": ["3.11"]  # TODO: "3.12" incompatible with all python versions, need investigation
+    'pymongo': {
+        '>=3.6': ['3.11']  # TODO: "3.12" incompatible with all python versions, need investigation
     }
 }
 note = """"""
@@ -34,9 +34,9 @@ def install():
     from pymongo.pool import SocketInfo
 
     bulk_op_map = {
-        0: "insert",
-        1: "update",
-        2: "delete"
+        0: 'insert',
+        1: 'update',
+        2: 'delete'
     }
     # handle insert_many and bulk write
     inject_bulk_write(_Bulk, bulk_op_map)
@@ -53,25 +53,25 @@ def inject_socket_info(SocketInfo):
 
     def _sw_command(this: SocketInfo, dbname, spec, *args, **kwargs):
         # pymongo sends `ismaster` command continuously. ignore it.
-        if spec.get("ismaster") is None:
+        if spec.get('ismaster') is None:
             address = this.sock.getpeername()
-            peer = "%s:%s" % address
+            peer = f'{address[0]}:{address[1]}'
             context = get_context()
 
             operation = list(spec.keys())[0]
-            sw_op = operation.capitalize() + "Operation"
-            with context.new_exit_span(op="MongoDB/" + sw_op, peer=peer, component=Component.MongoDB) as span:
+            sw_op = f'{operation.capitalize()}Operation'
+            with context.new_exit_span(op=f'MongoDB/{sw_op}', peer=peer, component=Component.MongoDB) as span:
                 result = _command(this, dbname, spec, *args, **kwargs)
 
                 span.layer = Layer.Database
-                span.tag(TagDbType("MongoDB"))
+                span.tag(TagDbType('MongoDB'))
                 span.tag(TagDbInstance(dbname))
 
                 if config.pymongo_trace_parameters:
                     # get filters
                     filters = _get_filter(operation, spec)
                     max_len = config.pymongo_parameters_max_length
-                    filters = filters[0:max_len] + "..." if len(filters) > max_len else filters
+                    filters = f'{filters[0:max_len]}...' if len(filters) > max_len else filters
                     span.tag(TagDbStatement(filters))
 
         else:
@@ -97,7 +97,7 @@ def _get_filter(request_type, spec):
         spec = dict(spec)
         spec.pop(request_type)
 
-    return request_type + " " + str(spec)
+    return f'{request_type} {str(spec)}'
 
 
 def inject_bulk_write(_Bulk, bulk_op_map):
@@ -105,27 +105,27 @@ def inject_bulk_write(_Bulk, bulk_op_map):
 
     def _sw_execute(this: _Bulk, *args, **kwargs):
         nodes = this.collection.database.client.nodes
-        peer = ",".join(["%s:%s" % address for address in nodes])
+        peer = ','.join([f'{address[0]}:{address[1]}' for address in nodes])
         context = get_context()
 
-        sw_op = "MixedBulkWriteOperation"
-        with context.new_exit_span(op="MongoDB/" + sw_op, peer=peer, component=Component.MongoDB) as span:
+        sw_op = 'MixedBulkWriteOperation'
+        with context.new_exit_span(op=f'MongoDB/{sw_op}', peer=peer, component=Component.MongoDB) as span:
             span.layer = Layer.Database
 
             bulk_result = _execute(this, *args, **kwargs)
 
-            span.tag(TagDbType("MongoDB"))
+            span.tag(TagDbType('MongoDB'))
             span.tag(TagDbInstance(this.collection.database.name))
             if config.pymongo_trace_parameters:
-                filters = ""
+                filters = ''
                 bulk_ops = this.ops
                 for bulk_op in bulk_ops:
                     opname = bulk_op_map.get(bulk_op[0])
-                    _filter = opname + " " + str(bulk_op[1])
-                    filters = filters + _filter + " "
+                    _filter = f'{opname} {str(bulk_op[1])}'
+                    filters = f'{filters + _filter} '
 
                 max_len = config.pymongo_parameters_max_length
-                filters = filters[0:max_len] + "..." if len(filters) > max_len else filters
+                filters = f'{filters[0:max_len]}...' if len(filters) > max_len else filters
                 span.tag(TagDbStatement(filters))
 
             return bulk_result
@@ -138,24 +138,24 @@ def inject_cursor(Cursor):
 
     def _sw_send_message(this: Cursor, operation):
         nodes = this.collection.database.client.nodes
-        peer = ",".join(["%s:%s" % address for address in nodes])
+        peer = ','.join([f'{address[0]}:{address[1]}' for address in nodes])
 
         context = get_context()
-        op = "FindOperation"
+        op = 'FindOperation'
 
-        with context.new_exit_span(op="MongoDB/" + op, peer=peer, component=Component.MongoDB) as span:
+        with context.new_exit_span(op=f'MongoDB/{op}', peer=peer, component=Component.MongoDB) as span:
             span.layer = Layer.Database
 
             # __send_message return nothing
             __send_message(this, operation)
 
-            span.tag(TagDbType("MongoDB"))
+            span.tag(TagDbType('MongoDB'))
             span.tag(TagDbInstance(this.collection.database.name))
 
             if config.pymongo_trace_parameters:
-                filters = "find " + str(operation.spec)
+                filters = f'find {str(operation.spec)}'
                 max_len = config.pymongo_parameters_max_length
-                filters = filters[0:max_len] + "..." if len(filters) > max_len else filters
+                filters = f'{filters[0:max_len]}...' if len(filters) > max_len else filters
                 span.tag(TagDbStatement(filters))
 
             return
diff --git a/skywalking/plugins/sw_pymysql.py b/skywalking/plugins/sw_pymysql.py
index dc9266a..f5aec74 100644
--- a/skywalking/plugins/sw_pymysql.py
+++ b/skywalking/plugins/sw_pymysql.py
@@ -19,10 +19,10 @@ from skywalking import Layer, Component, config
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbInstance, TagDbStatement, TagDbSqlParameters
 
-link_vector = ["https://pymysql.readthedocs.io/en/latest/"]
+link_vector = ['https://pymysql.readthedocs.io/en/latest/']
 support_matrix = {
-    "pymysql": {
-        ">=3.6": ["1.0"]
+    'pymysql': {
+        '>=3.6': ['1.0']
     }
 }
 note = """"""
@@ -34,22 +34,22 @@ def install():
     _execute = Cursor.execute
 
     def _sw_execute(this: Cursor, query, args=None):
-        peer = "%s:%s" % (this.connection.host, this.connection.port)
+        peer = f'{this.connection.host}:{this.connection.port}'
 
         context = get_context()
-        with context.new_exit_span(op="Mysql/PyMsql/execute", peer=peer, component=Component.PyMysql) as span:
+        with context.new_exit_span(op='Mysql/PyMsql/execute', peer=peer, component=Component.PyMysql) as span:
             span.layer = Layer.Database
             res = _execute(this, query, args)
 
-            span.tag(TagDbType("mysql"))
-            span.tag(TagDbInstance((this.connection.db or b'').decode("utf-8")))
+            span.tag(TagDbType('mysql'))
+            span.tag(TagDbInstance((this.connection.db or b'').decode('utf-8')))
             span.tag(TagDbStatement(query))
 
             if config.sql_parameters_length and args:
-                parameter = ",".join([str(arg) for arg in args])
+                parameter = ','.join([str(arg) for arg in args])
                 max_len = config.sql_parameters_length
-                parameter = parameter[0:max_len] + "..." if len(parameter) > max_len else parameter
-                span.tag(TagDbSqlParameters('[' + parameter + ']'))
+                parameter = f'{parameter[0:max_len]}...' if len(parameter) > max_len else parameter
+                span.tag(TagDbSqlParameters(f'[{parameter}]'))
 
             return res
 
diff --git a/skywalking/plugins/sw_pyramid.py b/skywalking/plugins/sw_pyramid.py
index 3d312ee..52dcdad 100644
--- a/skywalking/plugins/sw_pyramid.py
+++ b/skywalking/plugins/sw_pyramid.py
@@ -21,10 +21,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://trypyramid.com"]
+link_vector = ['https://trypyramid.com']
 support_matrix = {
-    "pyramid": {
-        ">=3.6": ["1.10", "2.0"]
+    'pyramid': {
+        '>=3.6': ['1.10', '2.0']
     }
 }
 note = """"""
diff --git a/skywalking/plugins/sw_rabbitmq.py b/skywalking/plugins/sw_rabbitmq.py
index bfcd3d3..a87c643 100644
--- a/skywalking/plugins/sw_rabbitmq.py
+++ b/skywalking/plugins/sw_rabbitmq.py
@@ -20,10 +20,10 @@ from skywalking.trace.carrier import Carrier
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagMqBroker, TagMqTopic, TagMqQueue
 
-link_vector = ["https://pika.readthedocs.io"]
+link_vector = ['https://pika.readthedocs.io']
 support_matrix = {
-    "pika": {
-        ">=3.6": ["1.2"]
+    'pika': {
+        '>=3.6': ['1.2']
     }
 }
 note = """"""
@@ -44,10 +44,10 @@ def _sw_basic_publish_func(_basic_publish):
                           body,
                           properties=None,
                           mandatory=False):
-        peer = '%s:%s' % (this.connection.params.host, this.connection.params.port)
+        peer = f'{this.connection.params.host}:{this.connection.params.port}'
         context = get_context()
         import pika
-        with context.new_exit_span(op="RabbitMQ/Topic/" + exchange + "/Queue/" + routing_key + "/Producer" or "/",
+        with context.new_exit_span(op=f'RabbitMQ/Topic/{exchange}/Queue/{routing_key}/Producer' or '/',
                                    peer=peer, component=Component.RabbitmqProducer) as span:
             carrier = span.inject()
             span.layer = Layer.MQ
@@ -74,7 +74,7 @@ def _sw_basic_publish_func(_basic_publish):
 
 def _sw__on_deliver_func(__on_deliver):
     def _sw__on_deliver(this, method_frame, header_frame, body):
-        peer = '%s:%s' % (this.connection.params.host, this.connection.params.port)
+        peer = f'{this.connection.params.host}:{this.connection.params.port}'
         context = get_context()
         exchange = method_frame.method.exchange
         routing_key = method_frame.method.routing_key
@@ -83,8 +83,8 @@ def _sw__on_deliver_func(__on_deliver):
             if item.key in header_frame.properties.headers:
                 item.val = header_frame.properties.headers[item.key]
 
-        with context.new_entry_span(op="RabbitMQ/Topic/" + exchange + "/Queue/" + routing_key
-                                       + "/Consumer" or "", carrier=carrier) as span:
+        with context.new_entry_span(op='RabbitMQ/Topic/' + exchange + '/Queue/' + routing_key
+                                       + '/Consumer' or '', carrier=carrier) as span:
             span.layer = Layer.MQ
             span.component = Component.RabbitmqConsumer
             __on_deliver(this, method_frame, header_frame, body)
diff --git a/skywalking/plugins/sw_redis.py b/skywalking/plugins/sw_redis.py
index d885578..8475d1d 100644
--- a/skywalking/plugins/sw_redis.py
+++ b/skywalking/plugins/sw_redis.py
@@ -19,10 +19,10 @@ from skywalking import Layer, Component
 from skywalking.trace.context import get_context
 from skywalking.trace.tags import TagDbType, TagDbInstance, TagDbStatement
 
-link_vector = ["https://github.com/andymccurdy/redis-py/"]
+link_vector = ['https://github.com/andymccurdy/redis-py/']
 support_matrix = {
-    "redis": {
-        ">=3.6": ["3.5"]  # "4.0" next, incompatible to current instrumentation
+    'redis': {
+        '>=3.6': ['3.5']  # "4.0" next, incompatible to current instrumentation
     }
 }
 note = """"""
@@ -34,14 +34,14 @@ def install():
     _send_command = Connection.send_command
 
     def _sw_send_command(this: Connection, *args, **kwargs):
-        peer = "%s:%s" % (this.host, this.port)
+        peer = f'{this.host}:{this.port}'
         op = args[0]
         context = get_context()
-        with context.new_exit_span(op="Redis/" + op or "/", peer=peer, component=Component.Redis) as span:
+        with context.new_exit_span(op=f'Redis/{op}' or '/', peer=peer, component=Component.Redis) as span:
             span.layer = Layer.Cache
 
             res = _send_command(this, *args, **kwargs)
-            span.tag(TagDbType("Redis"))
+            span.tag(TagDbType('Redis'))
             span.tag(TagDbInstance(this.db))
             span.tag(TagDbStatement(op))
 
diff --git a/skywalking/plugins/sw_requests.py b/skywalking/plugins/sw_requests.py
index 4b2f94b..f1d2d6c 100644
--- a/skywalking/plugins/sw_requests.py
+++ b/skywalking/plugins/sw_requests.py
@@ -20,10 +20,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://requests.readthedocs.io/en/master/"]
+link_vector = ['https://requests.readthedocs.io/en/master/']
 support_matrix = {
-    "requests": {
-        ">=3.6": ["2.26", "2.25"]
+    'requests': {
+        '>=3.6': ['2.26', '2.25']
     }
 }
 note = """"""
@@ -50,7 +50,7 @@ def install():
                             hooks, stream, verify, cert, json)
 
         span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
-            else get_context().new_exit_span(op=url_param.path or "/", peer=url_param.netloc,
+            else get_context().new_exit_span(op=url_param.path or '/', peer=url_param.netloc,
                                              component=Component.Requests)
 
         with span:
diff --git a/skywalking/plugins/sw_sanic.py b/skywalking/plugins/sw_sanic.py
index dc7421e..271d84e 100644
--- a/skywalking/plugins/sw_sanic.py
+++ b/skywalking/plugins/sw_sanic.py
@@ -29,12 +29,12 @@ logger = logging.getLogger(__name__)
 #     "rules": [">=20.3.0 <21.0.0"]
 # }
 
-link_vector = ["https://sanic.readthedocs.io/en/latest"]
+link_vector = ['https://sanic.readthedocs.io/en/latest']
 support_matrix = {
-    "sanic": {
-        ">=3.10": [],  # not supporting any version yet
-        ">=3.7": ["20.12"],  # 21.9 Future LTS - Not supported by SW yet
-        ">=3.6": ["20.12"]  # 20.12 last LTS for python 3.6
+    'sanic': {
+        '>=3.10': [],  # not supporting any version yet
+        '>=3.7': ['20.12'],  # 21.9 Future LTS - Not supported by SW yet
+        '>=3.6': ['20.12']  # 20.12 last LTS for python 3.6
     }  # TODO: add instrumentation for 21.9 (method signature change) remove - write_callback, stream_callback
 }
 note = """"""
@@ -48,7 +48,7 @@ def install():
     _handle_request = Sanic.handle_request
     _handlers_ErrorHandler_response = handlers.ErrorHandler.response
 
-    def _sw_format_http1_response(status: int, headers, body=b""):
+    def _sw_format_http1_response(status: int, headers, body=b''):
         if status is not None:
             entry_span = get_context().active_span()
             if entry_span is not None and type(entry_span) is not NoopSpan:
@@ -75,7 +75,7 @@ def _gen_sw_handle_request(_handle_request):
     from inspect import isawaitable
 
     def params_tostring(params):
-        return "\n".join([k + '=[' + ",".join(params.getlist(k)) + ']' for k, _ in params.items()])
+        return '\n'.join([f"{k}=[{','.join(params.getlist(k))}]" for k, _ in params.items()])
 
     async def _sw_handle_request(self, request, write_callback, stream_callback):
         req = request
@@ -92,9 +92,9 @@ def _gen_sw_handle_request(_handle_request):
         with span:
             span.layer = Layer.Http
             span.component = Component.Sanic
-            span.peer = '%s:%s' % (req.remote_addr or req.ip, req.port)
+            span.peer = f'{req.remote_addr or req.ip}:{req.port}'
             span.tag(TagHttpMethod(method))
-            span.tag(TagHttpURL(req.url.split("?")[0]))
+            span.tag(TagHttpURL(req.url.split('?')[0]))
             if config.sanic_collect_http_params and req.args:
                 span.tag(TagHttpParams(params_tostring(req.args)[0:config.http_params_length_threshold]))
             resp = _handle_request(self, request, write_callback, stream_callback)
diff --git a/skywalking/plugins/sw_tornado.py b/skywalking/plugins/sw_tornado.py
index 4803e94..6509fdb 100644
--- a/skywalking/plugins/sw_tornado.py
+++ b/skywalking/plugins/sw_tornado.py
@@ -27,10 +27,10 @@ from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 #     "name": "tornado",
 #     "rules": [">=5.0"]
 # }
-link_vector = ["https://www.tornadoweb.org"]
+link_vector = ['https://www.tornadoweb.org']
 support_matrix = {
-    "tornado": {
-        ">=3.6": ["6.0", "6.1"]
+    'tornado': {
+        '>=3.6': ['6.0', '6.1']
     }
 }
 note = """"""
@@ -76,9 +76,9 @@ def _gen_sw_get_response_func(old_execute):
                 span.layer = Layer.Http
                 span.component = Component.Tornado
                 peer = request.connection.stream.socket.getpeername()
-                span.peer = '{0}:{1}'.format(*peer)
+                span.peer = f'{peer[0]}:{peer[1]}'
                 span.tag(TagHttpMethod(method))
-                span.tag(TagHttpURL('{}://{}{}'.format(request.protocol, request.host, request.path)))
+                span.tag(TagHttpURL(f'{request.protocol}://{request.host}{request.path}'))
                 result = old_execute(self, *args, **kwargs)
                 if isawaitable(result):
                     result = await result
@@ -104,9 +104,9 @@ def _gen_sw_get_response_func(old_execute):
                 span.layer = Layer.Http
                 span.component = Component.Tornado
                 peer = request.connection.stream.socket.getpeername()
-                span.peer = '{0}:{1}'.format(*peer)
+                span.peer = f'{peer[0]}:{peer[1]}'
                 span.tag(TagHttpMethod(method))
-                span.tag(TagHttpURL('{}://{}{}'.format(request.protocol, request.host, request.path)))
+                span.tag(TagHttpURL(f'{request.protocol}://{request.host}{request.path}'))
                 result = yield from old_execute(self, *args, **kwargs)
                 span.tag(TagHttpStatusCode(self._status_code))
                 if self._status_code >= 400:
diff --git a/skywalking/plugins/sw_urllib3.py b/skywalking/plugins/sw_urllib3.py
index 7bfb20b..d82a688 100644
--- a/skywalking/plugins/sw_urllib3.py
+++ b/skywalking/plugins/sw_urllib3.py
@@ -20,10 +20,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://urllib3.readthedocs.io/en/latest/"]
+link_vector = ['https://urllib3.readthedocs.io/en/latest/']
 support_matrix = {
-    "urllib3": {
-        ">=3.6": ["1.26", "1.25"]
+    'urllib3': {
+        '>=3.6': ['1.26', '1.25']
     }
 }
 note = """"""
@@ -40,7 +40,7 @@ def install():
         url_param = sw_urlparse(url)
 
         span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
-            else get_context().new_exit_span(op=url_param.path or "/", peer=url_param.netloc,
+            else get_context().new_exit_span(op=url_param.path or '/', peer=url_param.netloc,
                                              component=Component.Urllib3)
 
         with span:
diff --git a/skywalking/plugins/sw_urllib_request.py b/skywalking/plugins/sw_urllib_request.py
index ff9b81c..2e120aa 100644
--- a/skywalking/plugins/sw_urllib_request.py
+++ b/skywalking/plugins/sw_urllib_request.py
@@ -22,10 +22,10 @@ from skywalking.trace.context import get_context, NoopContext
 from skywalking.trace.span import NoopSpan
 from skywalking.trace.tags import TagHttpMethod, TagHttpURL, TagHttpStatusCode
 
-link_vector = ["https://docs.python.org/3/library/urllib.request.html"]
+link_vector = ['https://docs.python.org/3/library/urllib.request.html']
 support_matrix = {
-    "urllib_request": {
-        ">=3.6": ["*"]
+    'urllib_request': {
+        '>=3.6': ['*']
     }
 }
 note = """"""
@@ -42,7 +42,7 @@ def install():
         if isinstance(fullurl, str):
             fullurl = Request(fullurl, data)
 
-        url = fullurl.selector.split("?")[0] if fullurl.selector else '/'
+        url = fullurl.selector.split('?')[0] if fullurl.selector else '/'
         method = getattr(fullurl, 'method', None) or ('GET' if data is None else 'POST')
 
         span = NoopSpan(NoopContext()) if config.ignore_http_method_check(method) \
diff --git a/skywalking/profile/profile_context.py b/skywalking/profile/profile_context.py
index 1584c27..e7e2a24 100644
--- a/skywalking/profile/profile_context.py
+++ b/skywalking/profile/profile_context.py
@@ -15,16 +15,16 @@
 # limitations under the License.
 #
 
-import time
-from threading import Thread, Event, current_thread
 import sys
+import time
 import traceback
+from threading import Thread, Event, current_thread
 from typing import Optional
 
 from skywalking import agent
 from skywalking import config
-from skywalking.loggings import logger
 from skywalking import profile
+from skywalking.loggings import logger
 from skywalking.profile.profile_status import ProfileStatusReference, ProfileStatus
 from skywalking.profile.profile_task import ProfileTask
 from skywalking.profile.snapshot import TracingThreadSnapshot
@@ -127,7 +127,7 @@ class ProfileThread:
         try:
             self.profiling(self._task_execution_context)
         except Exception as e:
-            logger.error("profiling task fail. task_id:[%s] error:[%s]", self._task_execution_context.task.task_id, e)
+            logger.error('profiling task fail. task_id:[%s] error:[%s]', self._task_execution_context.task.task_id, e)
         finally:
             self._task_execution_service.stop_current_profile_task(self._task_execution_context)
 
@@ -204,7 +204,7 @@ class ThreadProfiler:
             if idx > config.profile_dump_max_stack_depth:
                 break
 
-            code_sig = f"{item.filename}.{item.name}: {item.lineno}"
+            code_sig = f'{item.filename}.{item.name}: {item.lineno}'
             stack_list.append(code_sig)
 
         # if is first dump, check is can start profiling
diff --git a/skywalking/profile/profile_service.py b/skywalking/profile/profile_service.py
index f3b6c8f..bc44480 100644
--- a/skywalking/profile/profile_service.py
+++ b/skywalking/profile/profile_service.py
@@ -15,22 +15,19 @@
 # limitations under the License.
 #
 
+from concurrent.futures import ThreadPoolExecutor
 from queue import Queue
+from threading import Timer, RLock, Lock
 from typing import Tuple
-from skywalking.loggings import logger
+
+from skywalking import agent
+from skywalking.loggings import logger, logger_debug_enabled
 from skywalking.profile.profile_constants import ProfileConstants
-from skywalking.profile.profile_task import ProfileTask
 from skywalking.profile.profile_context import ProfileTaskExecutionContext
 from skywalking.profile.profile_status import ProfileStatusReference
-
+from skywalking.profile.profile_task import ProfileTask
 from skywalking.trace.context import SpanContext
-
 from skywalking.utils.atomic_ref import AtomicRef
-from skywalking import agent
-
-from concurrent.futures import ThreadPoolExecutor
-from threading import Timer, RLock, Lock
-
 from skywalking.utils.time import current_milli_time
 
 
@@ -99,7 +96,7 @@ class ProfileTaskExecutionService:
         # check profile task object
         success, error_reason = self._check_profile_task(task)
         if not success:
-            logger.warning("check command error, cannot process this profile task. reason: %s", error_reason)
+            logger.warning('check command error, cannot process this profile task. reason: %s', error_reason)
             return
 
         # add task to list
@@ -138,7 +135,8 @@ class ProfileTaskExecutionService:
 
             # start profiling this task
             current_context.start_profiling()
-            logger.debug("profile task [%s] for endpoint [%s] started", task.task_id, task.first_span_op_name)
+            if logger_debug_enabled:
+                logger.debug('profile task [%s] for endpoint [%s] started', task.task_id, task.first_span_op_name)
 
             millis = task.duration * self.MINUTE_TO_MILLIS
             self.profile_task_scheduler.schedule(millis, self.stop_current_profile_task, [current_context])
@@ -150,8 +148,9 @@ class ProfileTaskExecutionService:
                 return
 
             need_stop.stop_profiling()
-            logger.debug("profile task [%s] for endpoint [%s] stopped", need_stop.task.task_id,
-                         need_stop.task.first_span_op_name)
+            if logger_debug_enabled:
+                logger.debug('profile task [%s] for endpoint [%s] stopped', need_stop.task.task_id,
+                             need_stop.task.first_span_op_name)
 
             self.remove_from_profile_task_list(need_stop.task)
 
@@ -162,30 +161,31 @@ class ProfileTaskExecutionService:
         try:
             # endpoint name
             if len(task.first_span_op_name) == 0:
-                return (False, "endpoint name [{}] error, "
-                               "should be str and not empty".format(task.first_span_op_name))
+                return (False, f'endpoint name [{task.first_span_op_name}] error, '
+                               f'should be str and not empty')
             # duration
             if task.duration < ProfileConstants.TASK_DURATION_MIN_MINUTE:
-                return (False, "monitor duration must greater"
-                               " than {} minutes".format(ProfileConstants.TASK_DURATION_MIN_MINUTE))
+                return (False, f'monitor duration must be greater '
+                               f'than {ProfileConstants.TASK_DURATION_MIN_MINUTE} minutes')
             if task.duration > ProfileConstants.TASK_DURATION_MAX_MINUTE:
-                return (False, "monitor duration must less"
-                               " than {} minutes".format(ProfileConstants.TASK_DURATION_MAX_MINUTE))
+                return (False, f'monitor duration must be less '
+                               f'than {ProfileConstants.TASK_DURATION_MAX_MINUTE} minutes')
             # min duration threshold
             if task.min_duration_threshold < 0:
-                return False, "min duration threshold must greater than or equals zero"
+                return False, 'min duration threshold must be greater than or equals zero'
 
             # dump period
             if task.thread_dump_period < ProfileConstants.TASK_DUMP_PERIOD_MIN_MILLIS:
-                return (False, "dump period must be greater than or equals to {}"
-                               " milliseconds".format(ProfileConstants.TASK_DUMP_PERIOD_MIN_MILLIS))
+                return (False,
+                        f'dump period must be greater than or equals to '
+                        f'{ProfileConstants.TASK_DUMP_PERIOD_MIN_MILLIS} milliseconds')
 
             # max sampling count
             if task.max_sampling_count <= 0:
-                return False, "max sampling count must greater than zero"
+                return False, 'max sampling count must be greater than zero'
             if task.max_sampling_count >= ProfileConstants.TASK_MAX_SAMPLING_COUNT:
-                return (False, "max sampling count must less"
-                               " than {}".format(ProfileConstants.TASK_MAX_SAMPLING_COUNT))
+                return (False, f'max sampling count must be less than '
+                               f'{ProfileConstants.TASK_MAX_SAMPLING_COUNT}')
 
             # check task queue
             task_finish_time = self._cal_profile_task_finish_time(task)
@@ -195,14 +195,15 @@ class ProfileTaskExecutionService:
                 for profile_task in self._profile_task_list.queue:  # type: ProfileTask
                     # if the end time of the task to be added is during the execution of any data, means is a error data
                     if task.start_time <= task_finish_time <= self._cal_profile_task_finish_time(profile_task):
-                        return (False, "there already have processing task in time range, "
-                                       "could not add a new task again. processing task monitor "
-                                       "endpoint name: {}".format(profile_task.first_span_op_name))
+                        return (False,
+                                f'there already have processing task in time range, '
+                                f'could not add a new task again. processing task '
+                                f'monitor endpoint name: {profile_task.first_span_op_name}')
 
-            return True, ""
+            return True, ''
 
         except TypeError:
-            return False, "ProfileTask attributes has type error"
+            return False, 'ProfileTask attributes have a type error'
 
     def _cal_profile_task_finish_time(self, task: ProfileTask) -> int:
         return task.start_time + task.duration * self.MINUTE_TO_MILLIS
diff --git a/skywalking/profile/profile_task.py b/skywalking/profile/profile_task.py
index 0776627..12506ef 100644
--- a/skywalking/profile/profile_task.py
+++ b/skywalking/profile/profile_task.py
@@ -22,8 +22,8 @@ from skywalking.utils.lang import tostring
 class ProfileTask:
 
     def __init__(self,
-                 task_id: str = "",
-                 first_span_op_name: str = "",
+                 task_id: str = '',
+                 first_span_op_name: str = '',
                  duration: int = -1,
                  min_duration_threshold: int = -1,
                  thread_dump_period: int = -1,
diff --git a/skywalking/trace/carrier.py b/skywalking/trace/carrier.py
index b52f27d..1cfcd13 100644
--- a/skywalking/trace/carrier.py
+++ b/skywalking/trace/carrier.py
@@ -23,7 +23,7 @@ from skywalking.utils.lang import b64encode, b64decode
 
 class CarrierItem(object):
     def __init__(self, key: str = '', val: str = ''):
-        self.key = config.agent_namespace + "-" + key if config.agent_namespace else key  # type: str
+        self.key = f'{config.agent_namespace}-{key}' if config.agent_namespace else key  # type: str
         self.val = val  # type: str
 
     @property
@@ -126,10 +126,10 @@ class SW8CorrelationCarrier(CarrierItem):
     @property
     def val(self) -> str:
         if self.correlation is None or len(self.correlation) == 0:
-            return ""
+            return ''
 
         return ','.join([
-            b64encode(k) + ":" + b64encode(v)
+            f'{b64encode(k)}:{b64encode(v)}'
             for k, v in self.correlation.items()
         ])
 
@@ -138,10 +138,10 @@ class SW8CorrelationCarrier(CarrierItem):
         self.__val = val
         if not val:
             return
-        for per in val.split(","):
+        for per in val.split(','):
             if len(self.correlation) > config.correlation_element_max_number:
                 break
-            parts = per.split(":")
+            parts = per.split(':')
             if len(parts) != 2:
                 continue
             self.correlation[b64decode(parts[0])] = b64decode(parts[1])
diff --git a/skywalking/trace/segment.py b/skywalking/trace/segment.py
index f2e0d4e..8b7d76d 100644
--- a/skywalking/trace/segment.py
+++ b/skywalking/trace/segment.py
@@ -19,7 +19,6 @@ import time
 from typing import List, TYPE_CHECKING
 
 from skywalking import config
-
 from skywalking.trace import ID
 from skywalking.utils.lang import tostring
 
@@ -62,7 +61,7 @@ class SegmentRef(object):
         carrier.span_id = snapshot.span_id
         carrier.service = config.service_name
         carrier.service_instance = config.service_instance
-        return SegmentRef(carrier, ref_type="CrossThread")
+        return SegmentRef(carrier, ref_type='CrossThread')
 
 
 class _NewID(ID):
diff --git a/skywalking/utils/array.py b/skywalking/utils/array.py
index e32e3f9..6bb7d67 100644
--- a/skywalking/utils/array.py
+++ b/skywalking/utils/array.py
@@ -35,14 +35,14 @@ class AtomicArray:
 
     def set(self, idx: int, new_value):
         if idx < 0 or idx >= self.length():
-            raise IndexError("atomic array assignment index out of range")
+            raise IndexError('atomic array assignment index out of range')
 
         with self._lock:
             self._array[idx] = new_value
 
     def get(self, idx: int):
         if idx < 0 or idx >= self.length():
-            raise IndexError("atomic array assignment index out of range")
+            raise IndexError('atomic array assignment index out of range')
 
         with self._lock:
             return self._array[idx]
@@ -53,7 +53,7 @@ class AtomicArray:
         :return: return True if success, False if the actual value was not equal to the expected value.
         """
         if idx < 0 or idx >= self.length():
-            raise IndexError("atomic array assignment index out of range")
+            raise IndexError('atomic array assignment index out of range')
 
         with self._lock:
             if self._array[idx] == expect:
diff --git a/skywalking/utils/filter.py b/skywalking/utils/filter.py
index 7c4e5d4..93b9e5f 100644
--- a/skywalking/utils/filter.py
+++ b/skywalking/utils/filter.py
@@ -27,7 +27,7 @@ def sw_urlparse(url):
     url_param = urlparse(url)
     safe_netloc = url_param.netloc
     try:
-        safe_netloc = str(url_param.hostname) + (':' + str(url_param.port) if url_param.port else '')
+        safe_netloc = f"{url_param.hostname}{f':{str(url_param.port)}' if url_param.port else ''}"
     except ValueError:  # illegal url, skip
         pass
 
diff --git a/skywalking/utils/lang.py b/skywalking/utils/lang.py
index 0f7e51c..a60ba0a 100644
--- a/skywalking/utils/lang.py
+++ b/skywalking/utils/lang.py
@@ -20,13 +20,7 @@ import base64
 
 def tostring(cls):
     def __str__(self):
-        return '%s@%s[%s]' % (
-            type(self).__name__, id(self),
-            ', '.join(
-                '%s=%s' % (k, str(v)) for (k, v) in vars(self).items()
-            )
-        )
-
+        return f"{type(self).__name__}@{id(self)}[{', '.join(f'{k}={str(v)}' for (k, v) in vars(self).items())}]"
     cls.__str__ = __str__
     return cls
 
diff --git a/tests/orchestrator.py b/tests/orchestrator.py
index 39848bb..1ee5ac7 100644
--- a/tests/orchestrator.py
+++ b/tests/orchestrator.py
@@ -31,7 +31,7 @@ def compare_version(rule_unit):
     test_python_version = sys.version_info[:2]  # type: tuple
     f = operators.get(symbol) or None
     if not f:
-        raise VersionRuleException("version rule {} error. only allow >,>=,==,<=,<,!= symbols".format(rule_unit))
+        raise VersionRuleException(f'version rule {rule_unit} error. only allow >,>=,==,<=,<,!= symbols')
 
     return f(test_python_version, expect_python_version)
 
@@ -51,7 +51,7 @@ def get_test_vector(lib_name: str, support_matrix: dict):
         if compare_version(py_version):
             # proceed if current python version is valid
             version_row = test_matrix[py_version]
-            return [f"{lib_name}=={idx}" for idx in version_row]
+            return [f'{lib_name}=={idx}' for idx in version_row]
     return []  # non-match, CI will skip the test case for this version
 
 
diff --git a/tests/plugin/conftest.py b/tests/plugin/conftest.py
index da1300a..4a43e25 100644
--- a/tests/plugin/conftest.py
+++ b/tests/plugin/conftest.py
@@ -55,6 +55,7 @@ def docker_compose(request, prepare, version):
     compose.start()
 
     exception = None
+    exception_delay = 100
     for _ in range(0, 10):
         try:
             prepare()
@@ -64,9 +65,9 @@ def docker_compose(request, prepare, version):
             time.sleep(10)
             exception = e
     if exception:
-        time.sleep(100)
+        time.sleep(exception_delay)
         compose.stop()
-        raise Exception("""Wait time exceeded {0} sec. Exception {1}""".format(100, exception))
+        raise Exception(f"""Wait time exceeded {exception_delay} secs. Exception {exception}""")
 
     yield compose
 
diff --git a/tests/plugin/data/sw_elasticsearch/services/consumer.py b/tests/plugin/data/sw_elasticsearch/services/consumer.py
index 5d89370..087d936 100644
--- a/tests/plugin/data/sw_elasticsearch/services/consumer.py
+++ b/tests/plugin/data/sw_elasticsearch/services/consumer.py
@@ -23,24 +23,24 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
     client = Elasticsearch('http://elasticsearch:9200/')
-    index_name = "test"
+    index_name = 'test'
 
     def create_index():
         client.indices.create(index=index_name, ignore=400)
 
     def save_index():
-        data = {"song": "Despacito", "artist": "Luis Fonsi"}
-        client.index(index=index_name, doc_type="test", id=1, body=data)
+        data = {'song': 'Despacito', 'artist': 'Luis Fonsi'}
+        client.index(index=index_name, doc_type='test', id=1, body=data)
 
     def search():
         client.get(index=index_name, id=1)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         create_index()
         save_index()
         search()
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9090
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_kafka/services/consumer.py b/tests/plugin/data/sw_kafka/services/consumer.py
index 0f7b3ff..71bf36b 100644
--- a/tests/plugin/data/sw_kafka/services/consumer.py
+++ b/tests/plugin/data/sw_kafka/services/consumer.py
@@ -16,10 +16,10 @@
 #
 
 if __name__ == '__main__':
-    topic = "skywalking"
-    server_list = ["kafka-server:9092"]
-    group_id = "skywalking"
-    client_id = "0"
+    topic = 'skywalking'
+    server_list = ['kafka-server:9092']
+    group_id = 'skywalking'
+    client_id = '0'
 
     from kafka import KafkaConsumer
     from kafka import TopicPartition
diff --git a/tests/plugin/data/sw_kafka/services/producer.py b/tests/plugin/data/sw_kafka/services/producer.py
index 6d7e656..c5cd8db 100644
--- a/tests/plugin/data/sw_kafka/services/producer.py
+++ b/tests/plugin/data/sw_kafka/services/producer.py
@@ -23,11 +23,11 @@ if __name__ == '__main__':
     app = Flask(__name__)
     producer = KafkaProducer(bootstrap_servers=['kafka-server:9092'], api_version=(1, 0, 1))
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         producer.send('skywalking', b'some_message_bytes')
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9090
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_psycopg/services/consumer.py b/tests/plugin/data/sw_psycopg/services/consumer.py
index ff935a4..3085092 100644
--- a/tests/plugin/data/sw_psycopg/services/consumer.py
+++ b/tests/plugin/data/sw_psycopg/services/consumer.py
@@ -23,9 +23,9 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
-        res = requests.post("http://provider:9091/users")
+        res = requests.post('http://provider:9091/users')
         return jsonify(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/data/sw_psycopg/services/provider.py b/tests/plugin/data/sw_psycopg/services/provider.py
index c9d5ada..29e0325 100644
--- a/tests/plugin/data/sw_psycopg/services/provider.py
+++ b/tests/plugin/data/sw_psycopg/services/provider.py
@@ -24,17 +24,17 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         time.sleep(0.5)
         connection = psycopg.connect(host='postgres', user='root', password='root', dbname='admin', port=5432)
         with connection.cursor() as cursor:
-            sql = "select * from user where user = %s"
-            cursor.execute(sql, ("root",))
+            sql = 'select * from user where user = %s'
+            cursor.execute(sql, ('root',))
 
         connection.close()
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_psycopg2/services/consumer.py b/tests/plugin/data/sw_psycopg2/services/consumer.py
index ff935a4..3085092 100644
--- a/tests/plugin/data/sw_psycopg2/services/consumer.py
+++ b/tests/plugin/data/sw_psycopg2/services/consumer.py
@@ -23,9 +23,9 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
-        res = requests.post("http://provider:9091/users")
+        res = requests.post('http://provider:9091/users')
         return jsonify(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/data/sw_psycopg2/services/provider.py b/tests/plugin/data/sw_psycopg2/services/provider.py
index 134bc5b..8a5bed7 100644
--- a/tests/plugin/data/sw_psycopg2/services/provider.py
+++ b/tests/plugin/data/sw_psycopg2/services/provider.py
@@ -24,17 +24,17 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         time.sleep(0.5)
         connection = psycopg2.connect(host='postgres', user='root', password='root', dbname='admin')
         with connection.cursor() as cursor:
-            sql = "select * from user where user = %s"
-            cursor.execute(sql, ("root",))
+            sql = 'select * from user where user = %s'
+            cursor.execute(sql, ('root',))
 
         connection.close()
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_pymongo/services/consumer.py b/tests/plugin/data/sw_pymongo/services/consumer.py
index a1c2070..610494e 100644
--- a/tests/plugin/data/sw_pymongo/services/consumer.py
+++ b/tests/plugin/data/sw_pymongo/services/consumer.py
@@ -23,11 +23,11 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
-        requests.get("http://provider:9091/insert_many")
-        requests.get("http://provider:9091/find_one")
-        res = requests.get("http://provider:9091/delete_one")
+        requests.get('http://provider:9091/insert_many')
+        requests.get('http://provider:9091/find_one')
+        res = requests.get('http://provider:9091/delete_one')
         return jsonify(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/data/sw_pymongo/services/provider.py b/tests/plugin/data/sw_pymongo/services/provider.py
index 0c143d3..67ba9b0 100644
--- a/tests/plugin/data/sw_pymongo/services/provider.py
+++ b/tests/plugin/data/sw_pymongo/services/provider.py
@@ -28,31 +28,31 @@ collection = db['test-collection']
 app = Flask(__name__)
 
 
-@app.route("/insert_many", methods=["GET"])
+@app.route('/insert_many', methods=['GET'])
 def test_insert_many():
     time.sleep(0.5)
-    new_posts = [{"song": "Despacito"},
-                 {"artist": "Luis Fonsi"}]
+    new_posts = [{'song': 'Despacito'},
+                 {'artist': 'Luis Fonsi'}]
     result = collection.insert_many(new_posts)
-    return jsonify({"ok": result.acknowledged})
+    return jsonify({'ok': result.acknowledged})
 
 
-@app.route("/find_one", methods=["GET"])
+@app.route('/find_one', methods=['GET'])
 def test_find_one():
     time.sleep(0.5)
-    result = collection.find_one({"song": "Despacito"})
+    result = collection.find_one({'song': 'Despacito'})
     # have to get the result and use it. if not lint will report error
     print(result)
-    return jsonify({"song": "Despacito"})
+    return jsonify({'song': 'Despacito'})
 
 
-@app.route("/delete_one", methods=["GET"])
+@app.route('/delete_one', methods=['GET'])
 def test_delete_one():
     time.sleep(0.5)
-    result = collection.delete_one({"song": "Despacito"})
-    return jsonify({"ok": result.acknowledged})
+    result = collection.delete_one({'song': 'Despacito'})
+    return jsonify({'ok': result.acknowledged})
 
 
 if __name__ == '__main__':
     PORT = 9091
-    app.run(host="0.0.0.0", port=PORT, debug=True)
+    app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_pymysql/services/consumer.py b/tests/plugin/data/sw_pymysql/services/consumer.py
index ff935a4..3085092 100644
--- a/tests/plugin/data/sw_pymysql/services/consumer.py
+++ b/tests/plugin/data/sw_pymysql/services/consumer.py
@@ -23,9 +23,9 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
-        res = requests.post("http://provider:9091/users")
+        res = requests.post('http://provider:9091/users')
         return jsonify(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/data/sw_pymysql/services/provider.py b/tests/plugin/data/sw_pymysql/services/provider.py
index 3d9a175..3486016 100644
--- a/tests/plugin/data/sw_pymysql/services/provider.py
+++ b/tests/plugin/data/sw_pymysql/services/provider.py
@@ -23,17 +23,17 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         time.sleep(0.5)
         connection = pymysql.connect(host='mysql', user='root', password='root', db='mysql', charset='utf8mb4')
         with connection.cursor() as cursor:
-            sql = "select * from user where user = %s"
-            cursor.execute(sql, ("root",))
+            sql = 'select * from user where user = %s'
+            cursor.execute(sql, ('root',))
 
         connection.close()
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_rabbitmq/services/consumer.py b/tests/plugin/data/sw_rabbitmq/services/consumer.py
index 7b4726c..d6e0dea 100644
--- a/tests/plugin/data/sw_rabbitmq/services/consumer.py
+++ b/tests/plugin/data/sw_rabbitmq/services/consumer.py
@@ -18,14 +18,14 @@
 if __name__ == '__main__':
     import pika
 
-    parameters = (pika.URLParameters("amqp://admin:admin@rabbitmq-server:5672/%2F"))
+    parameters = (pika.URLParameters('amqp://admin:admin@rabbitmq-server:5672/%2F'))
 
     connection = pika.BlockingConnection(parameters)
 
     channel = connection.channel()
-    channel.queue_declare("test")
-    channel.exchange_declare("test")
-    channel.queue_bind(exchange='test', queue="test", routing_key='test')
+    channel.queue_declare('test')
+    channel.exchange_declare('test')
+    channel.queue_bind(exchange='test', queue='test', routing_key='test')
     for method_frame, properties, body in channel.consume('test'):
         # Display the message parts and acknowledge the message
         print(method_frame, properties, body)
diff --git a/tests/plugin/data/sw_rabbitmq/services/producer.py b/tests/plugin/data/sw_rabbitmq/services/producer.py
index 8c90c31..66a7dc0 100644
--- a/tests/plugin/data/sw_rabbitmq/services/producer.py
+++ b/tests/plugin/data/sw_rabbitmq/services/producer.py
@@ -20,22 +20,22 @@ if __name__ == '__main__':
     from flask import Flask, jsonify
     app = Flask(__name__)
     import pika
-    parameters = (pika.URLParameters("amqp://admin:admin@rabbitmq-server:5672/%2F"))
+    parameters = (pika.URLParameters('amqp://admin:admin@rabbitmq-server:5672/%2F'))
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         connection = pika.BlockingConnection(parameters)
         channel = connection.channel()
-        channel.queue_declare("test")
-        channel.exchange_declare("test")
-        channel.queue_bind(exchange='test', queue="test", routing_key='test')
+        channel.queue_declare('test')
+        channel.exchange_declare('test')
+        channel.queue_bind(exchange='test', queue='test', routing_key='test')
         channel.basic_publish(
             exchange='test', routing_key='test',
             properties=pika.BasicProperties(headers={'key': 'value'}),
             body=b'Test message.')
         connection.close()
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9090
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/data/sw_redis/services/consumer.py b/tests/plugin/data/sw_redis/services/consumer.py
index ff935a4..3085092 100644
--- a/tests/plugin/data/sw_redis/services/consumer.py
+++ b/tests/plugin/data/sw_redis/services/consumer.py
@@ -23,9 +23,9 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
-        res = requests.post("http://provider:9091/users")
+        res = requests.post('http://provider:9091/users')
         return jsonify(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/data/sw_redis/services/provider.py b/tests/plugin/data/sw_redis/services/provider.py
index afdf19c..2e02461 100644
--- a/tests/plugin/data/sw_redis/services/provider.py
+++ b/tests/plugin/data/sw_redis/services/provider.py
@@ -24,7 +24,7 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         time.sleep(0.5)
 
@@ -33,7 +33,7 @@ if __name__ == '__main__':
         r.set('foo', 'bar')
         r.get('foo')
 
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/http/sw_aiohttp/services/consumer.py b/tests/plugin/http/sw_aiohttp/services/consumer.py
index f58b5aa..8869b86 100644
--- a/tests/plugin/http/sw_aiohttp/services/consumer.py
+++ b/tests/plugin/http/sw_aiohttp/services/consumer.py
@@ -21,7 +21,7 @@ from aiohttp import web
 
 
 async def handle(request):
-    name = request.match_info.get('name', "Anonymous")
+    name = request.match_info.get('name', 'Anonymous')
 
     async with aiohttp.ClientSession() as session:
         async with session.get(f'http://user:pass@provider:9091/{name}') as response:
diff --git a/tests/plugin/http/sw_aiohttp/services/provider.py b/tests/plugin/http/sw_aiohttp/services/provider.py
index 8f16b7f..165d551 100644
--- a/tests/plugin/http/sw_aiohttp/services/provider.py
+++ b/tests/plugin/http/sw_aiohttp/services/provider.py
@@ -19,7 +19,7 @@ from aiohttp import web
 
 
 async def handle(request):
-    name = request.match_info.get('name', "Anonymous")
+    name = request.match_info.get('name', 'Anonymous')
     return web.json_response({
         name: name,
     })
diff --git a/tests/plugin/http/sw_http/services/consumer.py b/tests/plugin/http/sw_http/services/consumer.py
index c3b787a..c1ad889 100644
--- a/tests/plugin/http/sw_http/services/consumer.py
+++ b/tests/plugin/http/sw_http/services/consumer.py
@@ -39,6 +39,6 @@ if __name__ == '__main__':
     PORT = 9090
     Handler = SimpleHTTPRequestHandler
 
-    with socketserver.TCPServer(("", PORT), Handler) as httpd:
-        print("serving at port", PORT)
+    with socketserver.TCPServer(('', PORT), Handler) as httpd:
+        print('serving at port', PORT)
         httpd.serve_forever()
diff --git a/tests/plugin/http/sw_http/services/provider.py b/tests/plugin/http/sw_http/services/provider.py
index 71ed1e9..4939cb8 100644
--- a/tests/plugin/http/sw_http/services/provider.py
+++ b/tests/plugin/http/sw_http/services/provider.py
@@ -34,5 +34,5 @@ if __name__ == '__main__':
     PORT = 9091
     Handler = SimpleHTTPRequestHandler
 
-    with socketserver.TCPServer(("", PORT), Handler) as httpd:
+    with socketserver.TCPServer(('', PORT), Handler) as httpd:
         httpd.serve_forever()
diff --git a/tests/plugin/http/sw_http_wsgi/services/consumer.py b/tests/plugin/http/sw_http_wsgi/services/consumer.py
index 943020a..7881177 100644
--- a/tests/plugin/http/sw_http_wsgi/services/consumer.py
+++ b/tests/plugin/http/sw_http_wsgi/services/consumer.py
@@ -38,6 +38,6 @@ if __name__ == '__main__':
     PORT = 9090
     Handler = SimpleHTTPRequestHandler
 
-    with socketserver.TCPServer(("", PORT), Handler) as httpd:
-        print("serving at port", PORT)
+    with socketserver.TCPServer(('', PORT), Handler) as httpd:
+        print('serving at port', PORT)
         httpd.serve_forever()
diff --git a/tests/plugin/http/sw_http_wsgi/services/provider.py b/tests/plugin/http/sw_http_wsgi/services/provider.py
index 372b25e..b28377d 100644
--- a/tests/plugin/http/sw_http_wsgi/services/provider.py
+++ b/tests/plugin/http/sw_http_wsgi/services/provider.py
@@ -29,4 +29,4 @@ if __name__ == '__main__':
     from werkzeug.serving import run_simple
 
     PORT = 9091
-    run_simple("", PORT, application)
+    run_simple('', PORT, application)
diff --git a/tests/plugin/http/sw_requests/services/consumer.py b/tests/plugin/http/sw_requests/services/consumer.py
index 0453164..e725396 100644
--- a/tests/plugin/http/sw_requests/services/consumer.py
+++ b/tests/plugin/http/sw_requests/services/consumer.py
@@ -28,12 +28,12 @@ if __name__ == '__main__':
             self.send_header('Content-Type', 'application/json; charset=utf-8')
             self.end_headers()
 
-            res = requests.post("http://provider:9091/users")
+            res = requests.post('http://provider:9091/users')
             self.wfile.write(str(res.json()).encode('utf8'))
 
     PORT = 9090
     Handler = SimpleHTTPRequestHandler
 
-    with socketserver.TCPServer(("", PORT), Handler) as httpd:
-        print("serving at port", PORT)
+    with socketserver.TCPServer(('', PORT), Handler) as httpd:
+        print('serving at port', PORT)
         httpd.serve_forever()
diff --git a/tests/plugin/http/sw_requests/services/provider.py b/tests/plugin/http/sw_requests/services/provider.py
index 71ed1e9..4939cb8 100644
--- a/tests/plugin/http/sw_requests/services/provider.py
+++ b/tests/plugin/http/sw_requests/services/provider.py
@@ -34,5 +34,5 @@ if __name__ == '__main__':
     PORT = 9091
     Handler = SimpleHTTPRequestHandler
 
-    with socketserver.TCPServer(("", PORT), Handler) as httpd:
+    with socketserver.TCPServer(('', PORT), Handler) as httpd:
         httpd.serve_forever()
diff --git a/tests/plugin/http/sw_urllib3/services/consumer.py b/tests/plugin/http/sw_urllib3/services/consumer.py
index 43ccd59..c252200 100644
--- a/tests/plugin/http/sw_urllib3/services/consumer.py
+++ b/tests/plugin/http/sw_urllib3/services/consumer.py
@@ -23,10 +23,10 @@ if __name__ == '__main__':
     app = Flask(__name__)
     import urllib3
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         http = urllib3.PoolManager()
-        res = http.request("POST", "http://provider:9091/users")
+        res = http.request('POST', 'http://provider:9091/users')
 
         return jsonify(json.loads(res.data.decode('utf-8')))
 
diff --git a/tests/plugin/http/sw_urllib3/services/provider.py b/tests/plugin/http/sw_urllib3/services/provider.py
index 0063eaa..dba7163 100644
--- a/tests/plugin/http/sw_urllib3/services/provider.py
+++ b/tests/plugin/http/sw_urllib3/services/provider.py
@@ -23,10 +23,10 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         time.sleep(0.5)
-        return jsonify({"song": "Despacito", "artist": "Luis Fonsi"})
+        return jsonify({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/web/sw_django/services/consumer.py b/tests/plugin/web/sw_django/services/consumer.py
index 065221d..43ef0de 100644
--- a/tests/plugin/web/sw_django/services/consumer.py
+++ b/tests/plugin/web/sw_django/services/consumer.py
@@ -30,7 +30,7 @@ settings.configure(
 
 
 def index(request):
-    res = requests.post("http://provider:9091/users")
+    res = requests.post('http://provider:9091/users')
     return JsonResponse(res.json())
 
 
@@ -39,7 +39,7 @@ urlpatterns = (
 )
 
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     from django.core.management import execute_from_command_line
 
     execute_from_command_line(sys.argv)
diff --git a/tests/plugin/web/sw_django/services/provider.py b/tests/plugin/web/sw_django/services/provider.py
index 1ad290e..5ae277d 100644
--- a/tests/plugin/web/sw_django/services/provider.py
+++ b/tests/plugin/web/sw_django/services/provider.py
@@ -31,15 +31,15 @@ settings.configure(
 
 def index(request):
     time.sleep(0.5)
-    return JsonResponse({"song": "Despacito", "artist": "Luis Fonsi"})
+    return JsonResponse({'song': 'Despacito', 'artist': 'Luis Fonsi'})
 
 
 urlpatterns = (
-    url("users", index),
+    url('users', index),
 )
 
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     from django.core.management import execute_from_command_line
 
     execute_from_command_line(sys.argv)
diff --git a/tests/plugin/web/sw_falcon/services/consumer.py b/tests/plugin/web/sw_falcon/services/consumer.py
index 63c9dfe..49cbf7d 100644
--- a/tests/plugin/web/sw_falcon/services/consumer.py
+++ b/tests/plugin/web/sw_falcon/services/consumer.py
@@ -20,7 +20,7 @@ import requests
 
 @hug.get('/users')
 def get():
-    res = requests.get("http://provider:9091/users")
+    res = requests.get('http://provider:9091/users')
     return res.json()
 
 
diff --git a/tests/plugin/web/sw_flask/services/consumer.py b/tests/plugin/web/sw_flask/services/consumer.py
index f61fbf9..7e0a4f0 100644
--- a/tests/plugin/web/sw_flask/services/consumer.py
+++ b/tests/plugin/web/sw_flask/services/consumer.py
@@ -24,20 +24,20 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         from skywalking.trace.context import get_context
-        get_context().put_correlation("correlation", "correlation")
+        get_context().put_correlation('correlation', 'correlation')
 
-        @runnable(op="/test")
+        @runnable(op='/test')
         def post():
-            requests.post("http://provider:9091/users")
+            requests.post('http://provider:9091/users')
 
         from threading import Thread
         t = Thread(target=post)
         t.start()
 
-        res = requests.post("http://provider:9091/users")
+        res = requests.post('http://provider:9091/users')
 
         t.join()
 
diff --git a/tests/plugin/web/sw_flask/services/provider.py b/tests/plugin/web/sw_flask/services/provider.py
index 29dfdf1..43f6d49 100644
--- a/tests/plugin/web/sw_flask/services/provider.py
+++ b/tests/plugin/web/sw_flask/services/provider.py
@@ -23,11 +23,11 @@ if __name__ == '__main__':
 
     app = Flask(__name__)
 
-    @app.route("/users", methods=["POST", "GET"])
+    @app.route('/users', methods=['POST', 'GET'])
     def application():
         from skywalking.trace.context import get_context
         time.sleep(0.5)
-        return jsonify({"correlation": get_context().get_correlation("correlation")})
+        return jsonify({'correlation': get_context().get_correlation('correlation')})
 
     PORT = 9091
     app.run(host='0.0.0.0', port=PORT, debug=True)
diff --git a/tests/plugin/web/sw_sanic/services/consumer.py b/tests/plugin/web/sw_sanic/services/consumer.py
index 2cdb6a8..a2ae35b 100644
--- a/tests/plugin/web/sw_sanic/services/consumer.py
+++ b/tests/plugin/web/sw_sanic/services/consumer.py
@@ -22,9 +22,9 @@ if __name__ == '__main__':
 
     app = Sanic(__name__)
 
-    @app.route("/users", methods=["GET"])
+    @app.route('/users', methods=['GET'])
     async def application(req):
-        res = requests.get("http://provider:9091/users")
+        res = requests.get('http://provider:9091/users')
         return response.json(res.json())
 
     PORT = 9090
diff --git a/tests/plugin/web/sw_sanic/services/provider.py b/tests/plugin/web/sw_sanic/services/provider.py
index c22baba..2cc7ba9 100644
--- a/tests/plugin/web/sw_sanic/services/provider.py
+++ b/tests/plugin/web/sw_sanic/services/provider.py
@@ -22,11 +22,11 @@ if __name__ == '__main__':
 
     app = Sanic(__name__)
 
-    @app.route("/users", methods=["GET"])
+    @app.route('/users', methods=['GET'])
     async def application(req):
         time.sleep(0.5)
         return response.json(
-            {"song": "Despacito", "artist": "Luis Fonsi"}
+            {'song': 'Despacito', 'artist': 'Luis Fonsi'}
         )
 
     PORT = 9091
diff --git a/tests/plugin/web/sw_tornado/services/consumer.py b/tests/plugin/web/sw_tornado/services/consumer.py
index bd62d11..bc2c2e3 100644
--- a/tests/plugin/web/sw_tornado/services/consumer.py
+++ b/tests/plugin/web/sw_tornado/services/consumer.py
@@ -15,19 +15,19 @@
 # limitations under the License.
 #
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     import requests
     import tornado.ioloop
     import tornado.web
 
     class MainHandler(tornado.web.RequestHandler):
         def get(self):
-            res = requests.get("http://provider:9091/users")
+            res = requests.get('http://provider:9091/users')
             self.write(res.text)
 
     def make_app():
         return tornado.web.Application([
-            (r"/users", MainHandler),
+            (r'/users', MainHandler),
         ])
 
     app = make_app()
diff --git a/tests/plugin/web/sw_tornado/services/provider.py b/tests/plugin/web/sw_tornado/services/provider.py
index d3bd8fe..c36beb5 100644
--- a/tests/plugin/web/sw_tornado/services/provider.py
+++ b/tests/plugin/web/sw_tornado/services/provider.py
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     import json
     import time
 
@@ -29,7 +29,7 @@ if __name__ == "__main__":
 
     def make_app():
         return tornado.web.Application([
-            (r"/users", MainHandler),
+            (r'/users', MainHandler),
         ])
 
     app = make_app()
diff --git a/tests/unit/test_ant_matcher.py b/tests/unit/test_ant_matcher.py
index 5865d73..819175a 100644
--- a/tests/unit/test_ant_matcher.py
+++ b/tests/unit/test_ant_matcher.py
@@ -29,64 +29,64 @@ def fast_path_match(pattern, path):
 
 class TestFastPathMatch(unittest.TestCase):
     def test_match(self):
-        pattern = "/eureka/*"
-        path = "/eureka/apps"
+        pattern = '/eureka/*'
+        path = '/eureka/apps'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/"
+        path = '/eureka/'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/apps/"
+        path = '/eureka/apps/'
         self.assertFalse(fast_path_match(pattern, path))
 
-        pattern = "/eureka/*/"
-        path = "/eureka/apps/"
+        pattern = '/eureka/*/'
+        path = '/eureka/apps/'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/"
+        path = '/eureka/'
         self.assertFalse(fast_path_match(pattern, path))
-        path = "/eureka/apps/list"
+        path = '/eureka/apps/list'
         self.assertFalse(fast_path_match(pattern, path))
 
-        pattern = "/eureka/**"
-        path = "/eureka/"
+        pattern = '/eureka/**'
+        path = '/eureka/'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/apps/test"
+        path = '/eureka/apps/test'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/apps/test/"
+        path = '/eureka/apps/test/'
         self.assertFalse(fast_path_match(pattern, path))
 
-        pattern = "eureka/apps/?"
-        path = "eureka/apps/list"
+        pattern = 'eureka/apps/?'
+        path = 'eureka/apps/list'
         self.assertFalse(fast_path_match(pattern, path))
-        path = "eureka/apps/"
+        path = 'eureka/apps/'
         self.assertFalse(fast_path_match(pattern, path))
-        path = "eureka/apps/a"
+        path = 'eureka/apps/a'
         self.assertTrue(fast_path_match(pattern, path))
 
-        pattern = "eureka/**/lists"
-        path = "eureka/apps/lists"
+        pattern = 'eureka/**/lists'
+        path = 'eureka/apps/lists'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "eureka/apps/test/lists"
+        path = 'eureka/apps/test/lists'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "eureka/apps/test/"
+        path = 'eureka/apps/test/'
         self.assertFalse(fast_path_match(pattern, path))
-        path = "eureka/apps/test"
+        path = 'eureka/apps/test'
         self.assertFalse(fast_path_match(pattern, path))
 
-        pattern = "eureka/**/test/**"
-        path = "eureka/apps/test/list"
+        pattern = 'eureka/**/test/**'
+        path = 'eureka/apps/test/list'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "eureka/apps/foo/test/list/bar"
+        path = 'eureka/apps/foo/test/list/bar'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "eureka/apps/foo/test/list/bar/"
+        path = 'eureka/apps/foo/test/list/bar/'
         self.assertFalse(fast_path_match(pattern, path))
-        path = "eureka/apps/test/list"
+        path = 'eureka/apps/test/list'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "eureka/test/list"
+        path = 'eureka/test/list'
         self.assertFalse(fast_path_match(pattern, path))
 
-        pattern = "/eureka/**/b/**/*.txt"
-        path = "/eureka/a/aa/aaa/b/bb/bbb/xxxxxx.txt"
+        pattern = '/eureka/**/b/**/*.txt'
+        path = '/eureka/a/aa/aaa/b/bb/bbb/xxxxxx.txt'
         self.assertTrue(fast_path_match(pattern, path))
-        path = "/eureka/a/aa/aaa/b/bb/bbb/xxxxxx"
+        path = '/eureka/a/aa/aaa/b/bb/bbb/xxxxxx'
         self.assertFalse(fast_path_match(pattern, path))
 
 
diff --git a/tests/unit/test_version_check.py b/tests/unit/test_version_check.py
index 81032ff..80cf6bd 100644
--- a/tests/unit/test_version_check.py
+++ b/tests/unit/test_version_check.py
@@ -18,6 +18,7 @@
 import unittest
 
 from packaging import version
+
 from skywalking.plugins import check
 from skywalking.utils.comparator import operators
 
@@ -25,76 +26,76 @@ from skywalking.utils.comparator import operators
 class TestVersionCheck(unittest.TestCase):
     def test_operators(self):
         # <
-        f = operators.get("<")
-        v1 = version.parse("1.0.0")
-        v2 = version.parse("1.0.1")
+        f = operators.get('<')
+        v1 = version.parse('1.0.0')
+        v2 = version.parse('1.0.1')
         self.assertTrue(f(v1, v2))
         self.assertFalse(f(v2, v1))
 
-        v2 = version.parse("1.0.0")
+        v2 = version.parse('1.0.0')
         self.assertFalse(f(v1, v2))
 
         # <=
-        f = operators.get("<=")
-        v1 = version.parse("1.0")
-        v2 = version.parse("1.0")
+        f = operators.get('<=')
+        v1 = version.parse('1.0')
+        v2 = version.parse('1.0')
         self.assertTrue(v1, v2)
 
-        v2 = version.parse("1.1.0")
+        v2 = version.parse('1.1.0')
         self.assertTrue(f(v1, v2))
         self.assertFalse(f(v2, v1))
 
         # =
-        f = operators.get("==")
-        v1 = version.parse("1.0.0")
-        v2 = version.parse("1.0.0")
+        f = operators.get('==')
+        v1 = version.parse('1.0.0')
+        v2 = version.parse('1.0.0')
         self.assertTrue(f(v1, v2))
 
-        v2 = version.parse("1.0.1")
+        v2 = version.parse('1.0.1')
         self.assertFalse(f(v1, v2))
 
         # >=
-        f = operators.get(">=")
-        v1 = version.parse("1.0.0")
-        v2 = version.parse("1.0.0")
+        f = operators.get('>=')
+        v1 = version.parse('1.0.0')
+        v2 = version.parse('1.0.0')
         self.assertTrue(f(v1, v2))
 
-        v2 = version.parse("1.0.1")
+        v2 = version.parse('1.0.1')
         self.assertFalse(f(v1, v2))
         self.assertTrue(f(v2, v1))
 
         # >
-        f = operators.get(">")
-        v1 = version.parse("1.0.0")
-        v2 = version.parse("1.0.1")
+        f = operators.get('>')
+        v1 = version.parse('1.0.0')
+        v2 = version.parse('1.0.1')
         self.assertFalse(f(v1, v2))
         self.assertTrue(f(v2, v1))
 
-        v2 = version.parse("1.0.0")
+        v2 = version.parse('1.0.0')
         self.assertFalse(f(v1, v2))
 
         # !=
-        f = operators.get("!=")
-        v1 = version.parse("1.0.0")
-        v2 = version.parse("1.0.1")
+        f = operators.get('!=')
+        v1 = version.parse('1.0.0')
+        v2 = version.parse('1.0.1')
         self.assertTrue(f(v1, v2))
 
-        v2 = version.parse("1.0.0")
+        v2 = version.parse('1.0.0')
         self.assertFalse(f(v1, v2))
 
     def test_version_check(self):
-        current_version = version.parse("1.8.0")
-
-        self.assertTrue(check(">1.1.0", current_version))
-        self.assertTrue(check(">=1.0.0", current_version))
-        self.assertTrue(check("<2.0.0", current_version))
-        self.assertTrue(check("<=1.8.0", current_version))
-        self.assertTrue(check("==1.8.0", current_version))
-        self.assertTrue(check("!=1.6.0", current_version))
-
-        self.assertFalse(check(">1.9.0", current_version))
-        self.assertFalse(check(">=1.8.1", current_version))
-        self.assertFalse(check("<1.8.0", current_version))
-        self.assertFalse(check("<=1.7.0", current_version))
-        self.assertFalse(check("==1.0.0", current_version))
-        self.assertFalse(check("!=1.8.0", current_version))
+        current_version = version.parse('1.8.0')
+
+        self.assertTrue(check('>1.1.0', current_version))
+        self.assertTrue(check('>=1.0.0', current_version))
+        self.assertTrue(check('<2.0.0', current_version))
+        self.assertTrue(check('<=1.8.0', current_version))
+        self.assertTrue(check('==1.8.0', current_version))
+        self.assertTrue(check('!=1.6.0', current_version))
+
+        self.assertFalse(check('>1.9.0', current_version))
+        self.assertFalse(check('>=1.8.1', current_version))
+        self.assertFalse(check('<1.8.0', current_version))
+        self.assertFalse(check('<=1.7.0', current_version))
+        self.assertFalse(check('==1.0.0', current_version))
+        self.assertFalse(check('!=1.8.0', current_version))
diff --git a/tools/check-license-header.py b/tools/check-license-header.py
index a3cc3b8..ce35ee6 100755
--- a/tools/check-license-header.py
+++ b/tools/check-license-header.py
@@ -55,12 +55,12 @@ def walk_through_dir(d) -> bool:
                 header = ' '.join([
                     line.strip(ignored_chars) for line in f.readlines() if line.startswith(comment_leading_chars)
                 ]).strip()
-                print('%s license header in file: %s' % ('✅' if license_header in header else '❌', file_path))
+                print(f"{'✅' if license_header in header else '❌'} license header in file: {file_path}")
                 checked &= license_header in header
     return checked
 
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     checked = True
     for _, directory in enumerate(sys.argv):
         checked &= walk_through_dir(directory)
diff --git a/tools/codegen.py b/tools/codegen.py
index 9016423..a2d7a81 100644
--- a/tools/codegen.py
+++ b/tools/codegen.py
@@ -35,10 +35,10 @@ def codegen():
     touch(os.path.join(dest_dir, '__init__.py'))
 
     protoc.main(['grpc_tools.protoc',
-                 '--proto_path=' + src_dir,
-                 '--python_out=' + dest_dir,
-                 '--grpc_python_out=' + dest_dir
-                 ] + [proto for proto in glob.iglob(src_dir + '/**/*.proto')])
+                 f'--proto_path={src_dir}',
+                 f'--python_out={dest_dir}',
+                 f'--grpc_python_out={dest_dir}'
+                 ] + [proto for proto in glob.iglob(f'{src_dir}/**/*.proto')])
 
     for py_file in glob.iglob(os.path.join(dest_dir, '**/*.py')):
         touch(os.path.join(os.path.dirname(py_file), '__init__.py'))
diff --git a/tools/doc/plugin_doc_gen.py b/tools/doc/plugin_doc_gen.py
index 62f14a8..bdc6d73 100644
--- a/tools/doc/plugin_doc_gen.py
+++ b/tools/doc/plugin_doc_gen.py
@@ -61,31 +61,31 @@ def generate_plugin_doc():
             if plugin.note:
                 note_entries.append(plugin.note)
         except AttributeError:
-            raise AttributeError(f"Missing attribute in {modname}, please follow the correct plugin style.")
+            raise AttributeError(f'Missing attribute in {modname}, please follow the correct plugin style.')
 
         for lib, link in zip(libs_tested, links_tested):  # NOTE: maybe a two lib support like http.server + werkzeug
             lib_entry = str(lib)
             lib_link = link
             version_vector = plugin_support_matrix[lib_entry]  # type: dict
-            pretty_vector = ""
+            pretty_vector = ''
             for python_version in version_vector:  # e.g. {'>=3.10': ['2.5', '2.6'], '>=3.6': ['2.4.1', '2.5', '2.6']}
                 lib_versions = version_vector[python_version]
-                pretty_vector += f"Python {python_version} " \
+                pretty_vector += f'Python {python_version} ' \
                                  f"- {str(lib_versions) if lib_versions else 'NOT SUPPORTED YET'}; "
-            table_entry = f"| [{lib_entry}]({lib_link}) | {pretty_vector} | `{modname}` |"
+            table_entry = f'| [{lib_entry}]({lib_link}) | {pretty_vector} | `{modname}` |'
             table_entries.append(table_entry)
 
-    with open("../../docs/en/setup/Plugins.md", "w") as plugin_doc:
+    with open('../../docs/en/setup/Plugins.md', 'w') as plugin_doc:
         plugin_doc.write(doc_head)
 
         plugin_doc.write(table_head)
         for table_entry in table_entries:
-            plugin_doc.write(f"{table_entry}\n")
+            plugin_doc.write(f'{table_entry}\n')
 
-        plugin_doc.write("### Notes\n")
+        plugin_doc.write('### Notes\n')
         for note_entry in note_entries:
-            plugin_doc.write(f"- {note_entry}\n")
+            plugin_doc.write(f'- {note_entry}\n')
 
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     generate_plugin_doc()