SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
448 stars 122 forks source link

not work for go2sky.WithInstance(instanceName) #27

Closed qxs820624 closed 4 years ago

qxs820624 commented 5 years ago

Describe the bug A clear and concise description of what the bug is. Do reporter.NewGRPCReporter with the go2sky.TracerOption go2sky.WithInstance("instance@hostname")

but can not found the instance name "instance@hostname" at http://127.0.0.1:8080/trace on dropdown menu instance

To Reproduce

  1. Install skywalking on windows 10
  2. run /path/to/apache-skywalking-apm-bin/bin/startup.bat
  3. type testtracer.go as follow: package main

import ( "context" "log" "time"

"github.com/tetratelabs/go2sky"
"github.com/tetratelabs/go2sky/reporter"

)

func main() { report, err := reporter.NewGRPCReporter("127.0.0.1:11800") if err != nil { log.Fatalf("new reporter error %v \n", err) } tracer, err := go2sky.NewTracer("serverName", go2sky.WithReporter(report), go2sky.WithInstance("instance@hostname")) if err != nil { log.Fatalf("create tracer error %v \n", err) } tracer.WaitUntilRegister() defer report.Close()

span, ctx, err := tracer.CreateLocalSpan(context.Background())
if err != nil {
    log.Fatalf("create new local span error %v \n", err)
}
span.SetOperationName("invoke data")
span.Tag("kind", "outer")
time.Sleep(time.Second)
subSpan, _, err := tracer.CreateLocalSpan(ctx)
if err != nil {
    log.Fatalf("create new sub local span error %v \n", err)
}
subSpan.SetOperationName("invoke inner")
subSpan.Log(time.Now(), "inner", "this is right")
time.Sleep(time.Second)
subSpan.End()
time.Sleep(500 * time.Millisecond)
span.End()
time.Sleep(time.Second)

}

go run testtracer.go go2sky-gRPC2019/08/20 15:12:47 the id of service 'serverName' is 5 go2sky-gRPC2019/08/20 15:12:47 the id of instance 'instance@hostname' id is 6

  1. access to http://127.0.0.1:8080/trace select the service "serverName", then click down instance, only 2 items over there: All and serverName

Expected behavior I can found the instance "instance@hostname" at http://127.0.0.1:8080/trace in the dropdown menu "instance"

Screenshots

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

wu-sheng commented 5 years ago

@withlin Take a look?

qxs820624 commented 5 years ago

@withlin give me a hand please

 

withlin commented 5 years ago

Sorry, late reply for you. yeah. i think that it is bug. i will try fix it.

qxs820624 commented 5 years ago

@withlin okey, thanks!

qxs820624 commented 5 years ago

New clues, recording in ES, there are differences between go2sky and javaagent. first, the value of key 'properties' has 'ipv4s' only in go2sky, such as {"ipv4s":"[]"}, but much more information for javaagent, {"os_name":"Linux","host_name":"server-10-10-17-180","process_no":"26310","language":"java","ipv4s":"[\"10.10.17.180\"]"}. second, the value of key 'name' is different.