mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-12 10:04:29 +02:00
29 lines
1.4 KiB
HTML
29 lines
1.4 KiB
HTML
<h1 id="example">Example</h1>
|
|
<h2 id="http">HTTP</h2>
|
|
<p>This is a simple example that demonstrates tracing http request from client to server. The example shows key aspects of tracing such as:</p>
|
|
<ul>
|
|
<li>Root Span (on Client)</li>
|
|
<li>Child Span (on Client)</li>
|
|
<li>Child Span from a Remote Parent (on Server)</li>
|
|
<li>SpanContext Propagation (from Client to Server)</li>
|
|
<li>Span Events</li>
|
|
<li>Span Attributes</li>
|
|
</ul>
|
|
<p>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</p>
|
|
<h3 id="how-to-run">How to run?</h3>
|
|
<h4 id="prequisites">Prequisites</h4>
|
|
<ul>
|
|
<li>go 1.13 installed</li>
|
|
<li>GOPATH is configured.</li>
|
|
</ul>
|
|
<h4 id="download-git-repo">1 Download git repo</h4>
|
|
<pre><code>GO111MODULE="" go get -d go.opentelemetry.io/otel</code></pre>
|
|
<h4 id="start-server">2 Start Server</h4>
|
|
<pre><code>cd $GOPATH/src/go.opentelemetry.io/otel/example/http/
|
|
go run ./server/server.go</code></pre>
|
|
<h4 id="start-client">3 Start Client</h4>
|
|
<pre><code>cd $GOPATH/src/go.opentelemetry.io/otel/example/http/
|
|
go run ./client/client.go</code></pre>
|
|
<h4 id="check-traces-in-stdout">4 Check traces in stdout</h4>
|
|
<p>The spans should be visible in stdout in the order that they were exported.</p>
|