Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for OpenTracing #55

Merged
merged 24 commits into from
Jun 13, 2018
Merged

Add support for OpenTracing #55

merged 24 commits into from
Jun 13, 2018

Conversation

xnslong
Copy link

@xnslong xnslong commented May 23, 2018

This PR will add OpenTracing support to motan-go, and then we can collect the trace data to any compatible trace systems, such as zipkin.

What we should do if we wish to take use of this capability

  1. Change configuration, add trace filter
...
motan-basicService:
example_basic_service:
  group: motan-go-example
  protocol: motan2
  registry: "direct-registry"
  filter: "accessLog,trace" # add 'trace' filter here
  serialization: simple
  nodeType: server
...
  1. Set wanted Tracer
tracer, _ := zipkintracer.NewTracer(recorder, zipkintracer.WithLogger(logger))
opentracing.SetGlobalTracer(tracer)

for tracers, please referer to OpenTracing [Github]

  1. [Optional] Set custom recording function
filter.TraceRecordingFunc = func(span opentracing.Span, data *filter.CallData) {
  // Do default recording
  filter.DefaultTraceRecordingFunc(span, data)
  // Do more recording
  span.SetTag("ca", motancore.LocalIP)
}

If not set, the filter.DefaultTraceRecordingFunc(span opentracing.Span, data *filter.CallData) is used directly, recording following information:

  • service.type
  • service.group
  • peer.host
  • peer.port
  • error

@rayzhang0603 rayzhang0603 merged commit 8a367d0 into weibocom:master Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants