1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-07 23:02:15 +02:00
opentelemetry-go/example
Liz Fong-Jones f829598cbd Update go.mod for stackdriver exporter (#267)
* Update go.mod

* update example import
2019-10-31 15:08:26 -07:00
..
basic Support named Meters, use global package (#258) 2019-10-30 23:35:02 -07:00
http Remove the distributedctx.Mutator (#252) 2019-10-30 13:21:13 -07:00
http-stackdriver Update go.mod for stackdriver exporter (#267) 2019-10-31 15:08:26 -07:00
jaeger add more test cases to jaeger exporter and fix comments (#242) 2019-10-31 10:52:46 -07:00
namedtracer Remove the distributedctx.Mutator (#252) 2019-10-30 13:21:13 -07:00
README.md Automate getting the list of examples to build (and switch to go 1.13 to avoid module problems) (#246) 2019-10-29 08:45:48 -07:00

Example

HTTP

This is a simple example that demonstrates tracing http request from client to server. The example shows key aspects of tracing such as:

  • Root Span (on Client)
  • Child Span (on Client)
  • Child Span from a Remote Parent (on Server)
  • SpanContext Propagation (from Client to Server)
  • Span Events
  • Span Attributes

Example uses

  • open-telemetry SDK as trace instrumentation provider,
  • httptrace plugin to facilitate tracing http request on client and server
  • http trace_context propagation to propagate SpanContext on the wire.
  • stdout exporter to print information about spans in the terminal

How to run?

Prequisites

  • go 1.13 installed
  • GOPATH is configured.

1 Download git repo

GO111MODULE="" go get -d go.opentelemetry.io

2 Start Server

cd $GOPATH/src/go.opentelemetry.io/example/http/
go run ./server/server.go

3 Start Client

cd $GOPATH/src/go.opentelemetry.io/example/http/
go run ./client/client.go

4 Check traces in stdout

The spans should be visible in stdout in the order that they were exported.