The purpose of this example is to explore low-to-no effort open-source instrumentation options available for distributed tracing and understand tradeoffs between solutions. Istio is one such solution, providing the means to instrument services at their boundaries via sidecars that proxy calls in and out of the service.
This example consists of two simple Go microservices where service-a
calls service-b
. Both services expose a /ping
endpoint,
that are instrumented using Istio.
For an example of manual instrumentation with Jaeger, please see: albertteoh/jaeger-go-example.
The key takeaways are:
- There is still a need for code changes to propagate context to allow correlating inbound with outbound calls.
- The code changes are fairly minimal and involve copying specific headers (Zipkin headers in the case of Istio) from inbound to outbound HTTP requests. "Leaf" services do not require any code changes, just services making outbound calls.
- One can choose to leverage the OpenTracing API and use an implementing tracer like Jaeger, or implement their own logic to do so. In this example, the former approach of leveraging OpenTracing APIs is used.
Feedback and improvements (via PRs) are most welcome!
Builds and starts the services in Istio.
$ make start
Hit service-a
's endpoint (via the istio-ingressgateway) to trigger the trace.
$ curl -w '\n' http://localhost:80/ping
Should see service-a -> service-b
on STDOUT.
The script will open Jaeger in a browser tab where you can select service-a.default
from the "Service" dropdown and click the "Find Traces" button.
Stop and remove containers.
$ make stop