The demo assumes you already have both OpenTelemetry Collector and Jaeger up and running. For setting these up, please follow the corresponding documentations:
Moreover, this demo is build against a microk8s cluster running both the OpenTelemetry Collector, and Jaeger. Therefor, the OpenTelemetry Collector configuration illustrated is a K8S ConfigurationMap. But the gist of it is there, so it shouldn't matter too much.
After this, apply the configuration to your OpenTelemetry Collector instance (with `k apply -f otel-controller-config.yaml` for k8s users). You should see that the Collector creates the otlp receiver:
Having the OpenTelemetry Collector started with the OTLP port open for traces, and connected to Jaeger, let's look at the go app that will send traces to the Collector.
First, we need to create an exporter using the otlp package:
This will initialize the exporter with the default configuration. In this configuration, it will try to connect to an otlp receiver at the address `localhost:55680`. If your OpenTelemetry Collector is running at a different address, use the [otlp.WithAddress](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp?tab=doc#WithAddress) function to change the default address.
Feel free to remove the blocking operation, but it might come in handy when testing the connection. Also, make sure to close the exporter before the app exits.
The next steps are the same as for all other otel-go sdk uses:
1) Create a trace provider from the `otlp` exporter:
* There is an issue with the exporter/Collector which causes Jaeger to throw errors when receiving spans from the OpenTelemetry Collector: https://github.com/open-telemetry/opentelemetry-collector/issues/815