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/03/09 23:23:21 UTC

[skywalking-nodejs] branch master updated: Axios plugin storing protocol (#37)

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-nodejs.git


The following commit(s) were added to refs/heads/master by this push:
     new cc4fe33  Axios plugin storing protocol (#37)
cc4fe33 is described below

commit cc4fe3351751bf16999ec657938595556200e8a8
Author: Tomasz Pytel <to...@gmail.com>
AuthorDate: Tue Mar 9 20:23:15 2021 -0300

    Axios plugin storing protocol (#37)
---
 src/plugins/AxiosPlugin.ts             | 4 ++--
 tests/plugins/axios/expected.data.yaml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/AxiosPlugin.ts b/src/plugins/AxiosPlugin.ts
index 60369b3..1491532 100644
--- a/src/plugins/AxiosPlugin.ts
+++ b/src/plugins/AxiosPlugin.ts
@@ -38,7 +38,7 @@ class AxiosPlugin implements SwPlugin {
     const defaultAdapter = defaults.adapter;  // this will be http adapter
 
     defaults.adapter = (config: any) => {
-      const { host, pathname: operation } = new URL(config.url);  // TODO: this may throw invalid URL
+      const {origin, host, pathname: operation} = new URL(config.url);  // TODO: this may throw invalid URL
       const span = ContextManager.current.newExitSpan(operation, host, Component.AXIOS, Component.HTTP).start();
 
       let ret: any;
@@ -47,7 +47,7 @@ class AxiosPlugin implements SwPlugin {
         span.component = Component.AXIOS;
         span.layer = SpanLayer.HTTP;
         span.peer = host;
-        span.tag(Tag.httpURL(host + operation));
+        span.tag(Tag.httpURL(origin + operation));
 
         span.inject().items.forEach((item) => {
           config.headers[item.key] = item.value;
diff --git a/tests/plugins/axios/expected.data.yaml b/tests/plugins/axios/expected.data.yaml
index 794e4be..4f0ac6e 100644
--- a/tests/plugins/axios/expected.data.yaml
+++ b/tests/plugins/axios/expected.data.yaml
@@ -63,7 +63,7 @@ segmentItems:
             skipAnalysis: false
             tags:
               - key: http.url
-                value: httpbin.org/json
+                value: http://httpbin.org/json
               - key: http.method
                 value: GET
               - key: http.status.code
@@ -102,7 +102,7 @@ segmentItems:
             spanLayer: Http
             tags:
               - key: http.url
-                value: server:5000/axios
+                value: http://server:5000/axios
               - key: http.method
                 value: GET
               - key: http.status.code