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 2020/08/17 05:45:00 UTC

[skywalking-nginx-lua] branch master updated: add stauts_code (#41)

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-nginx-lua.git


The following commit(s) were added to refs/heads/master by this push:
     new d241315  add stauts_code (#41)
d241315 is described below

commit d241315048528ba5784effc3c6abeef667d7cba9
Author: Daming <zt...@foxmail.com>
AuthorDate: Mon Aug 17 13:44:53 2020 +0800

    add stauts_code (#41)
---
 lib/skywalking/tracer.lua                                             | 1 +
 test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/lib/skywalking/tracer.lua b/lib/skywalking/tracer.lua
index af0cdc6..9803337 100644
--- a/lib/skywalking/tracer.lua
+++ b/lib/skywalking/tracer.lua
@@ -77,6 +77,7 @@ function Tracer:prepareForReport()
     local TC = require('tracing_context')
     local Segment = require('segment')
     if ngx.ctx.entrySpan ~= nil then
+        Span.tag(ngx.ctx.entrySpan, 'http.status', ngx.var.status)
         Span.finish(ngx.ctx.entrySpan, ngx.now() * 1000)
         local status, segment = TC.drainAfterFinished(ngx.ctx.tracingContext)
         if status then
diff --git a/test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml b/test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml
index 49513ff..cb8f51c 100644
--- a/test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml
+++ b/test/e2e/e2e-with-mock-collector/src/test/resources/expectedData.yaml
@@ -42,6 +42,7 @@ segmentItems:
             tags:
               - {key: http.method, value: GET}
               - {key: http.params, value: 'http://127.0.0.1/tier2/lb'}
+              - {key: http.status, value: '200'}
             endTime: gt 0
             spanType: Entry
             spanId: 0
@@ -71,6 +72,7 @@ segmentItems:
             tags:
               - {key: http.method, value: GET}
               - {key: http.params, value: 'not null'}
+              - {key: http.status, value: '200'}
             endTime: gt 0
             spanType: Entry
             spanId: 0