From 60de658341fd91984add605ae7bd8524468f22c1 Mon Sep 17 00:00:00 2001 From: huawei Date: Sun, 5 Jul 2020 16:25:05 +0800 Subject: [PATCH 1/3] add Component Id --- .gitignore | 3 ++- skywalking/__init__.py | 1 + skywalking/plugins/sw_requests/__init__.py | 2 +- tests/plugin/sw_requests/expected.data.yml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index be223d30..68472153 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ __pycache__ build/ dist/ skywalking_python.egg-info/ -*.pyc \ No newline at end of file +*.pyc +/apache_skywalking.egg-info/ \ No newline at end of file diff --git a/skywalking/__init__.py b/skywalking/__init__.py index 1dd5b458..f826ad6a 100644 --- a/skywalking/__init__.py +++ b/skywalking/__init__.py @@ -25,6 +25,7 @@ class Component(Enum): Unknown = 0 General = 7000 # built-in modules that may not have a logo to display Flask = 7001 + Requests = 7002 class Layer(Enum): diff --git a/skywalking/plugins/sw_requests/__init__.py b/skywalking/plugins/sw_requests/__init__.py index b1b6d029..32860a6d 100644 --- a/skywalking/plugins/sw_requests/__init__.py +++ b/skywalking/plugins/sw_requests/__init__.py @@ -53,7 +53,7 @@ def _sw_request(this: Session, method, url, carrier = Carrier() with context.new_exit_span(op=url_param.path or "/", peer=url_param.netloc, carrier=carrier) as span: span.layer = Layer.Http - span.component = Component.General + span.component = Component.Requests if headers is None: headers = {} diff --git a/tests/plugin/sw_requests/expected.data.yml b/tests/plugin/sw_requests/expected.data.yml index e85480f4..bfd3a760 100644 --- a/tests/plugin/sw_requests/expected.data.yml +++ b/tests/plugin/sw_requests/expected.data.yml @@ -63,7 +63,7 @@ segmentItems: value: '200' startTime: gt 0 endTime: gt 0 - componentId: 7000 + componentId: 7002 spanType: Exit peer: provider:9091 skipAnalysis: false From 510c7bb6707a69d6ea02f3d4a14b71ffd5f2794e Mon Sep 17 00:00:00 2001 From: huawei Date: Sun, 5 Jul 2020 19:04:01 +0800 Subject: [PATCH 2/3] remove skywalking_python.egg-info in .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 68472153..ae05d35f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,5 @@ __pycache__ build/ dist/ -skywalking_python.egg-info/ *.pyc /apache_skywalking.egg-info/ \ No newline at end of file From 6b5cd52bb2adb4ef301af419cb9eef33dc6af125 Mon Sep 17 00:00:00 2001 From: huawei Date: Sun, 5 Jul 2020 19:12:42 +0800 Subject: [PATCH 3/3] update requests component id --- tests/plugin/sw_flask/expected.data.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugin/sw_flask/expected.data.yml b/tests/plugin/sw_flask/expected.data.yml index aa3d2dcb..3e9d0b32 100644 --- a/tests/plugin/sw_flask/expected.data.yml +++ b/tests/plugin/sw_flask/expected.data.yml @@ -67,7 +67,7 @@ segmentItems: value: '200' startTime: gt 0 endTime: gt 0 - componentId: 7000 + componentId: 7002 spanType: Exit peer: provider:9091 skipAnalysis: false