opentracing/specification

If I want to define a record like zipkin's service name, which tag i should select?

Closed this issue · 7 comments

Hi, I am implementing a full opentraing sdk but a problem puzzle me.
If I want to define a record like zipkin's service name, which tag i should select? I find there is not tag field available, some opentracing api implementation (for example jaeger-client-go) define it in struct Tracer(https://github.com/uber/jaeger-client-go/blob/master/tracer.go) but it is not opentracing's convention.

I think define tag field for service name is necessary.

A "service name" in microservices world is essentially the application name. Such applications run one tracer instance per process, therefore there is no need to keep re-defining "service name" at the main code instrumentation level, it can be initialized once at the Tracer level, as you've seen done in Jaeger. If you check https://github.com/uber/jaeger-client-node, it's even more obvious there, because we don't even send the service name for each span, but only once as part of the batch of spans sent out of process.

Thx for your reply.As your means, if I implement a trace server satisfy opentracing format, I can define a span struct in protocol buffer(as follow) for upload information?

message Span {
string service_name = 1;
string op_name = 2;
fixed64 start_time = 3;
fixed64 duration = 4;
SpanContext ctx = 5;
repeated KeyValue tags = 6;
repeated LogRecord logs = 7;
}

a member service_name in span.

@ruinanchen Sure you can. The server depends on your implementation, not part of specification. Also with Span structure.

Off the record, IMO, I think the SpanContext should not upload to the server in most cases, the SpanContext is useful for propagation, but as a context, it often changes with the timeline. If you truly want to upload SpanContext, please make sure the every span has it own SpanContext and immutable.

@wu-sheng Very very thx~
I define SpanContext as follow:

message SpanContext {
fixed64 trace_id = 1;
fixed64 span_id = 2;
int32 flag = 3;
string debugID = 4;
map<string, string> baggage_items = 5;
}

I think if i don't upload trace_id and span_id, the span infomation is meaningless. But member flag and baggage_items is redundant.Thank you for your suggest, I should redefine span.~

Another suggestion, just from my experience, if you want to analysis the trace or traceSegment( my project's concept, part of trace in current JVM), and you are in auto-instrumentation mechanism, try not to uplink the single span, it will be difficult on analyzing the cause (exception/slow), because on streaming scenario, you do not know the context. Uplink the traceSegment will make things easier.

If you will analysis in batch mode(Hadoop) with some delay, this will be no problem.

Ref to my collector data-structure: https://github.com/wu-sheng/sky-walking/wiki/3.0-Collector-TraceSegment-in-JSON-format . Most important, this is irrelative with OT spec, just a tracer implementation, with a streaming analysis.

@wu-sheng thank you~~