1

I am using https://github.com/GoogleCloudPlatform/google-cloud-go/tree/master/trace to send custom traces to Stackdriver Trace from GCP. All these traces end up without a service or version. How do you add that information using the trace api ?

Is there a way to add the serviceContext in trace.NewClient or the span ?

EDIT : The first answer helps but the Stackdriver UI does not show these unless they are GAE( or internal apps). Mine is a standlone Go app.

stackdriver ui

4

2 回答 2

2

You can add these two labels to the span you're creating:

trace.cloud.google.com/gae/app/module trace.cloud.google.com/gae/app/version

于 2016-12-09T22:02:27.993 回答
0

I'm having the exact same problem, here's the relevant part of my code:

    span := tc.SpanFromRequest(r)
    span.SetLabel("trace.cloud.google.com/gae/app/module", "my-service")
    span.SetLabel("trace.cloud.google.com/gae/app/version", "v0.1")
    defer span.Finish()

The dashboard shows me the correct service and version when I look at the span details, but I cannot filter by service/version, exactly as described in the original question.

Thoughts?

于 2017-08-29T09:25:20.173 回答