Skip to content

Commit

Permalink
Merge pull request newrelic#14 from newrelic/rabolofia/infinite-tracing
Browse files Browse the repository at this point in the history
Add example for how to enable Infinite Tracing.
  • Loading branch information
purple4reina authored Jun 12, 2020
2 parents dbd00d8 + 8a27598 commit bd1ba39
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
20 changes: 20 additions & 0 deletions newrelic/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
}

0 comments on commit bd1ba39

Please sign in to comment.