Skip to content

Two simple Go microservices where `service-a` calls `service-b`. Both services expose a `/ping` endpoint.

License

Notifications You must be signed in to change notification settings

albertteoh/istio-go-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Istio Go Instrumentation Example

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!

Prerequisites

  1. Install Kubernetes

  2. Download and install Istio. This example uses Istio 1.8.

  3. Install Jaeger Addon in Istio

Getting Started

Start the example

Builds and starts the services in Istio.

$ make start

Run the example

Hit service-a's endpoint (via the istio-ingressgateway) to trigger the trace.

$ curl -w '\n' http://localhost:80/ping

Validate

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 the example

Stop and remove containers.

$ make stop

Additional References

About

Two simple Go microservices where `service-a` calls `service-b`. Both services expose a `/ping` endpoint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published