The current SpanTranslator in the zipkin-translation-stackdriver project does not have any way to set the StackTrace object in the Span. I would like to set an attribute on the zipkin span called /stacktrace and fill it with a protobuf TextFormat encoding of the stacktrace.
Then the SpanTranslator would deserialize the TextFormat stacktrace into a com.google.devtools.cloudtrace.v2.StackTrace object (via TextFormat.parse) and attach it to the com.google.devtools.cloudtrace.v2.Span object. It would also make sure not to set a raw String label on the span for /stacktrace. Once the trace is sent, the "Call Stack" section on the span would appear on the trace in the Stackdriver UI. It is a bit cumbersome to have to encode and then decode the Stacktrace, but the zipkin Span API does not appear to support attaching binary data to a span. This may be a breaking change if anyone uses the /stacktrace attribute for something else, but there are some ways to safeguard against that.
Rationale
I have JDBC tracing enabled (via spring-boot-datasource-decarator), and it is useful when diagnosing performance issues to find out what path of code is causing the database call. In general it can help anyone understand how remote activity is invoked in an application.
Example Scenario
Tracing is performed on a call which accesses a database.
The database call takes a while and the developer has no idea which code path makes the database call.
Developer adds stack trace into each span in their application (via Brave SpanHandler)
Capture new trace
Look inside a traced request in stackdriver, and then see the call stack. Here is a page with an example of what it would look like inside stackdriver trace UI (see Call Stack section): https://cloud.google.com/trace/docs/trace-labels
Developer identifies code path and makes necessary optimizations to it.
Prior Art
The issue is a little bit similar to #173 but different. This issue is not related to Throwables/Exceptions (but this feature could help with logging exception stack traces)
Feature
The current SpanTranslator in the zipkin-translation-stackdriver project does not have any way to set the StackTrace object in the Span. I would like to set an attribute on the zipkin span called
/stacktrace
and fill it with a protobuf TextFormat encoding of the stacktrace. Then the SpanTranslator would deserialize the TextFormat stacktrace into acom.google.devtools.cloudtrace.v2.StackTrace
object (via TextFormat.parse) and attach it to thecom.google.devtools.cloudtrace.v2.Span
object. It would also make sure not to set a raw String label on the span for/stacktrace
. Once the trace is sent, the "Call Stack" section on the span would appear on the trace in the Stackdriver UI. It is a bit cumbersome to have to encode and then decode the Stacktrace, but the zipkin Span API does not appear to support attaching binary data to a span. This may be a breaking change if anyone uses the/stacktrace
attribute for something else, but there are some ways to safeguard against that.Rationale
I have JDBC tracing enabled (via spring-boot-datasource-decarator), and it is useful when diagnosing performance issues to find out what path of code is causing the database call. In general it can help anyone understand how remote activity is invoked in an application.
Example Scenario
Prior Art