在用户界面中,我的span标签具有以下内容:
const jsonRepair = (rawJson) => {
let regex1 = /\[([^"]+)\]/g
let isNumRegex = /^[-.0-9]*\d$/g
let matches = undefined
while ((matches = regex1.exec(rawJson)) !== null) {
if (!isNumRegex.test(matches[1])) {
rawJson = rawJson.replace(matches[0], `["${matches[1]}"]`)
console.log(matches[0], `[${matches[1]}]`)
}
}
return rawJson
}
如何为每个包含跨度ID和跟踪ID的跨度添加一个附加标签?我在代码中找不到添加的位置。所以我希望标签是这样的:
http.path: "/somePath"
http.status_code: "200"
span.kind: "server"
这是当前设置我的跟踪器的方式:
http.path: "/somePath"
http.status_code: "200"
span.kind: "server"
spanID: fj30sl,
traceID: fwo21p
这是我发出请求的方式:
const ctxImpl = new(require('zipkin-context-cls'))('zipkin');
const recorder = new(require('zipkin').BatchRecorder)({
logger: new(require('zipkin-transport-http')).HttpLogger({
endpoint: `${zipkinUrl}`,
jsonEncoder: require('zipkin').jsonEncoder.JSON_V2,
}),
});
tracer = new(require('zipkin').Tracer)({
ctxImpl,
recorder,
localServiceName: 'service-1',
});