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 API proposal #2768

Merged
merged 22 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
054d662
wip
darccio Jul 2, 2024
6221f05
Merge branch 'v2-dev' into dario.castane/contrib-api-v2
darccio Jul 11, 2024
0fbf984
wip: fix contrib replace directives (#2783)
rarguelloF Jul 15, 2024
950fdd5
contrib-api-v2 basic implementation (#2795)
rarguelloF Jul 31, 2024
cd879f6
Migrating contribs to new Contrib API (urfave/negroni, valyala/fastht…
darccio Aug 12, 2024
adf58cf
v2: migrate contribs to new instrumentation api (2) (#2816)
rarguelloF Aug 19, 2024
f376fa4
v2: feat(contrib): migrate twitchtv/twirp, tidwall/buntdb, syndtr/gol…
darccio Aug 22, 2024
f231f23
v2: migrate contribs to new instrumentation api (3) (#2819)
rarguelloF Aug 23, 2024
fcf8440
v2: feat(contrib): migrate all pending contribs (#2829)
darccio Aug 27, 2024
ba210b9
v2: migrate grpc contrib to new instrumentation api (2) (#2828)
rarguelloF Aug 27, 2024
4432301
fix(instrumentation): change internal/namingschematest import URL
darccio Aug 27, 2024
70fa827
chore: go mod tidy
darccio Aug 27, 2024
261bff7
chore: go run tools/fixmodules
darccio Aug 27, 2024
c6fc4fe
chore: add copyright headers
darccio Aug 27, 2024
b7fb367
fix: pin to current branch
darccio Aug 27, 2024
a448b83
fix(go.work): adjust to specified format
darccio Aug 27, 2024
1a2f42b
fix: set correct segmentio/kafka-go.v0 name
darccio Aug 27, 2024
b1ed61b
fix: remove Go 1.20 support
darccio Aug 27, 2024
8888a9c
fix: set go.work version to 1.22
darccio Aug 27, 2024
5eaee6a
fix: set correct segmentio/kafka.go.v0 name
darccio Aug 28, 2024
1d90163
fix: update container_linux_test.go
darccio Aug 28, 2024
44b203d
chore: pin to latest dd-trace-go commit
darccio Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
strategy:
matrix:
runs-on: [ macos-11, macos-14 ] # oldest and newest macos runners available - macos-14 mainly is here to cover the fact it is an ARM machine
go-version: [ "1.22", "1.21", "1.20" ]
go-version: [ "1.23", "1.22" ]
fail-fast: true # saving some CI time - macos runners too long to get
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:
needs: go-mod-caching
strategy:
matrix:
go-version: [ "1.22", "1.21", "1.20" ]
go-version: [ "1.23", "1.22" ]
distribution: [ bookworm, bullseye, buster, alpine ]
platform: [ linux/amd64, linux/arm64 ]
exclude:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main-branch-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
unit-integration-tests:
strategy:
matrix:
go-version: ["1.20", "1.21", "1.22"]
go-version: ["1.22", "1.23"]
fail-fast: false
uses: ./.github/workflows/unit-integration-tests.yml
with:
Expand All @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
runs-on: [ macos-latest, windows-latest, ubuntu-latest ]
go-version: ["1.20", "1.21", "1.22"]
go-version: ["1.22", "1.23"]
fail-fast: false
uses: ./.github/workflows/multios-unit-tests.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/parametric-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.22"

- name: Build runner
uses: ./.github/actions/install_runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
name: PR Unit and Integration Tests
uses: ./.github/workflows/unit-integration-tests.yml
with:
go-version: "1.20"
go-version: "1.22"
ref: ${{ github.ref }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
matrix:
# TODO: cross-compilation from/to different hardware architectures once
# github provides native ARM runners.
go: [ "1.20", "1.21", "1.22" ]
go: [ "1.22", "1.23" ]
build-env: [ alpine, bookworm, bullseye ]
build-with-cgo: [ 0, 1 ]
deployment-env: [ alpine, debian11, debian12, al2, al2023, busybox, scratch ]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
ports:
- 9042:9042
mysql:
image: circleci/mysql:5.7
image: cimg/mysql:8.0
env:
MYSQL_ROOT_PASSWORD: admin
MYSQL_PASSWORD: test
Expand All @@ -98,7 +98,7 @@ jobs:
ports:
- 3306:3306
postgres:
image: circleci/postgres:9.5
image: cimg/postgres:16.4
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ contrib_coverage*.txt
gotestsum-report*.xml
/internal/apps/unit-of-work/unit-of-work
tools/v2check/_stage/v2playground/*
static-analysis.datadog.yml
.vscode/settings.json
12 changes: 6 additions & 6 deletions .gitlab/macrobenchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ go120-baseline:
ENABLE_PROFILING: "false"
ENABLE_APPSEC: "false"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
go120-only-trace:
Expand All @@ -120,7 +120,7 @@ go120-only-trace:
ENABLE_PROFILING: "false"
ENABLE_APPSEC: "false"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
go120-only-profile:
Expand All @@ -131,7 +131,7 @@ go120-only-profile:
ENABLE_PROFILING: "true"
ENABLE_APPSEC: "false"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
go120-profile-trace:
Expand All @@ -142,7 +142,7 @@ go120-profile-trace:
ENABLE_PROFILING: "true"
ENABLE_APPSEC: "false"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
go120-trace-asm:
Expand All @@ -153,7 +153,7 @@ go120-trace-asm:
ENABLE_PROFILING: "false"
ENABLE_APPSEC: "true"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
go120-profile-trace-asm:
Expand All @@ -164,6 +164,6 @@ go120-profile-trace-asm:
ENABLE_PROFILING: "true"
ENABLE_APPSEC: "true"
DD_PROFILING_EXECUTION_TRACE_ENABLED: "false"
GO_VERSION: "1.20.14"
GO_VERSION: "1.21.13"
LOAD_TESTS: normal_operation_io-bound,high_load_io-bound|normal_operation_cpu-bound,high_load_cpu-bound|normal_operation_cgo-cpu-bound,high_load_cgo-cpu-bound|normal_operation_cpu-bound-x-client-ip-enabled,high_load_cpu-bound-x-client-ip-enabled
PARALLELIZE: "true"
4 changes: 2 additions & 2 deletions appsec/appsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

"github.com/DataDog/dd-trace-go/v2/ddtrace/ext"
"github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
"github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/httpsec"
"github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/emitter/sharedsec"
"github.com/DataDog/dd-trace-go/v2/internal/appsec"
"github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/httpsec"
"github.com/DataDog/dd-trace-go/v2/internal/appsec/emitter/sharedsec"
"github.com/DataDog/dd-trace-go/v2/internal/log"
)

Expand Down
27 changes: 23 additions & 4 deletions contrib/99designs/gqlgen/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,28 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2022 Datadog, Inc.

// Package gqlgen provides functions to trace the 99designs/gqlgen package (https://github.com/99designs/gqlgen).
package gqlgen_test

// 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.
import (
"log"
"net/http"

"github.com/99designs/gqlgen/graphql/handler/testserver"

gqlgentrace "github.com/DataDog/dd-trace-go/contrib/99designs/gqlgen/v2"
"github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
)

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

t := gqlgentrace.NewTracer(
gqlgentrace.WithAnalytics(true),
gqlgentrace.WithService("todo.server"),
)
h := testserver.New() // replace with your own actual server
h.Use(t)
http.Handle("/query", h)
log.Fatal(http.ListenAndServe(":8080", nil))
}
16 changes: 7 additions & 9 deletions contrib/99designs/gqlgen/go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
module github.com/DataDog/dd-trace-go/contrib/99designs/gqlgen/v2

go 1.20
go 1.21

require (
github.com/99designs/gqlgen v0.17.36
github.com/DataDog/dd-trace-go/v2 v2.0.0-20240516153256-8d6fa2bea61d
github.com/stretchr/testify v1.8.4
github.com/vektah/gqlparser/v2 v2.5.8
github.com/DataDog/dd-trace-go/v2 v2.0.0-20240828085650-1d90163852f1
github.com/stretchr/testify v1.9.0
github.com/vektah/gqlparser/v2 v2.5.16
)

require (
github.com/DataDog/appsec-internal-go v1.5.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.50.0 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.50.0 // indirect
github.com/DataDog/datadog-go/v5 v5.4.0 // indirect
github.com/DataDog/dd-trace-go/contrib/net/http/v2 v2.0.0-20240516153256-8d6fa2bea61d // indirect
github.com/DataDog/go-libddwaf/v2 v2.4.2 // indirect
github.com/DataDog/go-sqllexer v0.0.10 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
Expand All @@ -26,7 +25,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ebitengine/purego v0.6.0-alpha.5 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -44,9 +43,8 @@ require (
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace "github.com/DataDog/dd-trace-go/v2" => "../../.."
replace "github.com/DataDog/dd-trace-go/contrib/net/http/v2" => "../../net/http"
replace github.com/DataDog/dd-trace-go/v2 => ../../..
Loading
Loading