1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-04 09:43:23 +02:00
opentelemetry-go/example
Yoshi Yamaguchi 9ed97980e2 Add Stackdriver Trace exporter for trace. (#160)
* Add Stackdriver Trace exporter for trace.

TODOs for future work is:

* to replace bundler.Bundler

* to add proper tests for the exporter

* to move the exporter to proper repository once it will be created.

* Change to use functions for the exporter initialization instead of
passing option struct directly.
This fix is aliging the same fix for Jaeger (#146, #161)

* Change Option struct to be function type

* Change the original Option struct to be private

* Add line comments to maxMessageEventsPerSpan to leave it for future implementation

* Fix unnessesary expressions specified by `make precommit`

Left errors by `make precommit` in experimental/bridge/opentracing.

* Ran make precommit

* Add new line at EOF

* WIP: Start implementing BatchSpanExporter interfaces

* Change to use RegisterSpanProcessor to register bsp

* Change function names to fit current implementation of sdk

* Removed google.golang.org/api/support/bundler and implement ssp and bsp

* Change spanProcessor as a member of Exporter.

* Fix option names used for BatchSpanProcessor initialization.

* Change Exporter.Shutdown just to unregister spanProcessor.

* Removed copyright statements of OpenCensus.

* Fix small typo and EOF new line

* Fix interfaces of ExportSpan/ExportSpans to meet SpanSyncer/SpanBatcher

* Change to follow context.Context passed in ExportSpan/ExportSpans

* Fix Stackdriver Exporter to hold sync.Once to lock when it is registered and
unregistered.
2019-10-08 23:33:19 -07:00
..
basic Add Stackdriver Trace exporter for trace. (#160) 2019-10-08 23:33:19 -07:00
http Add Stackdriver Trace exporter for trace. (#160) 2019-10-08 23:33:19 -07:00
http-stackdriver Add Stackdriver Trace exporter for trace. (#160) 2019-10-08 23:33:19 -07:00
README.md Add stdout trace exporter (#153) 2019-09-28 11:27:02 -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.
  • jaeger exporter to export spans to visualize and store them.

How to run?

Prequisites

  • go 1.12 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.