未验证 提交 6f8e8ad7 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Fix a wrong method name and expose the upstream address as the variable (#13)

* Fix a wrong method name and expose the upstream address as the variable

* Fix words.

* Fix method name and upstream name.

* Try to fix e2e.
上级 2857bf54
......@@ -41,7 +41,14 @@ http {
default_type text/html;
rewrite_by_lua_block {
require("tracer"):start()
------------------------------------------------------
-- NOTICE, this should be changed manually
-- This variable represents the upstream logic address
-- Please set them as service logic name or DNS name
--
-- Currently, we can not have the upstream real network address
------------------------------------------------------
require("tracer"):start("upstream service")
}
-- Target upstream service
......
......@@ -51,7 +51,14 @@ http {
default_type text/html;
rewrite_by_lua_block {
require("tracer"):startBackendTimer()
------------------------------------------------------
-- NOTICE, this should be changed manually
-- This variable represents the upstream logic address
-- Please set them as service logic name or DNS name
--
-- Currently, we can not have the upstream real network address
------------------------------------------------------
require("tracer"):start("upstream service")
}
proxy_pass http://127.0.0.1:8080/tier2/lb;
......
......@@ -17,7 +17,7 @@
local Tracer = {}
function Tracer:startBackendTimer()
function Tracer:start(upstream_name)
local metadata_buffer = ngx.shared.tracing_buffer
local TC = require('tracing_context')
local Layer = require('span_layer')
......@@ -50,14 +50,8 @@ function Tracer:startBackendTimer()
-- Use the same URI to represent incoming and forwarding requests
-- Change it if you need.
local upstreamUri = ngx.var.uri
------------------------------------------------------
-- NOTICE, this should be changed manually
-- This variable represents the upstream logic address
-- Please set them as service logic name or DNS name
--
-- TODO, currently, we can't have the upstream real network address
------------------------------------------------------
local upstreamServerName = serviceName .. "-nginx:upstream_ip:port"
local upstreamServerName = upstream_name
------------------------------------------------------
local exitSpan = tracingContext:createExitSpan(upstreamUri, entrySpan, upstreamServerName, contextCarrier)
exitSpan:start(ngx.now() * 1000)
......
......@@ -52,7 +52,7 @@ http {
default_type text/html;
rewrite_by_lua_block {
require("tracer"):startBackendTimer()
require("tracer"):start("User_Service_Name-nginx:upstream_ip:port")
}
proxy_pass http://127.0.0.1:8080/tier2/lb;
......@@ -70,7 +70,7 @@ http {
default_type text/html;
rewrite_by_lua_block {
require("tracer"):startBackendTimer()
require("tracer"):start("User_Service_Name-nginx:upstream_ip2:port2")
}
proxy_pass http://127.0.0.1:8080/backend;
......
......@@ -19,7 +19,7 @@ segmentItems:
isError: false
parentSpanId: 0
componentId: 6000
peer: 'User_Service_Name-nginx:upstream_ip:port'
peer: 'User_Service_Name-nginx:upstream_ip2:port2'
spanLayer: HTTP
- operationName: /tier2/lb
startTime: gt 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册