Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
heyanlong committed Jul 10, 2019
1 parent 55a333a commit c769fed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func register(c net.Conn, j string) {
ApplicationCode: info.AppCode,
})
if regErr != nil {
fmt.Println("register error", regErr)
break
}
if regResp.GetApplication() != nil {
Expand All @@ -128,6 +129,7 @@ func register(c net.Conn, j string) {
Services: services,
})
if regErr != nil {
fmt.Println("register error", regErr)
break
}

Expand Down Expand Up @@ -173,6 +175,7 @@ func register(c net.Conn, j string) {
for {
instanceResp, instanceErr = instanceClient.RegisterInstance(instanceCtx, instanceReq)
if instanceErr != nil {
fmt.Println("register error", instanceErr)
break
}
if instanceResp.GetApplicationInstanceId() != 0 {
Expand Down Expand Up @@ -233,6 +236,7 @@ func register(c net.Conn, j string) {
for {
instanceResp, instanceErr = instanceClient.DoServiceInstanceRegister(instanceCtx, instanceReq)
if instanceErr != nil {
fmt.Println("register error", instanceErr)
break
}
if instanceResp.GetServiceInstances() != nil {
Expand Down
30 changes: 25 additions & 5 deletions src/agent/service/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,36 @@ func buildRefs6(span *agent2.SpanObjectV2, refs []ref) {
refType = agent.RefType_CrossProcess
}

spanRefs = append(spanRefs, &agent2.SegmentReference{
var reference = &agent2.SegmentReference{
RefType: refType,
ParentTraceSegmentId: buildUniqueId(rev.ParentTraceSegmentId),
ParentSpanId: rev.ParentSpanId,
ParentServiceInstanceId: rev.ParentApplicationInstanceId,
NetworkAddress: rev.NetworkAddress,
EntryServiceInstanceId: rev.EntryApplicationInstanceId,
EntryEndpoint: rev.EntryServiceName,
ParentEndpoint: rev.ParentServiceName,
})
}

if rev.NetworkAddress[0:1] == "#" {
reference.NetworkAddress = rev.NetworkAddress
} else {
i, _ := strconv.ParseInt(rev.NetworkAddress, 10, 64)
reference.NetworkAddressId = int32(i)
}

if rev.EntryServiceName[0:1] == "#" {
reference.EntryEndpoint = rev.EntryServiceName
} else {
i, _ := strconv.ParseInt(rev.EntryServiceName, 10, 64)
reference.EntryEndpointId = int32(i)
}

if rev.ParentServiceName[0:1] == "#" {
reference.ParentEndpoint = rev.ParentServiceName
} else {
i, _ := strconv.ParseInt(rev.ParentServiceName, 10, 64)
reference.ParentEndpointId = int32(i)
}

spanRefs = append(spanRefs, reference)
}

if len(spanRefs) > 0 {
Expand Down

0 comments on commit c769fed

Please sign in to comment.