去测试追踪.
go-test-trace is like go test but it also generates distributed traces.
Generated traces are exported in OTLP to a OpenTelemetry collector. You need to run go-test-trace alongside a collector to export data to distributed tracing service.
go get -u github.com/rakyll/go-test-traceYou can use go-test-trace as a drop-in replacement for go test. The following example will generate a distributed trace and export it to a collector available at "127.0.0.1:55680".
…Alternatively, you can use -stdin option to parse the output of go test. This option won't be as accurate in terms of timestamps because it will generate trace spans as it sees output in stdin.
$ go test -v ./example | go-test-trace -stdinYou can export to any collector by using the endpoint flag:
$ go-test-trace -endpoint=my-otel-collector.io:9090 ./exampleYou can make the go-test-trace to participate into an existing trace with the traceparent flag.
$ go-test-trace -traceparent=00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 ./exampleAn example collector configuration is available at example/collector.yaml. It exports to Honeycomb but you can choose to any other destination by changing the configuration. Please edit the write key and data set with your details from Honeycomb before using it.
Then, you can run the collector locally by the following command and export the traces to Honeycomb:
$ docker run --rm -p 4317:4317 -p 55680:55680 -p 8888:8888 \
-v "${PWD}/example/collector.yaml":/collector.yaml \
--name awscollector public.ecr.aws/aws-observability/aws-otel-collector:latest \
--config collector.yaml;You can use any configuration supported by ADOT or export to any other OpenTelemetry collector.
暂无开放 Issues,或尚未同步最近议题。