Grafana Series Part III: Tempo - Pushing Spans Using HTTP
This article was last updated on: July 24, 2024 am
👉️URL: https://grafana.com/docs/tempo/latest/api_docs/pushing-spans-with-http/
📝Description:
Sometimes, using a tracking system can be daunting because it seems to require complex application instrumentation or SPAN ingestion pipelines in order to …
Sometimes using a tracking system can be daunting because you seem to need complex application instrumentation or span ingestion pipelines to push spans. This guide aims to demonstrate an extremely basic technique, i.e. use Zipkin Sink, push span with http/json from a Bash script.
Start Tempo
First, let’s start Tempo with the Zipkin receiver configured. To do this, create a configuration file, like this:
1 |
|
And run Tempo:
1 |
|
Push Spans
Now Tempo is running and listening on port 9411 Zipkin spans, let’s usecurl
Push a span to it.
1 |
|
Please note thattimestamp
The fields are based on microsecondFor units, it is run throughdate +%s%6N
Obtained.duration
The fields are also measured in microseconds, so 100000 is 100 milliseconds.
Receive Traces
The easiest way to get a trace is to execute a simple curl command on Tempo. The format returned is OTLP。
1 |
|
However, staring at a json blob in bash is not very interesting. Let’s start the Tempo query so we can visualize our traces. Tempo query is Jaeger Query of one GRPC Plugin, which can be used to query Tempo.
1 |
|
and open in the browser of your choicehttp://localhost:16686/trace/0123456789abcdef
to view:
More Spans
Now that we have the basics, it’s easy to move on to building our tracks. By specifying the same trace ID and a parent span ID, we can start building a trace.
1 |
|
Now, the user interface displays:
Spans from everything
Tracking is not limited to corporate languages with complex frameworks. As you can see, it’s easy to store and track events from your JS, Python, or Bash scripts. Today you can use Tempo/distributed tracing to trace CI pipelines, long-running bash processes, python data processing flows, or anything else you can think of.
Good luck with tracing!