Skip to content

go agent , but not see span, please help me ,thanks #892

Open
@Jun661314

Description

@Jun661314

picture

Screenshot_1

Description

use /five api , but not see span

my golang code

http.HandleFunc(newrelic.WrapHandleFunc(app, "/five", five))

func five(w http.ResponseWriter, r *http.Request) {
// txn := app.StartTransaction("tThree")
txn := newrelic.FromContext(r.Context())
fmt.Println("use five")

// add span
s1 := newrelic.StartSegment(txn, "my_span_five")
defer s1.End()
fmt.Println("ok five 1")
// time.Sleep(3 * time.Second)

client := &http.Client{}
client.Transport = newrelic.NewRoundTripper(client.Transport)
request, _ := http.NewRequest("GET", "http://127.0.0.1:9091/ohterhappytwo", nil)
// request, _ := http.NewRequest("GET", "http://127.0.0.1:8080/two", nil)
request = newrelic.RequestWithTransactionContext(request, txn)
response, _ := client.Do(request)
fmt.Println("resp--", response)

// add span
s2 := newrelic.StartSegment(txn, "my_span_four_five")
defer s2.End()
fmt.Println("ok three")
// time.Sleep(12 * time.Second)

defer txn.End()

}

Environment

win11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions