Exemplo n.º 1
0
func (r *TCollectorReporter) report(data *tc.TraceData) error {
	ctx, cancel := tc.NewContextBuilder(time.Second).
		DisableTracing().
		SetRetryOptions(&tc.RetryOptions{RetryOn: tc.RetryNever}).
		SetShardKey(base64Encode(data.Span.TraceID())).Build()
	defer cancel()

	thriftSpan, err := buildSpan(data, r.curHostIP)
	if err != nil {
		return err
	}
	// client submit
	_, err = r.client.Submit(ctx, thriftSpan)
	return err
}
Exemplo n.º 2
0
func (r *ZipkinTraceReporter) zipkinReport(data *zipkinData) error {
	ctx, cancel := tc.NewContextBuilder(time.Second).
		DisableTracing().
		SetShardKey(base64Encode(data.Span.TraceID())).Build()
	defer cancel()

	thriftSpan, err := buildZipkinSpan(data.Span, data.Annotations, data.BinaryAnnotations, data.TargetEndpoint)
	if err != nil {
		return err
	}
	// client submit
	// ignore the response result because TChannel shouldn't care about it.
	_, err = r.client.Submit(ctx, thriftSpan)
	return err
}