When you create Workflow Links, you use variables in the Name and URL so that span-specific content displays. Variables use the Mustache syntax.

For example, in this link definition:

Name Playbook for {{$service}} - {{MY_ERROR_TYPE_TAG}} error
URL http://wiki.com/playbook-{{$service}}-{{MY_ERROR_TYPE_TAG}}
Rules
{
  "$service": null,
  "$hasError": true,
  "MY_ERROR_TYPE_TAG": null
}
      

Both {{$service}} and {{MY_ERROR_TYPE_TAG}} are variables. The {{$service}} variable resolves to the span’s service and is a Lightstep variable (denoted by the $). The {{MY_ERROR_TYPE_TAG}} represents a user-defined variable. User-defined variables don’t use the $. Here, it represents a tag on a span. Any tag you have on your spans can be used as a variable.

User-Defined Variables

The tags that you create in your tracing code can be used as variables in Workflow Links. For example, if you’ve created the error_type tag in your code like this:

1
2
3
span = opentracing.globalTracer().startSpan('test_span');
span.setTag("error_type", "world")
span.finish()

Then you can use the {{error_type}} variable in your links. However, you need to be sure that the tag exists for the span. The easiest way to do this is to view the sidebar on the Trace View page. Tags are listed for the span there.

Lightstep Variables

The following are the Lightstep-specific variables that you can use in your Workflow Link names, URLs, and rules. Many of these also appear in the sidebar of the Trace View page.

Be sure to use a $ in front of all Lightstep variables.

Span Variables

These variables provide information about a span.

Variable Definition
$hasError The span has the tag error=true
$operation The name of the span’s operation
$parentSpanGUID The ID of this span’s parent
$service The name of the span’s service
$spanGUID The span’s ID
$traceGUID The ID of the trace that this span belongs to

Time-based Variables

These variables provide time information about the span.

Variable Definition
$durationMicros The duration of this span, in microseconds
$endTimeISO The span's end time, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$endTimeMicros The span's end time, rounded to microseconds
$endTimeMillis The span's end time, rounded to milliseconds
$endTimeMillis-5min Five minutes before the span's end time in milliseconds
$endTimeMillis+5min Five minutes after the span's end time in milliseconds
$endTimeMillis-1hr One hour before the span's end time in milliseconds
$endTimeMillis+1hr One hour after the span's end time in milliseconds
$startTimeISO The span's start time, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$startTimeISO-5min Five minutes before the span start time, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$startTimeISO+5mi The span's start time, plus five minutes, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$startTimeISO-1hr One hour before the span start time, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$startTimeISO+1hr The span's start time, plus one hour, expressed in UTC (ISO 8601 format), e.g. 2019-06-18T00:17:59.131Z
$startTimeMicros The span's start time, rounded to microseconds
$startTimeMillis The span's start time, rounded to milliseconds
$startTimeMillis-5min Five minutes before the span's start time, rounded to milliseconds
$startTimeMillis+5min The span's start time, plus five mintues, rounded to milliseconds
$startTimeMillis-1hr One hour before the span's start time, rounded to milliseconds
$startTimeMillis+1hr The span's start time, plus one hour, in milliseconds, (rounded down)
$startTimeSeconds-5min Five minutes before the span start time, rounded to seconds
$startTimeSeconds+5min The span's start time, plus five minutes, rounded to seconds
$startTimeSeconds-1hr One hour before the span start time, rounded to seconds
$startTimeSeconds+1hr The span's start time, plus one hour, rounded to seconds

Miscellaneous Variables

Variable Definition
$platform The type of client library that reported this span, for example, java, go, python
$platformVersion The version of the client library that reported this span, e.g. go1.12.5
$project Name of the Lightstep project that includes this span (as shown in the page URL)