agardnerIT / tracepusher

Generate and push OpenTelemetry Trace data to an OTEL collector in JSON format
Apache License 2.0
54 stars 11 forks source link

Allow generation of subspans #7

Closed agardnerIT closed 1 year ago

agardnerIT commented 1 year ago

By default, tracepusher automatically generates it's own trace and span IDs. This is perfect for the "default" usecase when someone just wants to push a single span trace to a backend for demo purposes.

However, consider this (slightly more complex) bash script:

#!/bin/sh
time_start=$SECONDS

do_work() {
    echo "doing work..."
    sleep 1
}

counter=1
limit=1
while [ $counter -le 2 ]
do
  do_work
  counter=$((counter+1))
done

time_end=$SECONDS

v0.3.0 (and prior) for tracepusher would only give a single span of 2 seconds. No details of the "inner working".

The enhancement described above would allow tracepusher to generate which describes the "internals", like this:

image

In this case, the user (as part of the shell script) would be responsible for generating the traceid (which would become the parent trace id). Then a new span id for each subspan. tracepusher would be called once at the "top" for the parent and then n times (in this case 2) inside the loop. Inside the loop, the parent trace ID would be the same as the original trace ID.

Perhaps this requires another flag --has-parent=True?

agardnerIT commented 1 year ago

Closed as completed with the release of v0.5.0