ObserveNow
...
Integrations
Applications
Go
OpenTelemetry is the recommended approach to instrument for tracing. For your Go applications, please follow the instructions in the following document to instrument:
- Determine what framework (standard or 3rd-party) your Go apps are using (e.g., net/http, gorilla/mux, etc)
- Navigate to OpenTelemetry Registry to find if the packages from (1) have an already existing instrumentation library
- Import the instrumented libraries into your app and initialize them (the trace initialization can be a one-time addition to your own shared library or, alternatively, some initTracer() func in each app)
- Wrap the handler functions to achieve the "auto" instrumentation
The example in the above links shows the above steps for the net/http package.
Here is another example:
- This sample Go app is using the gofiber/fiber package.
- We've found that instrumentation libraries exist on the OpenTelemetry Registry and clicked to verify the library names.
- Import the instrumented libraries:
- Trace initialization:
(4) Tell the app to use the middleware to auto-wrap your handlers
For production use, you'll be using the Zipkin exporter (as seen in the code).
This will make the Go application to emit spans which will be collected by the OpenTelemetry collector installed as part of the OpsVerse agent and forwarded to the tracing backend.