You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/06/16 23:51:35 UTC

[skywalking-python] branch master updated: add component id for python Psycopg -> PostgreSQL (#124)

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

wusheng 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 6002ccc  add component id for python Psycopg -> PostgreSQL (#124)
6002ccc is described below

commit 6002ccc5e7463be8960304c30ecae55753f001dc
Author: Tomasz Pytel <to...@gmail.com>
AuthorDate: Wed Jun 16 20:51:25 2021 -0300

    add component id for python Psycopg -> PostgreSQL (#124)
---
 skywalking/__init__.py                     | 1 +
 skywalking/plugins/sw_psycopg2.py          | 6 +++---
 tests/plugin/sw_psycopg2/expected.data.yml | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/skywalking/__init__.py b/skywalking/__init__.py
index 482d39e..75f9db2 100644
--- a/skywalking/__init__.py
+++ b/skywalking/__init__.py
@@ -41,6 +41,7 @@ class Component(Enum):
     Sanic = 7007
     AioHttp = 7008
     Pyramid = 7009
+    Psycopg = 7010
 
 
 class Layer(Enum):
diff --git a/skywalking/plugins/sw_psycopg2.py b/skywalking/plugins/sw_psycopg2.py
index 1d5d137..01e65d4 100644
--- a/skywalking/plugins/sw_psycopg2.py
+++ b/skywalking/plugins/sw_psycopg2.py
@@ -40,7 +40,7 @@ def install():
 
             with get_context().new_exit_span(op="PostgreSLQ/Psycopg/execute", peer=peer) as span:
                 span.layer = Layer.Database
-                span.component = Component.PostgreSQL
+                span.component = Component.Psycopg
 
                 span.tag(Tag(key=tags.DbType, val="PostgreSQL"))
                 span.tag(Tag(key=tags.DbInstance, val=dsn['dbname']))
@@ -62,7 +62,7 @@ def install():
 
             with get_context().new_exit_span(op="PostgreSLQ/Psycopg/executemany", peer=peer) as span:
                 span.layer = Layer.Database
-                span.component = Component.PostgreSQL
+                span.component = Component.Psycopg
 
                 span.tag(Tag(key=tags.DbType, val="PostgreSQL"))
                 span.tag(Tag(key=tags.DbInstance, val=dsn['dbname']))
@@ -94,7 +94,7 @@ def install():
 
             with get_context().new_exit_span(op="PostgreSLQ/Psycopg/callproc", peer=peer) as span:
                 span.layer = Layer.Database
-                span.component = Component.PostgreSQL
+                span.component = Component.Psycopg
                 args = '(' + ('' if not parameters else ','.join(parameters)) + ')'
 
                 span.tag(Tag(key=tags.DbType, val="PostgreSQL"))
diff --git a/tests/plugin/sw_psycopg2/expected.data.yml b/tests/plugin/sw_psycopg2/expected.data.yml
index 6ff4ea5..1860ced 100644
--- a/tests/plugin/sw_psycopg2/expected.data.yml
+++ b/tests/plugin/sw_psycopg2/expected.data.yml
@@ -38,7 +38,7 @@ segmentItems:
             startTime: gt 0
             endTime: gt 0
             isError: false
-            componentId: 22
+            componentId: 7010
             spanType: Exit
             peer: postgres:5432
             skipAnalysis: false