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

contrib/99designs/gqlgen: avoid adding the example dependencies into our go.mod #1499

Merged
merged 4 commits into from
Oct 11, 2022
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
28 changes: 3 additions & 25 deletions contrib/99designs/gqlgen/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,6 @@
// Package gqlgen provides functions to trace the 99designs/gqlgen package (https://github.com/99designs/gqlgen).
package gqlgen_test

import (
"log"
"net/http"

"github.com/99designs/gqlgen/_examples/todo"
"github.com/99designs/gqlgen/graphql/handler"

"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

gqlgentrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/99designs/gqlgen"
)

func Example() {
tracer.Start()
defer tracer.Stop()

t := gqlgentrace.NewTracer(
gqlgentrace.WithAnalytics(true),
gqlgentrace.WithServiceName("todo.server"),
)
h := handler.NewDefaultServer(todo.NewExecutableSchema(todo.New()))
h.Use(t)
http.Handle("/query", h)
log.Fatal(http.ListenAndServe(":8080", nil))
}
// The example was moved into the package godoc to avoid adding its dependencies into dd-trace-go's go.mod file,
// where github.com/BurntSushi/toml would be upgraded to v1, which breaks existing users of the v0, like this is the
// case at Datadog's backend. Such code examples shouldn't introduce breaking changes to dd-trace-go's go.mod file.
26 changes: 26 additions & 0 deletions contrib/99designs/gqlgen/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,32 @@
// any sensitive data in the query will be sent to Datadog as the resource name
// of the span. To ensure no sensitive data is included in your spans, always
// use parameterized graphql queries with sensitive data in variables.
//
// Usage example:
// import (
// "log"
// "net/http"
//
// "github.com/99designs/gqlgen/_examples/todo"
// "github.com/99designs/gqlgen/graphql/handler"
//
// "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
// gqlgentrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/99designs/gqlgen"
// )
//
// func Example() {
// tracer.Start()
// defer tracer.Stop()
//
// t := gqlgentrace.NewTracer(
// gqlgentrace.WithAnalytics(true),
// gqlgentrace.WithServiceName("todo.server"),
// )
// h := handler.NewDefaultServer(todo.NewExecutableSchema(todo.New()))
// h.Use(t)
// http.Handle("/query", h)
// log.Fatal(http.ListenAndServe(":8080", nil))
// }
package gqlgen

import (
Expand Down
29 changes: 14 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ go 1.17

require (
cloud.google.com/go/pubsub v1.4.0
github.com/99designs/gqlgen v0.17.16
github.com/99designs/gqlgen/_examples v0.0.0-20220829154420-b66fff16de0b
github.com/99designs/gqlgen v0.16.0
github.com/DataDog/datadog-agent/pkg/obfuscate v0.0.0-20211129110424-6491aa3bf583
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.40.0-rc.2.0.20220929172920-a43645df5cf2
github.com/DataDog/datadog-go/v5 v5.0.2
Expand Down Expand Up @@ -39,7 +38,7 @@ require (
github.com/gomodule/redigo v1.7.0
github.com/google/pprof v0.0.0-20210423192551-a2663126120b
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/mux v1.7.1
github.com/graph-gophers/graphql-go v1.3.0
github.com/hashicorp/consul/api v1.0.0
github.com/hashicorp/vault/api v1.1.0
Expand All @@ -53,20 +52,17 @@ require (
github.com/lib/pq v1.10.2
github.com/mattn/go-sqlite3 v1.14.12
github.com/miekg/dns v1.1.25
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/segmentio/kafka-go v0.4.29
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.8.0
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tidwall/buntdb v1.2.0
github.com/tidwall/grect v0.1.4 // indirect
github.com/tinylib/msgp v1.1.6
github.com/twitchtv/twirp v8.1.1+incompatible
github.com/urfave/negroni v1.0.0
github.com/valyala/fasthttp v1.34.0 // indirect
github.com/vektah/gqlparser/v2 v2.5.0
github.com/vektah/gqlparser/v2 v2.2.0
github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/zenazn/goji v1.0.1
Expand All @@ -75,7 +71,7 @@ require (
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/api v0.29.0
google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.28.0
Expand All @@ -93,11 +89,11 @@ require (

require (
cloud.google.com/go v0.57.0 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/DataDog/datadog-go v4.8.2+incompatible // indirect
github.com/DataDog/zstd v1.3.5 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/agnivade/levenshtein v1.1.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/armon/go-metrics v0.3.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.0.0 // indirect
Expand Down Expand Up @@ -129,7 +125,7 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand Down Expand Up @@ -162,22 +158,25 @@ require (
github.com/labstack/gommon v0.3.1 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.14 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/theupdateframework/go-tuf v0.3.0 // indirect
github.com/tidwall/btree v0.3.0 // indirect
github.com/tidwall/btree v1.1.0 // indirect
github.com/tidwall/gjson v1.12.1 // indirect
github.com/tidwall/grect v0.1.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/rtred v0.1.2 // indirect
Expand Down
Loading