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 2020/12/10 16:40:03 UTC
[skywalking-python] branch polish updated (241fe08 -> 758a5e3)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a change to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git.
discard 241fe08 chore: polish #92 and minor fix to logs
new 758a5e3 chore: polish #92 and minor fix to logs
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (241fe08)
\
N -- N -- N refs/heads/polish (758a5e3)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/build.yaml | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[skywalking-python] 01/01: chore: polish #92 and minor fix to logs
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git
commit 758a5e344850838ec7fd6db5878e7544862d5b91
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Fri Dec 11 00:39:16 2020 +0800
chore: polish #92 and minor fix to logs
---
.github/workflows/build.yaml | 6 +-----
skywalking/config.py | 2 +-
skywalking/decorators.py | 16 ++++++++--------
skywalking/trace/span.py | 4 ++--
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index a881280..abc273a 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
+ python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false
env:
SW_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -42,16 +42,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Set up dependencies
- if: ${{ matrix.python-version != '3.5' }}
run: make setup install
- name: Lint codes
- if: ${{ matrix.python-version != '3.5' }}
run: make lint
- name: Check license header
- if: ${{ matrix.python-version != '3.5' }}
run: make license
- name: Run unit tests
- if: ${{ matrix.python-version != '3.5' }}
run: make test
CheckStatus:
diff --git a/skywalking/config.py b/skywalking/config.py
index e4c4cbe..4ade9a2 100644
--- a/skywalking/config.py
+++ b/skywalking/config.py
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import List
-RE_IGNORE_PATH = re.compile('^$') # type: 're.Pattern'
+RE_IGNORE_PATH = re.compile('^$') # type: re.Pattern
service_name = os.getenv('SW_AGENT_NAME') or 'Python Service Name' # type: str
service_instance = os.getenv('SW_AGENT_INSTANCE') or str(uuid.uuid1()).replace('-', '') # type: str
diff --git a/skywalking/decorators.py b/skywalking/decorators.py
index 81c4893..005210f 100644
--- a/skywalking/decorators.py
+++ b/skywalking/decorators.py
@@ -33,23 +33,23 @@ def trace(
def decorator(func):
_op = op or func.__name__
context = get_context()
+
+ span = context.new_local_span(op=_op)
+ span.layer = layer
+ span.component = component
+ [span.tag(tag) for tag in tags or []]
+
if inspect.iscoroutinefunction(func):
@wraps(func)
async def wrapper(*args, **kwargs):
- with context.new_local_span(op=_op) as span:
- span.layer = layer
- span.component = component
- [span.tag(tag) for tag in tags or []]
+ with span:
return await func(*args, **kwargs)
return wrapper
else:
@wraps(func)
def wrapper(*args, **kwargs):
- with context.new_local_span(op=_op) as span:
- span.layer = layer
- span.component = component
- [span.tag(tag) for tag in tags or []]
+ with span:
return func(*args, **kwargs)
return wrapper
diff --git a/skywalking/trace/span.py b/skywalking/trace/span.py
index c193168..24fa0f2 100644
--- a/skywalking/trace/span.py
+++ b/skywalking/trace/span.py
@@ -83,7 +83,7 @@ class Span(ABC):
def log(self, ex: Exception) -> 'Span':
self.error_occurred = True
- self.logs.append(Log(items=LogItem(key='Traceback', val=str(ex))))
+ self.logs.append(Log(items=[LogItem(key='Traceback', val=str(ex))]))
return self
def tag(self, tag: Tag) -> 'Span':
@@ -230,7 +230,7 @@ class NoopSpan(Span):
def __init__(self, context: 'SpanContext' = None, kind: 'Kind' = None):
Span.__init__(self, context=context, kind=kind)
- def extract(self, carrier: 'Carrier') -> 'Span':
+ def extract(self, carrier: 'Carrier'):
if carrier is not None:
self.context._correlation = carrier.correlation_carrier.correlation