From 8a27598054179573733b8fca24e535f354abdbc2 Mon Sep 17 00:00:00 2001 From: Rey Abolofia Date: Fri, 12 Jun 2020 14:44:28 -0700 Subject: [PATCH] Add example for how to enable Infinite Tracing. --- go.mod | 2 +- go.sum | 4 ++-- newrelic/example_test.go | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6453089..9d17ed1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/newrelic/opentelemetry-exporter-go go 1.13 require ( - github.com/newrelic/newrelic-telemetry-sdk-go v0.2.0 + github.com/newrelic/newrelic-telemetry-sdk-go v0.3.0 go.opentelemetry.io/otel v0.5.0 google.golang.org/grpc v1.27.1 ) diff --git a/go.sum b/go.sum index b545e1d..3295bd4 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/newrelic/newrelic-telemetry-sdk-go v0.2.0 h1:W8+lNIfAldCScGiikToSprbf3DCaMXk0VIM9l73BIpY= -github.com/newrelic/newrelic-telemetry-sdk-go v0.2.0/go.mod h1:G9MqE/cHGv3Hx3qpYhfuyFUsGx2DpVcGi1iJIqTg+JQ= +github.com/newrelic/newrelic-telemetry-sdk-go v0.3.0 h1:KKeKemCT+woxK9GOI1XxiPui/g59ldJSoU9QtfEjXRs= +github.com/newrelic/newrelic-telemetry-sdk-go v0.3.0/go.mod h1:G9MqE/cHGv3Hx3qpYhfuyFUsGx2DpVcGi1iJIqTg+JQ= github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/newrelic/example_test.go b/newrelic/example_test.go index 0733662..6df87e0 100644 --- a/newrelic/example_test.go +++ b/newrelic/example_test.go @@ -7,6 +7,7 @@ import ( "log" "os" + "github.com/newrelic/newrelic-telemetry-sdk-go/telemetry" "github.com/newrelic/opentelemetry-exporter-go/newrelic" "go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/sdk/trace" @@ -23,3 +24,22 @@ func Example() { } global.SetTraceProvider(tp) } + +func ExampleNewExporter() { + // To enable Infinite Tracing on the New Relic Edge, use the + // telemetry.ConfigSpansURLOverride along with the URL for your Trace + // Observer, including scheme and path. See + // https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/enable-configure/enable-distributed-tracing + exporter, err := newrelic.NewExporter( + "My Service", os.Getenv("NEW_RELIC_API_KEY"), + telemetry.ConfigSpansURLOverride("https://nr-internal.aws-us-east-1.tracing.edge.nr-data.net/trace/v1"), + ) + if err != nil { + log.Fatal(err) + } + tp, err := trace.NewProvider(trace.WithSyncer(exporter)) + if err != nil { + log.Fatal(err) + } + global.SetTraceProvider(tp) +}