Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fix Go distributed tracing example #11854

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/tab-widgets/distributed-trace-receive.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Need help with this example

1. Parse the incoming `TraceContext` with
https://godoc.org/go.elastic.co/apm/module/apmhttp#ParseTraceparentHeader[`ParseTraceparentHeader`] or
https://godoc.org/go.elastic.co/apm/module/apmhttp#ParseTracestateHeader[`ParseTracestateHeader`].
https://pkg.go.dev/go.elastic.co/apm/module/apmhttp/v2#ParseTraceparentHeader[`ParseTraceparentHeader`] or
https://pkg.go.dev/go.elastic.co/apm/module/apmhttp/v2#ParseTracestateHeader[`ParseTracestateHeader`].

2. Start a new transaction or span as a child of the incoming transaction with
{apm-go-ref}/api.html#tracer-api-start-transaction-options[`StartTransactionOptions`] or
Expand All @@ -21,7 +21,7 @@ traceContext.State, _ = apmhttp.ParseTracestateHeader(r.Header["Tracestate"]...)
opts := apm.TransactionOptions{
TraceContext: traceContext, <3>
}
transaction := apm.DefaultTracer.StartTransactionOptions("GET /", "request", opts) <4>
transaction := apm.DefaultTracer().StartTransactionOptions("GET /", "request", opts) <4>
carsonip marked this conversation as resolved.
Show resolved Hide resolved
----
<1> Parse the `TraceParent` header
<2> Parse the `Tracestate` header
Expand Down
4 changes: 2 additions & 2 deletions docs/tab-widgets/distributed-trace-send.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Example:

[source,go]
----
transaction := apm.DefaultTracer.StartTransaction("GET /", "request") <1>
transaction := apm.DefaultTracer().StartTransaction("GET /", "request") <1>
traceContext := transaction.TraceContext() <2>

// Send TraceContext to receiving service
traceparent := apmhttp.FormatTraceparentHeader(traceContext)) <3>
traceparent := apmhttp.FormatTraceparentHeader(traceContext) <3>
tracestate := traceContext.State.String()
----
<1> Start a transaction
Expand Down