未验证 提交 fb4e2299 编写于 作者: 何延龙 提交者: GitHub

Merge pull request #183 from jmjoy/master

Fix the empty field bug in span refs for skywalking v6.
......@@ -6,11 +6,12 @@ import (
"agent/agent/pb/common"
"context"
"encoding/json"
"github.com/golang/protobuf/proto"
"io"
"strconv"
"strings"
"time"
"github.com/golang/protobuf/proto"
)
type upstreamSegment struct {
......@@ -322,21 +323,21 @@ func buildRefs6(span *agent2.SpanObjectV2, refs []ref) {
}
if rev.NetworkAddress[0:1] == "#" {
reference.NetworkAddress = rev.NetworkAddress
reference.NetworkAddress = rev.NetworkAddress[1:]
} else {
i, _ := strconv.ParseInt(rev.NetworkAddress, 10, 64)
reference.NetworkAddressId = int32(i)
}
if rev.EntryServiceName[0:1] == "#" {
reference.EntryEndpoint = rev.EntryServiceName
reference.EntryEndpoint = rev.EntryServiceName[1:]
} else {
i, _ := strconv.ParseInt(rev.EntryServiceName, 10, 64)
reference.EntryEndpointId = int32(i)
}
if rev.ParentServiceName[0:1] == "#" {
reference.ParentEndpoint = rev.ParentServiceName
reference.ParentEndpoint = rev.ParentServiceName[1:]
} else {
i, _ := strconv.ParseInt(rev.ParentServiceName, 10, 64)
reference.ParentEndpointId = int32(i)
......
......@@ -1257,7 +1257,7 @@ static void generate_context() {
add_assoc_long(&SKYWALKING_G(context), "parentSpanId", zend_atol(Z_STRVAL_P(sw6_3), sizeof(Z_STRVAL_P(sw6_3)) - 1));
add_assoc_long(&SKYWALKING_G(context), "parentApplicationInstance", zend_atol(Z_STRVAL_P(sw6_4), sizeof(Z_STRVAL_P(sw6_4)) - 1));
add_assoc_long(&SKYWALKING_G(context), "entryApplicationInstance", zend_atol(Z_STRVAL_P(sw6_5), sizeof(Z_STRVAL_P(sw6_5)) - 1));
add_assoc_str(&SKYWALKING_G(context), "networkAddress", trim_sharp(&sw6_6decode));
add_assoc_string(&SKYWALKING_G(context), "networkAddress", Z_STRVAL(sw6_6decode));
if (sw6_7 != NULL && sw6_8 != NULL) {
zval sw6_7decode;
......@@ -1265,8 +1265,9 @@ static void generate_context() {
zval_b64_decode(&sw6_7decode, Z_STRVAL_P(sw6_7));
zval_b64_decode(&sw6_8decode, Z_STRVAL_P(sw6_8));
add_assoc_str(&SKYWALKING_G(context), "entryOperationName", trim_sharp(&sw6_7decode));
add_assoc_str(&SKYWALKING_G(context), "parentOperationName", trim_sharp(&sw6_8decode));
add_assoc_string(&SKYWALKING_G(context), "entryOperationName", Z_STRVAL(sw6_7decode));
add_assoc_string(&SKYWALKING_G(context), "parentOperationName", Z_STRVAL(sw6_8decode));
zval_dtor(&sw6_7decode);
zval_dtor(&sw6_8decode);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册