diff --git a/.github/workflows/apps/parse/parse_version.go b/.github/workflows/apps/parse/parse_version.go index 92eae3d1ce..1c36bdf06e 100644 --- a/.github/workflows/apps/parse/parse_version.go +++ b/.github/workflows/apps/parse/parse_version.go @@ -8,7 +8,7 @@ package main import ( "fmt" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal/version" ) func ghOutput(varName, v string) string { diff --git a/.github/workflows/appsec.yml b/.github/workflows/appsec.yml index 8a051bc475..ba9f9db6ff 100644 --- a/.github/workflows/appsec.yml +++ b/.github/workflows/appsec.yml @@ -151,6 +151,7 @@ jobs: - run: docker run --platform=linux/arm64 -v $PWD:$PWD -w $PWD -eCGO_ENABLED=${{ matrix.cgo_enabled }} -eDD_APPSEC_ENABLED=${{ matrix.appsec_enabled }} -eDD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT golang go test -v -tags appsec $TO_TEST smoke-tests: - uses: DataDog/appsec-go-test-app/.github/workflows/smoke-tests.yml@main + # TODO(darccio): change to main branch on v2 release + uses: DataDog/appsec-go-test-app/.github/workflows/smoke-tests.yml@dario.castane/AIT-3705/dd-trace-go.v2 with: dd-trace-go-version: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/parametric-tests.yml b/.github/workflows/parametric-tests.yml index d85d2626a4..1fa1c052e0 100644 --- a/.github/workflows/parametric-tests.yml +++ b/.github/workflows/parametric-tests.yml @@ -40,7 +40,7 @@ jobs: - name: Patch dd-trace-go version run: | cd utils/build/docker/golang/parametric/ - echo "replace gopkg.in/DataDog/dd-trace-go.v1 => ./dd-trace-go" >> go.mod + echo "replace github.com/DataDog/dd-trace-go/v2 => ./dd-trace-go" >> go.mod go mod tidy - name: Build runner diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index a6aebfc997..912d56cdd1 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -93,7 +93,8 @@ jobs: uses: actions/checkout@v3 with: repository: 'DataDog/system-tests' - ref: ${{ inputs.ref }} + # TODO(darccio): remove ref on v2 release + ref: 5af583da64c7458daf3fdf5e5538b90cdc4d9154 - name: Checkout dd-trace-go uses: actions/checkout@v3 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d467cb47c..a274d19140 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - benchmarks + - macrobenchmarks - test-apps variables: @@ -12,4 +13,5 @@ variables: include: - ".gitlab/benchmarks.yml" + - ".gitlab/macrobenchmarks.yml" - ".gitlab/test-apps.yml" diff --git a/.gitlab/macrobenchmarks.yml b/.gitlab/macrobenchmarks.yml new file mode 100644 index 0000000000..5eaac47b69 --- /dev/null +++ b/.gitlab/macrobenchmarks.yml @@ -0,0 +1,169 @@ +variables: + BENCHMARKS_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:go-go-prof-app + +.benchmarks: + stage: macrobenchmarks + needs: [] + tags: ["runner:apm-k8s-same-cpu"] + timeout: 1h + rules: + - if: $CI_COMMIT_REF_NAME == "master" + when: always + - when: manual + # If you have a problem with Gitlab cache, see Troubleshooting section in Benchmarking Platform docs + image: $BENCHMARKS_CI_IMAGE + script: + - git clone --branch go/go-prof-app https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform + - "./generate-run-plan-and-run-benchmarks.sh" + artifacts: + name: "artifacts" + when: always + paths: + - platform/artifacts/ + expire_in: 3 months + variables: + FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "true" # Important tweak for stability of benchmarks + KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: dd-trace-go + DD_INSTRUMENTATION_TELEMETRY_ENABLED: "true" + DD_INSTRUMENTATION_TELEMETRY_DEBUG: "true" + # Used to build the SUT + GO_PROF_APP_BUILD_VARIANT: "candidate" + DD_TRACE_GO_VERSION: "latest" + + + # Workaround: Currently we're not running the benchmarks on every PR, but GitHub still shows them as pending. + # By marking the benchmarks as allow_failure, this should go away. (This workaround should be removed once the + # benchmarks get changed to run on every PR) + allow_failure: true +go118-baseline: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "false" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go118-only-trace: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go118-only-profile: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "false" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go118-profile-trace: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go118-trace-asm: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "true" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go118-profile-trace-asm: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "true" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.18" + 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" +go119-baseline: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "false" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" +go119-only-trace: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" +go119-only-profile: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "false" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" +go119-profile-trace: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "false" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" +go119-trace-asm: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "false" + ENABLE_APPSEC: "true" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" +go119-profile-trace-asm: + extends: .benchmarks + variables: + ENABLE_DDPROF: "false" + ENABLE_TRACING: "true" + ENABLE_PROFILING: "true" + ENABLE_APPSEC: "true" + DD_PROFILING_EXECUTION_TRACE_ENABLED: "false" + GO_VERSION: "1.19" + 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" diff --git a/.golangci.yml b/.golangci.yml index ee85c1a03e..aac4c8ddf6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,7 @@ linters-settings: gci: sections: - standard - - prefix(gopkg.in/DataDog/dd-trace-go.v1) + - prefix(github.com/DataDog/dd-trace-go/v2) - default skip-generated: true custom-order: true diff --git a/MIGRATING.md b/MIGRATING.md index 84f5bf4926..9c34bea10d 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -4,9 +4,9 @@ This document outlines migrating from an older version of the Datadog tracer (0. Datadog's v1 version of the Go tracer provides not only an overhauled core that comes with huge performance improvements, but also the promise of a new and stable API to be relied on. It is the result of continuous feedback from customers, the community, as well as our extensive internal usage. -As is common and recommended in the Go community, the best way to approach migrating to this new API is by using the [gradual code repair](https://talks.golang.org/2016/refactor.article) method. We have done the same internally and it has worked just great! For this exact reason we have provided a new, [semver](https://semver.org/) friendly import path to help with using both tracers in parallel, without conflict, for the duration of the migration. This new path is `gopkg.in/DataDog/dd-trace-go.v1`. +As is common and recommended in the Go community, the best way to approach migrating to this new API is by using the [gradual code repair](https://talks.golang.org/2016/refactor.article) method. We have done the same internally and it has worked just great! For this exact reason we have provided a new, [semver](https://semver.org/) friendly import path to help with using both tracers in parallel, without conflict, for the duration of the migration. This new path is `github.com/DataDog/dd-trace-go/v2`. -Our [godoc page](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace) should deem helpful during this process. We also have the [official documentation](https://docs.datadoghq.com/tracing/setup/go/), which contains a couple of examples. +Our [godoc page](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace) should deem helpful during this process. We also have the [official documentation](https://docs.datadoghq.com/tracing/setup/go/), which contains a couple of examples. This document will further outline some _before_ and _after_ examples. @@ -32,15 +32,15 @@ tracer.Start( defer tracer.Stop() ``` -Notice that the tracer object is no longer returned. Consult the documentation to see [all possible parameters](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#StartOption) to the `Start` call. +Notice that the tracer object is no longer returned. Consult the documentation to see [all possible parameters](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#StartOption) to the `Start` call. ## Service Information -The [`tracer.SetServiceInfo`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Tracer.SetServiceInfo) method has been deprecated. The service information is now set automatically based on the value of the [`ext.SpanType`](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext#SpanType) tag that was set on the root span of a trace. +The [`tracer.SetServiceInfo`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Tracer.SetServiceInfo) method has been deprecated. The service information is now set automatically based on the value of the [`ext.SpanType`](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/ext#SpanType) tag that was set on the root span of a trace. ## Spans -Starting spans is now possible with [functional options](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#StartSpanOption). Which means that all span properties (or none) can be set when starting a span dynamically. Before: +Starting spans is now possible with [functional options](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#StartSpanOption). Which means that all span properties (or none) can be set when starting a span dynamically. Before: ```go span := tracer.NewRootSpan("web.request", "my_service", "resource_name") @@ -52,7 +52,7 @@ Becomes: span := tracer.StartSpan("web.request", tracer.ServiceName("my_service"), tracer.ResourceName("resource_name")) ``` -We've done this because in many cases the extra parameters could become tedious, given that service names can be inherited and resource names can default to the operation name. This also allows us to have one single, more dynamic API for starting both root and child spans. Check out all possible [StartSpanOption](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#StartSpanOption) values to get an idea. +We've done this because in many cases the extra parameters could become tedious, given that service names can be inherited and resource names can default to the operation name. This also allows us to have one single, more dynamic API for starting both root and child spans. Check out all possible [StartSpanOption](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#StartSpanOption) values to get an idea. ### Children @@ -60,7 +60,7 @@ Here is an example for spawning a child of the previously declared span: ```go child := tracer.StartSpan("process.user", tracer.ChildOf(span.Context())) ``` -You will notice that the new tracer also introduces the concept of [SpanContext](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace#SpanContext), which is different from Go's context and is used to carry information needed to spawn children of a specific span and can be propagated cross-process. To learn more about distributed tracing check the package-level [documentation](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#ChildOf) of the `tracer` package. +You will notice that the new tracer also introduces the concept of [SpanContext](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace#SpanContext), which is different from Go's context and is used to carry information needed to spawn children of a specific span and can be propagated cross-process. To learn more about distributed tracing check the package-level [documentation](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#ChildOf) of the `tracer` package. ### Using Go's context @@ -68,11 +68,11 @@ It is also possible to create children of spans that live inside Go's [context]( ```go child, ctx := tracer.StartSpanFromContext(ctx, "process.user", tracer.Tag("key", "value")) ``` -This will create a child of the span which exists inside the passed context and return it, along with a new context which contains the new span. To add or retrieve a span from a context use the [`ContextWithSpan`](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#ContextWithSpan) or [`SpanFromContext`](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#SpanFromContext) functions. +This will create a child of the span which exists inside the passed context and return it, along with a new context which contains the new span. To add or retrieve a span from a context use the [`ContextWithSpan`](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#ContextWithSpan) or [`SpanFromContext`](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#SpanFromContext) functions. ### Setting errors -The [`SetError`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.SetError) has been deprecated in favour of the [`ext.Error`](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext#Error) tag value which matches other tracing libraries in the wild. Whereas before we had: +The [`SetError`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.SetError) has been deprecated in favour of the [`ext.Error`](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/ext#Error) tag value which matches other tracing libraries in the wild. Whereas before we had: ```go span.SetError(err) @@ -88,7 +88,7 @@ Note that this tag can accept value of the types `error`, `string` and `bool` as ### Finishing -The [`FinishWithErr`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.FinishWithErr) and [`FinishWithTime`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.FinishWithTime) methods have been removed in favour of a set of [`FinishOption`](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#FinishOption). For example, this would now become: +The [`FinishWithErr`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.FinishWithErr) and [`FinishWithTime`](https://godoc.org/github.com/DataDog/dd-trace-go/tracer#Span.FinishWithTime) methods have been removed in favour of a set of [`FinishOption`](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer#FinishOption). For example, this would now become: ```go span.Finish(tracer.WithError(err), tracer.FinishTime(t)) @@ -100,5 +100,5 @@ Providing a `nil` value as an error is perfectly fine and will not mark the span The new version of the tracer also comes with a lot of new features, such as support for distributed tracing and distributed sampling priority. -* package level documentation of the [`tracer` package](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer) for a better overview. +* package level documentation of the [`tracer` package](https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer) for a better overview. * [official documentation](https://docs.datadoghq.com/tracing/setup/go/) diff --git a/README.md b/README.md index 315360cecb..33b672689b 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,17 @@ [![APM Parametric Tests](https://github.com/DataDog/dd-trace-go/actions/workflows/parametric-tests.yml/badge.svg)](https://github.com/DataDog/dd-trace-go/actions/workflows/parametric-tests.yml) [![codecov](https://codecov.io/gh/DataDog/dd-trace-go/branch/v1/graph/badge.svg?token=jGG20Xhv8i)](https://codecov.io/gh/DataDog/dd-trace-go) -[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1) +[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2) ### Datadog Client Libraries for Go This repository contains Go packages for the client-side components of the Datadog product suite for Application Performance Monitoring, Continuous Profiling and Application Security Monitoring of Go applications. - [Datadog Application Performance Monitoring (APM)](https://docs.datadoghq.com/tracing/): Trace requests as they flow across web servers, databases and microservices so that developers have great visiblity into bottlenecks and troublesome requests. -The package [`gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer`](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer) allows you to trace any piece of your Go code, and commonly used Go libraries can be automatically traced thanks to our out-of-the-box integrations which can be found in the package [`gopkg.in/DataDog/dd-trace-go.v1/ddtrace/contrib`](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib). +The package [`github.com/DataDog/dd-trace-go/v2/ddtrace/tracer`](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer) allows you to trace any piece of your Go code, and commonly used Go libraries can be automatically traced thanks to our out-of-the-box integrations which can be found in the package [`github.com/DataDog/dd-trace-go/v2/ddtrace/contrib`](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib). - [Datadog Go Continuous Profiler](https://docs.datadoghq.com/profiler/): Continuously profile your Go apps to find CPU, memory, and synchronization bottlenecks, broken down by function name, and line number, to significantly reduce end-user latency and infrastructure costs. -The package [`gopkg.in/DataDog/dd-trace-go.v1/profiler`](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/profiler) allows you to periodically collect and send Go profiles to the Datadog API. +The package [`github.com/DataDog/dd-trace-go/v2/profiler`](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/profiler) allows you to periodically collect and send Go profiles to the Datadog API. - [Datadog Application Security Monitoring (ASM)](https://docs.datadoghq.com/security_platform/application_security/): Get observability into your Go apps attacks that aim to exploit code-level vulnerabilities, such as Server-Side-Request-Forgery (SSRF), SQL injection, Log4Shell, and Reflected Cross-Site-Scripting (XSS). ASM is not a standalone Go package and is transparently integrated into the APM tracer. Simply [enable it](https://docs.datadoghq.com/security_platform/application_security/setup_and_configure/?code-lang=go) to benefit from the security monitoring. @@ -23,21 +23,21 @@ The package [`gopkg.in/DataDog/dd-trace-go.v1/profiler`](https://pkg.go.dev/gopk This module contains many packages, but most users should probably install the two packages below: ```bash -go get gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer -go get gopkg.in/DataDog/dd-trace-go.v1/profiler +go get github.com/DataDog/dd-trace-go/v2/ddtrace/tracer +go get github.com/DataDog/dd-trace-go/v2/profiler ``` -Additionally there are many [contrib](./contrib) packages that can be installed to automatically instrument and trace commonly used Go libraries such as [net/http](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http), [gorilla/mux](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux) or [database/sql](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql): +Additionally there are many [contrib](./contrib) packages that can be installed to automatically instrument and trace commonly used Go libraries such as [net/http](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib/net/http), [gorilla/mux](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib/gorilla/mux) or [database/sql](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib/database/sql): ``` -go get gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux +go get github.com/DataDog/dd-trace-go/v2/contrib/gorilla/mux ``` If you installed more packages than you intended, you can use `go mod tidy` to remove any unused packages. ### Documentation - - [APM Tracing API](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/ddtrace) + - [APM Tracing API](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/ddtrace) - [APM Tracing Go Applications](https://docs.datadoghq.com/tracing/setup/go/) - [Continuous Go Profiler](https://docs.datadoghq.com/tracing/profiler/enabling/go) - [Application Security Monitoring](https://docs.datadoghq.com/security_platform/application_security/setup_and_configure/?code-lang=go) diff --git a/appsec/appsec.go b/appsec/appsec.go index 6566bcaaa9..478e00b738 100644 --- a/appsec/appsec.go +++ b/appsec/appsec.go @@ -15,12 +15,12 @@ import ( "context" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/sharedsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/sharedsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) var appsecDisabledLog sync.Once diff --git a/appsec/appsec_test.go b/appsec/appsec_test.go index eb0e4f579a..5be4b2ee85 100644 --- a/appsec/appsec_test.go +++ b/appsec/appsec_test.go @@ -9,10 +9,10 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - privateAppsec "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + privateAppsec "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/stretchr/testify/require" ) diff --git a/appsec/example_test.go b/appsec/example_test.go index c0b238a789..d7c21b95d1 100644 --- a/appsec/example_test.go +++ b/appsec/example_test.go @@ -10,9 +10,9 @@ import ( "io" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/appsec" - echotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/labstack/echo.v4" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/appsec" + echotrace "github.com/DataDog/dd-trace-go/v2/contrib/labstack/echo.v4" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" "github.com/labstack/echo/v4" ) diff --git a/contrib/99designs/gqlgen/option.go b/contrib/99designs/gqlgen/option.go index 64e51990f4..068e5e8623 100644 --- a/contrib/99designs/gqlgen/option.go +++ b/contrib/99designs/gqlgen/option.go @@ -8,8 +8,8 @@ package gqlgen import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "graphql" diff --git a/contrib/99designs/gqlgen/tracer.go b/contrib/99designs/gqlgen/tracer.go index b6146071c2..dae63b8b2c 100644 --- a/contrib/99designs/gqlgen/tracer.go +++ b/contrib/99designs/gqlgen/tracer.go @@ -21,8 +21,8 @@ // "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" +// "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" +// gqlgentrace "github.com/DataDog/dd-trace-go/v2/contrib/99designs/gqlgen" // ) // // func Example() { @@ -47,11 +47,11 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/99designs/gqlgen/graphql" "github.com/vektah/gqlparser/v2/ast" diff --git a/contrib/99designs/gqlgen/tracer_test.go b/contrib/99designs/gqlgen/tracer_test.go index fbc769773d..1db9da33f5 100644 --- a/contrib/99designs/gqlgen/tracer_test.go +++ b/contrib/99designs/gqlgen/tracer_test.go @@ -8,10 +8,10 @@ package gqlgen import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/lists" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/lists" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql" diff --git a/contrib/IBM/sarama.v1/example_test.go b/contrib/IBM/sarama.v1/example_test.go index 3990625b15..4f2d197f01 100644 --- a/contrib/IBM/sarama.v1/example_test.go +++ b/contrib/IBM/sarama.v1/example_test.go @@ -8,8 +8,8 @@ package sarama_test import ( "log" - saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/IBM/sarama.v1" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + saramatrace "github.com/DataDog/dd-trace-go/v2/contrib/IBM/sarama.v1" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/IBM/sarama" ) diff --git a/contrib/IBM/sarama.v1/headers.go b/contrib/IBM/sarama.v1/headers.go index 288a0bbb19..ec6b473d50 100644 --- a/contrib/IBM/sarama.v1/headers.go +++ b/contrib/IBM/sarama.v1/headers.go @@ -6,7 +6,7 @@ package sarama import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/IBM/sarama" ) diff --git a/contrib/IBM/sarama.v1/option.go b/contrib/IBM/sarama.v1/option.go index 23461fbad8..8c3ab70732 100644 --- a/contrib/IBM/sarama.v1/option.go +++ b/contrib/IBM/sarama.v1/option.go @@ -8,8 +8,8 @@ package sarama import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "kafka" diff --git a/contrib/IBM/sarama.v1/sarama.go b/contrib/IBM/sarama.v1/sarama.go index 946a61ef70..e9855b6107 100644 --- a/contrib/IBM/sarama.v1/sarama.go +++ b/contrib/IBM/sarama.v1/sarama.go @@ -4,16 +4,16 @@ // Copyright 2016 Datadog, Inc. // Package sarama provides functions to trace the IBM/sarama package (https://github.com/IBM/sarama). -package sarama // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/IBM/sarama" +package sarama // import "github.com/DataDog/dd-trace-go/v2/contrib/IBM/sarama" import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/IBM/sarama" ) diff --git a/contrib/IBM/sarama.v1/sarama_test.go b/contrib/IBM/sarama.v1/sarama_test.go index f759640410..75cbe38668 100644 --- a/contrib/IBM/sarama.v1/sarama_test.go +++ b/contrib/IBM/sarama.v1/sarama_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/IBM/sarama" "github.com/stretchr/testify/assert" diff --git a/contrib/README.md b/contrib/README.md index 41401a3d4c..736c0d4116 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,4 +1,4 @@ -[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib) +[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/DataDog/dd-trace-go/v2/contrib) The purpose of these packages is to provide tracing on top of commonly used packages from the standard library as well as the community in a "plug-and-play" manner. This means that by simply importing the appropriate path, functions are exposed having @@ -25,7 +25,7 @@ If the value is determined to be `internal`, then omit the tag as that is the as * The `component` tag should be set in all spans with the value equivalent to full naming convention of the integration package explained in the previous step. Each integration comes with thorough documentation and usage examples. A good overview can be seen on our -[godoc](https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib) page. +[godoc](https://godoc.org/github.com/DataDog/dd-trace-go/v2/contrib) page. ### Instrumentation telemetry diff --git a/contrib/Shopify/sarama/example_test.go b/contrib/Shopify/sarama/example_test.go index 97455012ea..bd60302e0e 100644 --- a/contrib/Shopify/sarama/example_test.go +++ b/contrib/Shopify/sarama/example_test.go @@ -8,8 +8,8 @@ package sarama_test import ( "log" - saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + saramatrace "github.com/DataDog/dd-trace-go/v2/contrib/Shopify/sarama" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/Shopify/sarama" ) diff --git a/contrib/Shopify/sarama/headers.go b/contrib/Shopify/sarama/headers.go index 8d5fc56af0..87044360f7 100644 --- a/contrib/Shopify/sarama/headers.go +++ b/contrib/Shopify/sarama/headers.go @@ -6,7 +6,7 @@ package sarama import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/Shopify/sarama" ) diff --git a/contrib/Shopify/sarama/option.go b/contrib/Shopify/sarama/option.go index f2443b6a82..431f727ef6 100644 --- a/contrib/Shopify/sarama/option.go +++ b/contrib/Shopify/sarama/option.go @@ -8,8 +8,8 @@ package sarama import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "kafka" diff --git a/contrib/Shopify/sarama/sarama.go b/contrib/Shopify/sarama/sarama.go index f1e5b9fee1..b43cc3746b 100644 --- a/contrib/Shopify/sarama/sarama.go +++ b/contrib/Shopify/sarama/sarama.go @@ -4,19 +4,19 @@ // Copyright 2016 Datadog, Inc. // Package sarama provides functions to trace the Shopify/sarama package (https://github.com/Shopify/sarama). -package sarama // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama" +package sarama // import "github.com/DataDog/dd-trace-go/v2/contrib/Shopify/sarama" import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams/options" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/datastreams/options" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/Shopify/sarama" ) diff --git a/contrib/Shopify/sarama/sarama_test.go b/contrib/Shopify/sarama/sarama_test.go index 4237f6e764..05064c7ea6 100644 --- a/contrib/Shopify/sarama/sarama_test.go +++ b/contrib/Shopify/sarama/sarama_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/Shopify/sarama" "github.com/stretchr/testify/assert" diff --git a/contrib/aws/aws-sdk-go-v2/aws/aws.go b/contrib/aws/aws-sdk-go-v2/aws/aws.go index 971ef7fbc8..9e5e240571 100644 --- a/contrib/aws/aws-sdk-go-v2/aws/aws.go +++ b/contrib/aws/aws-sdk-go-v2/aws/aws.go @@ -12,14 +12,14 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/internal/awsnamingschema" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/internal/tags" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/aws/internal/awsnamingschema" + "github.com/DataDog/dd-trace-go/v2/contrib/aws/internal/tags" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" diff --git a/contrib/aws/aws-sdk-go-v2/aws/aws_test.go b/contrib/aws/aws-sdk-go-v2/aws/aws_test.go index 3c45d1a1a7..657fc8d7ad 100644 --- a/contrib/aws/aws-sdk-go-v2/aws/aws_test.go +++ b/contrib/aws/aws-sdk-go-v2/aws/aws_test.go @@ -15,9 +15,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/aws/aws-sdk-go-v2/aws" awsconfig "github.com/aws/aws-sdk-go-v2/config" diff --git a/contrib/aws/aws-sdk-go-v2/aws/example_test.go b/contrib/aws/aws-sdk-go-v2/aws/example_test.go index 5aa271f153..cb65686533 100644 --- a/contrib/aws/aws-sdk-go-v2/aws/example_test.go +++ b/contrib/aws/aws-sdk-go-v2/aws/example_test.go @@ -9,7 +9,7 @@ import ( "context" "log" - awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go-v2/aws" + awstrace "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go-v2/aws" awscfg "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/sqs" diff --git a/contrib/aws/aws-sdk-go-v2/aws/option.go b/contrib/aws/aws-sdk-go-v2/aws/option.go index 755c5a6679..9f98846b38 100644 --- a/contrib/aws/aws-sdk-go-v2/aws/option.go +++ b/contrib/aws/aws-sdk-go-v2/aws/option.go @@ -8,7 +8,7 @@ package aws import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" ) type config struct { diff --git a/contrib/aws/aws-sdk-go/aws/aws.go b/contrib/aws/aws-sdk-go/aws/aws.go index f37533ce30..a72e48f636 100644 --- a/contrib/aws/aws-sdk-go/aws/aws.go +++ b/contrib/aws/aws-sdk-go/aws/aws.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package aws provides functions to trace aws/aws-sdk-go (https://github.com/aws/aws-sdk-go). -package aws // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws" +package aws // import "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws" import ( "errors" @@ -13,14 +13,14 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/internal/awsnamingschema" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/internal/tags" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/aws/internal/awsnamingschema" + "github.com/DataDog/dd-trace-go/v2/contrib/aws/internal/tags" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/session" @@ -42,9 +42,9 @@ func init() { const ( // SendHandlerName is the name of the Datadog NamedHandler for the Send phase of an awsv1 request - SendHandlerName = "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws/handlers.Send" + SendHandlerName = "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws/handlers.Send" // CompleteHandlerName is the name of the Datadog NamedHandler for the Complete phase of an awsv1 request - CompleteHandlerName = "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws/handlers.Complete" + CompleteHandlerName = "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws/handlers.Complete" ) type handlers struct { diff --git a/contrib/aws/aws-sdk-go/aws/aws_test.go b/contrib/aws/aws-sdk-go/aws/aws_test.go index 1972376803..98defa3e02 100644 --- a/contrib/aws/aws-sdk-go/aws/aws_test.go +++ b/contrib/aws/aws-sdk-go/aws/aws_test.go @@ -17,11 +17,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" diff --git a/contrib/aws/aws-sdk-go/aws/example_test.go b/contrib/aws/aws-sdk-go/aws/example_test.go index a240331e44..a513bf008d 100644 --- a/contrib/aws/aws-sdk-go/aws/example_test.go +++ b/contrib/aws/aws-sdk-go/aws/example_test.go @@ -6,7 +6,7 @@ package aws_test import ( - awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws" + awstrace "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" diff --git a/contrib/aws/aws-sdk-go/aws/option.go b/contrib/aws/aws-sdk-go/aws/option.go index df3100e741..798e074435 100644 --- a/contrib/aws/aws-sdk-go/aws/option.go +++ b/contrib/aws/aws-sdk-go/aws/option.go @@ -8,7 +8,7 @@ package aws import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" ) type config struct { diff --git a/contrib/aws/internal/awsnamingschema/awsnamingschema.go b/contrib/aws/internal/awsnamingschema/awsnamingschema.go index 810d354d13..0eddb6e1a7 100644 --- a/contrib/aws/internal/awsnamingschema/awsnamingschema.go +++ b/contrib/aws/internal/awsnamingschema/awsnamingschema.go @@ -9,7 +9,7 @@ import ( "fmt" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) // GetV0SpanNameFunc is used to generate the AWS span names for naming schema V0. diff --git a/contrib/bradfitz/gomemcache/memcache/example_test.go b/contrib/bradfitz/gomemcache/memcache/example_test.go index 76e7d7347d..350ffad2dc 100644 --- a/contrib/bradfitz/gomemcache/memcache/example_test.go +++ b/contrib/bradfitz/gomemcache/memcache/example_test.go @@ -8,8 +8,8 @@ package memcache_test import ( "context" - memcachetrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/bradfitz/gomemcache/memcache" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + memcachetrace "github.com/DataDog/dd-trace-go/v2/contrib/bradfitz/gomemcache/memcache" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/bradfitz/gomemcache/memcache" ) diff --git a/contrib/bradfitz/gomemcache/memcache/memcache.go b/contrib/bradfitz/gomemcache/memcache/memcache.go index 106a9255f3..83c5053545 100644 --- a/contrib/bradfitz/gomemcache/memcache/memcache.go +++ b/contrib/bradfitz/gomemcache/memcache/memcache.go @@ -9,17 +9,17 @@ // the same methods, so should be seamless for existing applications. It also // has an additional `WithContext` method which can be used to connect a span // to an existing trace. -package memcache // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/bradfitz/gomemcache/memcache" +package memcache // import "github.com/DataDog/dd-trace-go/v2/contrib/bradfitz/gomemcache/memcache" import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/bradfitz/gomemcache/memcache" ) diff --git a/contrib/bradfitz/gomemcache/memcache/memcache_test.go b/contrib/bradfitz/gomemcache/memcache/memcache_test.go index ee6ed368c7..d348e81c63 100644 --- a/contrib/bradfitz/gomemcache/memcache/memcache_test.go +++ b/contrib/bradfitz/gomemcache/memcache/memcache_test.go @@ -15,11 +15,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/bradfitz/gomemcache/memcache" "github.com/stretchr/testify/assert" diff --git a/contrib/bradfitz/gomemcache/memcache/option.go b/contrib/bradfitz/gomemcache/memcache/option.go index 0656dd699d..9b2549e31a 100644 --- a/contrib/bradfitz/gomemcache/memcache/option.go +++ b/contrib/bradfitz/gomemcache/memcache/option.go @@ -8,8 +8,8 @@ package memcache import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const ( diff --git a/contrib/cloud.google.com/go/pubsub.v1/example_test.go b/contrib/cloud.google.com/go/pubsub.v1/example_test.go index 8f7798e9c2..54cc2da1c3 100644 --- a/contrib/cloud.google.com/go/pubsub.v1/example_test.go +++ b/contrib/cloud.google.com/go/pubsub.v1/example_test.go @@ -9,7 +9,7 @@ import ( "context" "log" - pubsubtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/cloud.google.com/go/pubsub.v1" + pubsubtrace "github.com/DataDog/dd-trace-go/v2/contrib/cloud.google.com/go/pubsub.v1" "cloud.google.com/go/pubsub" ) diff --git a/contrib/cloud.google.com/go/pubsub.v1/option.go b/contrib/cloud.google.com/go/pubsub.v1/option.go index ad11cb3e01..70072438b2 100644 --- a/contrib/cloud.google.com/go/pubsub.v1/option.go +++ b/contrib/cloud.google.com/go/pubsub.v1/option.go @@ -6,7 +6,7 @@ package pubsub import ( - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) type config struct { diff --git a/contrib/cloud.google.com/go/pubsub.v1/pubsub.go b/contrib/cloud.google.com/go/pubsub.v1/pubsub.go index feb10a860e..59972a5b54 100644 --- a/contrib/cloud.google.com/go/pubsub.v1/pubsub.go +++ b/contrib/cloud.google.com/go/pubsub.v1/pubsub.go @@ -10,11 +10,11 @@ import ( "context" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "cloud.google.com/go/pubsub" ) diff --git a/contrib/cloud.google.com/go/pubsub.v1/pubsub_test.go b/contrib/cloud.google.com/go/pubsub.v1/pubsub_test.go index 2715bb4307..e0db0ba0f5 100644 --- a/contrib/cloud.google.com/go/pubsub.v1/pubsub_test.go +++ b/contrib/cloud.google.com/go/pubsub.v1/pubsub_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "cloud.google.com/go/pubsub" "cloud.google.com/go/pubsub/pstest" diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/example_test.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/example_test.go index 9798b7158a..025d256caa 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/example_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/example_test.go @@ -8,8 +8,8 @@ package kafka_test import ( "fmt" - kafkatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go/kafka.v2" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + kafkatrace "github.com/DataDog/dd-trace-go/v2/contrib/confluentinc/confluent-kafka-go/kafka.v2" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/v2/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/headers.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/headers.go index d940513ff8..990c1914d7 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/headers.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/headers.go @@ -6,7 +6,7 @@ package kafka import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/v2/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka.go index 8c7ae41542..f4306a0796 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka.go @@ -4,20 +4,20 @@ // Copyright 2016 Datadog, Inc. // Package kafka provides functions to trace the confluentinc/confluent-kafka-go package (https://github.com/confluentinc/confluent-kafka-go). -package kafka // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go/kafka" +package kafka // import "github.com/DataDog/dd-trace-go/v2/contrib/confluentinc/confluent-kafka-go/kafka" import ( "context" "math" "time" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams/options" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/datastreams/options" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/confluentinc/confluent-kafka-go/v2/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka_test.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka_test.go index 32dfa1e9eb..fcd8c46271 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/kafka_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/stretchr/testify/assert" diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/option.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/option.go index d946a426ed..19c4a114fa 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/option.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/option.go @@ -11,8 +11,8 @@ import ( "net" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/confluentinc/confluent-kafka-go/v2/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka.v2/option_test.go b/contrib/confluentinc/confluent-kafka-go/kafka.v2/option_test.go index c97e149801..939c1fc902 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka.v2/option_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka.v2/option_test.go @@ -9,7 +9,7 @@ import ( "math" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/example_test.go b/contrib/confluentinc/confluent-kafka-go/kafka/example_test.go index baefad6b45..a4419bb18d 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/example_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/example_test.go @@ -8,8 +8,8 @@ package kafka_test import ( "fmt" - kafkatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go/kafka" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + kafkatrace "github.com/DataDog/dd-trace-go/v2/contrib/confluentinc/confluent-kafka-go/kafka" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/headers.go b/contrib/confluentinc/confluent-kafka-go/kafka/headers.go index 3f66e98be5..60d61cecb3 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/headers.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/headers.go @@ -6,7 +6,7 @@ package kafka import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/kafka.go b/contrib/confluentinc/confluent-kafka-go/kafka/kafka.go index c0c9a91c29..ddea26d087 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/kafka.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/kafka.go @@ -4,20 +4,20 @@ // Copyright 2016 Datadog, Inc. // Package kafka provides functions to trace the confluentinc/confluent-kafka-go package (https://github.com/confluentinc/confluent-kafka-go). -package kafka // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go/kafka" +package kafka // import "github.com/DataDog/dd-trace-go/v2/contrib/confluentinc/confluent-kafka-go/kafka" import ( "context" "math" "time" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams/options" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/datastreams/options" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/kafka_test.go b/contrib/confluentinc/confluent-kafka-go/kafka/kafka_test.go index 2196beda41..6829b6e060 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/kafka_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/kafka_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/datastreams" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/confluentinc/confluent-kafka-go/kafka" "github.com/stretchr/testify/assert" diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/option.go b/contrib/confluentinc/confluent-kafka-go/kafka/option.go index 514f54fff0..e1e4689ad3 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/option.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/option.go @@ -11,8 +11,8 @@ import ( "net" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/contrib/confluentinc/confluent-kafka-go/kafka/option_test.go b/contrib/confluentinc/confluent-kafka-go/kafka/option_test.go index c97e149801..939c1fc902 100644 --- a/contrib/confluentinc/confluent-kafka-go/kafka/option_test.go +++ b/contrib/confluentinc/confluent-kafka-go/kafka/option_test.go @@ -9,7 +9,7 @@ import ( "math" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" ) diff --git a/contrib/database/sql/conn.go b/contrib/database/sql/conn.go index 1300683ea5..0bcb0303bf 100644 --- a/contrib/database/sql/conn.go +++ b/contrib/database/sql/conn.go @@ -3,7 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package sql // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" +package sql // import "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" import ( "context" @@ -11,10 +11,10 @@ import ( "math" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" ) var _ driver.Conn = (*TracedConn)(nil) diff --git a/contrib/database/sql/conn_test.go b/contrib/database/sql/conn_test.go index e3d295b7a9..9484196f4c 100644 --- a/contrib/database/sql/conn_test.go +++ b/contrib/database/sql/conn_test.go @@ -13,8 +13,8 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/go-sql-driver/mysql" "github.com/lib/pq" diff --git a/contrib/database/sql/example_test.go b/contrib/database/sql/example_test.go index 769e363a3e..2d31a640fa 100644 --- a/contrib/database/sql/example_test.go +++ b/contrib/database/sql/example_test.go @@ -9,9 +9,9 @@ import ( "context" "log" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-sql-driver/mysql" "github.com/lib/pq" diff --git a/contrib/database/sql/exec_trace_test.go b/contrib/database/sql/exec_trace_test.go index ffeffb0907..ce35ed0c3b 100644 --- a/contrib/database/sql/exec_trace_test.go +++ b/contrib/database/sql/exec_trace_test.go @@ -22,9 +22,9 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/httpmem" + "github.com/DataDog/dd-trace-go/v2/contrib/database/sql/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/httpmem" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/database/sql/internal/dsn.go b/contrib/database/sql/internal/dsn.go index 6a7f11dffc..30022098c4 100644 --- a/contrib/database/sql/internal/dsn.go +++ b/contrib/database/sql/internal/dsn.go @@ -3,13 +3,13 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package internal // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql/internal" +package internal // import "github.com/DataDog/dd-trace-go/v2/contrib/database/sql/internal" import ( "net" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" ) // ParseDSN parses various supported DSN types into a map of key/value pairs which can be used as valid tags. diff --git a/contrib/database/sql/internal/dsn_test.go b/contrib/database/sql/internal/dsn_test.go index 6d283e6fc8..e657c48177 100644 --- a/contrib/database/sql/internal/dsn_test.go +++ b/contrib/database/sql/internal/dsn_test.go @@ -8,7 +8,7 @@ package internal import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/stretchr/testify/assert" ) diff --git a/contrib/database/sql/internal/sqlserver.go b/contrib/database/sql/internal/sqlserver.go index 1851e1b631..38f1443197 100644 --- a/contrib/database/sql/internal/sqlserver.go +++ b/contrib/database/sql/internal/sqlserver.go @@ -11,7 +11,7 @@ import ( nurl "net/url" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" ) func parseSQLServerURL(url string) (map[string]string, error) { diff --git a/contrib/database/sql/option.go b/contrib/database/sql/option.go index 433971fab8..d67fb51c84 100644 --- a/contrib/database/sql/option.go +++ b/contrib/database/sql/option.go @@ -10,9 +10,9 @@ import ( "math" "os" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) type config struct { diff --git a/contrib/database/sql/option_test.go b/contrib/database/sql/option_test.go index 6196b8771b..a1cedeb195 100644 --- a/contrib/database/sql/option_test.go +++ b/contrib/database/sql/option_test.go @@ -8,7 +8,7 @@ package sql import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" ) diff --git a/contrib/database/sql/propagation_test.go b/contrib/database/sql/propagation_test.go index de9287ecac..54210be63f 100644 --- a/contrib/database/sql/propagation_test.go +++ b/contrib/database/sql/propagation_test.go @@ -11,10 +11,10 @@ import ( "regexp" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/database/sql/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/database/sql/sql.go b/contrib/database/sql/sql.go index 459b6fa007..367aaaea2f 100644 --- a/contrib/database/sql/sql.go +++ b/contrib/database/sql/sql.go @@ -23,10 +23,10 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/database/sql/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) const componentName = "database/sql" diff --git a/contrib/database/sql/sql_test.go b/contrib/database/sql/sql_test.go index c92e2517b1..b7e69536f7 100644 --- a/contrib/database/sql/sql_test.go +++ b/contrib/database/sql/sql_test.go @@ -17,10 +17,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" mssql "github.com/denisenkom/go-mssqldb" "github.com/go-sql-driver/mysql" diff --git a/contrib/database/sql/tx.go b/contrib/database/sql/tx.go index c6d160bbfd..6b5947c534 100644 --- a/contrib/database/sql/tx.go +++ b/contrib/database/sql/tx.go @@ -11,7 +11,7 @@ import ( "runtime/trace" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" ) var _ driver.Tx = (*tracedTx)(nil) diff --git a/contrib/dimfeld/httptreemux.v5/contextmux_test.go b/contrib/dimfeld/httptreemux.v5/contextmux_test.go index b7d8e8aaa6..36444e9977 100644 --- a/contrib/dimfeld/httptreemux.v5/contextmux_test.go +++ b/contrib/dimfeld/httptreemux.v5/contextmux_test.go @@ -10,9 +10,9 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/dimfeld/httptreemux/v5" "github.com/stretchr/testify/assert" diff --git a/contrib/dimfeld/httptreemux.v5/example_test.go b/contrib/dimfeld/httptreemux.v5/example_test.go index 9ca850f619..c086f7a4e1 100644 --- a/contrib/dimfeld/httptreemux.v5/example_test.go +++ b/contrib/dimfeld/httptreemux.v5/example_test.go @@ -10,9 +10,9 @@ import ( "log" "net/http" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/dimfeld/httptreemux.v5" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/dimfeld/httptreemux.v5" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) func Index(w http.ResponseWriter, _ *http.Request, _ map[string]string) { diff --git a/contrib/dimfeld/httptreemux.v5/httptreemux.go b/contrib/dimfeld/httptreemux.v5/httptreemux.go index 50e2ed6a7d..239bc460c3 100644 --- a/contrib/dimfeld/httptreemux.v5/httptreemux.go +++ b/contrib/dimfeld/httptreemux.v5/httptreemux.go @@ -4,17 +4,17 @@ // Copyright 2016 Datadog, Inc. // Package httptreemux provides functions to trace the dimfeld/httptreemux/v5 package (https://github.com/dimfeld/httptreemux). -package httptreemux // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/dimfeld/httptreemux.v5" +package httptreemux // import "github.com/DataDog/dd-trace-go/v2/contrib/dimfeld/httptreemux.v5" import ( "net/http" "strings" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/dimfeld/httptreemux/v5" ) @@ -49,11 +49,13 @@ func New(opts ...RouterOption) *Router { // ServeHTTP implements http.Handler. func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { resource := r.config.resourceNamer(r.TreeMux, w, req) + route, _ := getRoute(r.TreeMux, w, req) // pass r.TreeMux to avoid a circular reference panic on calling r.ServeHTTP httptrace.TraceAndServe(r.TreeMux, w, req, &httptrace.ServeConfig{ Service: r.config.serviceName, Resource: resource, SpanOpts: r.config.spanOpts, + Route: route, }) } @@ -82,11 +84,13 @@ func NewWithContext(opts ...RouterOption) *ContextRouter { // ServeHTTP implements http.Handler. func (r *ContextRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { resource := r.config.resourceNamer(r.TreeMux, w, req) + route, _ := getRoute(r.TreeMux, w, req) // pass r.TreeMux to avoid a circular reference panic on calling r.ServeHTTP httptrace.TraceAndServe(r.TreeMux, w, req, &httptrace.ServeConfig{ Service: r.config.serviceName, Resource: resource, SpanOpts: r.config.spanOpts, + Route: route, }) } @@ -95,10 +99,18 @@ func (r *ContextRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { // route from the request. If the lookup fails to find a match the route is set // to "unknown". func defaultResourceNamer(router *httptreemux.TreeMux, w http.ResponseWriter, req *http.Request) string { + route, ok := getRoute(router, w, req) + if !ok { + route = "unknown" + } + return req.Method + " " + route +} + +func getRoute(router *httptreemux.TreeMux, w http.ResponseWriter, req *http.Request) (string, bool) { route := req.URL.Path lr, found := router.Lookup(w, req) if !found { - return req.Method + " unknown" + return "", false } for k, v := range lr.Params { // replace parameter surrounded by a set of "/", i.e. ".../:param/..." @@ -113,5 +125,5 @@ func defaultResourceNamer(router *httptreemux.TreeMux, w http.ResponseWriter, re newP = "/:" + k route = strings.Replace(route, oldP, newP, 1) } - return req.Method + " " + route + return route, true } diff --git a/contrib/dimfeld/httptreemux.v5/httptreemux_test.go b/contrib/dimfeld/httptreemux.v5/httptreemux_test.go index d478fc3218..9cf7c305b5 100644 --- a/contrib/dimfeld/httptreemux.v5/httptreemux_test.go +++ b/contrib/dimfeld/httptreemux.v5/httptreemux_test.go @@ -10,10 +10,10 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/dimfeld/httptreemux/v5" "github.com/stretchr/testify/assert" @@ -44,6 +44,7 @@ func TestHttpTracer200(t *testing.T) { assert.Equal("http://example.com"+url, s.Tag(ext.HTTPURL)) assert.Equal("testvalue", s.Tag("testkey")) assert.Equal(nil, s.Tag(ext.Error)) + assert.Equal("/200", s.Tag(ext.HTTPRoute)) } func TestHttpTracer404(t *testing.T) { @@ -71,6 +72,7 @@ func TestHttpTracer404(t *testing.T) { assert.Equal("http://example.com"+url, s.Tag(ext.HTTPURL)) assert.Equal("testvalue", s.Tag("testkey")) assert.Equal(nil, s.Tag(ext.Error)) + assert.NotContains(s.Tags(), ext.HTTPRoute) } func TestHttpTracer500(t *testing.T) { @@ -98,6 +100,7 @@ func TestHttpTracer500(t *testing.T) { assert.Equal("http://example.com"+url, s.Tag(ext.HTTPURL)) assert.Equal("testvalue", s.Tag("testkey")) assert.Equal("500: Internal Server Error", s.Tag(ext.Error).(error).Error()) + assert.Equal("/500", s.Tag(ext.HTTPRoute)) } func TestDefaultResourceNamer(t *testing.T) { @@ -170,6 +173,7 @@ func TestDefaultResourceNamer(t *testing.T) { assert.Equal(tc.method, s.Tag(ext.HTTPMethod)) assert.Equal("http://example.com"+tc.url, s.Tag(ext.HTTPURL)) assert.Equal(nil, s.Tag(ext.Error)) + assert.Equal(tc.path, s.Tag(ext.HTTPRoute)) }) } } diff --git a/contrib/dimfeld/httptreemux.v5/option.go b/contrib/dimfeld/httptreemux.v5/option.go index a5b1301364..293fafedc3 100644 --- a/contrib/dimfeld/httptreemux.v5/option.go +++ b/contrib/dimfeld/httptreemux.v5/option.go @@ -9,8 +9,8 @@ package httptreemux import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/dimfeld/httptreemux/v5" ) diff --git a/contrib/elastic/go-elasticsearch.v6/elastictrace.go b/contrib/elastic/go-elasticsearch.v6/elastictrace.go index eaf0a3e6c8..75797f6ddc 100644 --- a/contrib/elastic/go-elasticsearch.v6/elastictrace.go +++ b/contrib/elastic/go-elasticsearch.v6/elastictrace.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package elastic provides functions to trace the github.com/elastic/go-elasticsearch packages. -package elastic // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch +package elastic // import "github.com/DataDog/dd-trace-go/v2/contrib/elastic/go-elasticsearch import ( "bufio" @@ -18,10 +18,10 @@ import ( "regexp" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" ) const componentName = "elastic/go-elasticsearch.v6" diff --git a/contrib/elastic/go-elasticsearch.v6/elastictrace_v6_test.go b/contrib/elastic/go-elasticsearch.v6/elastictrace_v6_test.go index c5e4abe04c..78a85b698a 100644 --- a/contrib/elastic/go-elasticsearch.v6/elastictrace_v6_test.go +++ b/contrib/elastic/go-elasticsearch.v6/elastictrace_v6_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" elasticsearch6 "github.com/elastic/go-elasticsearch/v6" esapi6 "github.com/elastic/go-elasticsearch/v6/esapi" diff --git a/contrib/elastic/go-elasticsearch.v6/elastictrace_v7_test.go b/contrib/elastic/go-elasticsearch.v6/elastictrace_v7_test.go index 0ec177f4a6..c44ad1ef0e 100644 --- a/contrib/elastic/go-elasticsearch.v6/elastictrace_v7_test.go +++ b/contrib/elastic/go-elasticsearch.v6/elastictrace_v7_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" elasticsearch7 "github.com/elastic/go-elasticsearch/v7" esapi7 "github.com/elastic/go-elasticsearch/v7/esapi" diff --git a/contrib/elastic/go-elasticsearch.v6/elastictrace_v8_test.go b/contrib/elastic/go-elasticsearch.v6/elastictrace_v8_test.go index 8b0844e287..117bed6daa 100644 --- a/contrib/elastic/go-elasticsearch.v6/elastictrace_v8_test.go +++ b/contrib/elastic/go-elasticsearch.v6/elastictrace_v8_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" elasticsearch8 "github.com/elastic/go-elasticsearch/v8" esapi8 "github.com/elastic/go-elasticsearch/v8/esapi" diff --git a/contrib/elastic/go-elasticsearch.v6/example_test.go b/contrib/elastic/go-elasticsearch.v6/example_test.go index 783c629194..3042497aba 100644 --- a/contrib/elastic/go-elasticsearch.v6/example_test.go +++ b/contrib/elastic/go-elasticsearch.v6/example_test.go @@ -9,8 +9,8 @@ import ( "log" "strings" - elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + elastictrace "github.com/DataDog/dd-trace-go/v2/contrib/elastic/go-elasticsearch.v6" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" elasticsearch "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8/esapi" diff --git a/contrib/elastic/go-elasticsearch.v6/option.go b/contrib/elastic/go-elasticsearch.v6/option.go index b5bdd72c6f..01ce0bbacd 100644 --- a/contrib/elastic/go-elasticsearch.v6/option.go +++ b/contrib/elastic/go-elasticsearch.v6/option.go @@ -9,8 +9,8 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "elastic.client" diff --git a/contrib/emicklei/go-restful.v3/example_test.go b/contrib/emicklei/go-restful.v3/example_test.go index 80ea371e88..9967ebb0cd 100644 --- a/contrib/emicklei/go-restful.v3/example_test.go +++ b/contrib/emicklei/go-restful.v3/example_test.go @@ -10,8 +10,8 @@ import ( "log" "net/http" - restfultrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/emicklei/go-restful.v3" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + restfultrace "github.com/DataDog/dd-trace-go/v2/contrib/emicklei/go-restful.v3" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/emicklei/go-restful/v3" ) diff --git a/contrib/emicklei/go-restful.v3/option.go b/contrib/emicklei/go-restful.v3/option.go index bc200c3e30..ac39463c4d 100644 --- a/contrib/emicklei/go-restful.v3/option.go +++ b/contrib/emicklei/go-restful.v3/option.go @@ -8,10 +8,10 @@ package restful import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "go-restful" diff --git a/contrib/emicklei/go-restful.v3/restful.go b/contrib/emicklei/go-restful.v3/restful.go index b0a005cb02..87e4c48000 100644 --- a/contrib/emicklei/go-restful.v3/restful.go +++ b/contrib/emicklei/go-restful.v3/restful.go @@ -9,12 +9,12 @@ package restful import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/emicklei/go-restful/v3" ) @@ -35,10 +35,13 @@ func FilterFunc(configOpts ...Option) restful.FilterFunction { log.Debug("contrib/emicklei/go-restful/v3: Creating tracing filter: %#v", cfg) spanOpts := []ddtrace.StartSpanOption{tracer.ServiceName(cfg.serviceName)} return func(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { - spanOpts := append(spanOpts, tracer.ResourceName(req.SelectedRoutePath())) - spanOpts = append(spanOpts, tracer.Tag(ext.Component, componentName)) - spanOpts = append(spanOpts, tracer.Tag(ext.SpanKind, ext.SpanKindServer)) - + spanOpts := append( + spanOpts, + tracer.ResourceName(req.SelectedRoutePath()), + tracer.Tag(ext.Component, componentName), + tracer.Tag(ext.SpanKind, ext.SpanKindServer), + tracer.Tag(ext.HTTPRoute, req.SelectedRoutePath()), + ) if !math.IsNaN(cfg.analyticsRate) { spanOpts = append(spanOpts, tracer.Tag(ext.EventSampleRate, cfg.analyticsRate)) } diff --git a/contrib/emicklei/go-restful.v3/restful_test.go b/contrib/emicklei/go-restful.v3/restful_test.go index 52f43a5f1f..983edafe9c 100644 --- a/contrib/emicklei/go-restful.v3/restful_test.go +++ b/contrib/emicklei/go-restful.v3/restful_test.go @@ -13,13 +13,13 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/emicklei/go-restful/v3" "github.com/stretchr/testify/assert" @@ -161,6 +161,7 @@ func TestTrace200(t *testing.T) { assert.Equal("http://example.com/user/123", span.Tag(ext.HTTPURL)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) assert.Equal("emicklei/go-restful.v3", span.Tag(ext.Component)) + assert.Equal("/user/{id}", span.Tag(ext.HTTPRoute)) } func TestError(t *testing.T) { diff --git a/contrib/emicklei/go-restful/example_test.go b/contrib/emicklei/go-restful/example_test.go index 7f85b6b421..674a7f8ee7 100644 --- a/contrib/emicklei/go-restful/example_test.go +++ b/contrib/emicklei/go-restful/example_test.go @@ -10,8 +10,8 @@ import ( "log" "net/http" - restfultrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/emicklei/go-restful" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + restfultrace "github.com/DataDog/dd-trace-go/v2/contrib/emicklei/go-restful" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/emicklei/go-restful" ) diff --git a/contrib/emicklei/go-restful/option.go b/contrib/emicklei/go-restful/option.go index bc200c3e30..ac39463c4d 100644 --- a/contrib/emicklei/go-restful/option.go +++ b/contrib/emicklei/go-restful/option.go @@ -8,10 +8,10 @@ package restful import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "go-restful" diff --git a/contrib/emicklei/go-restful/restful.go b/contrib/emicklei/go-restful/restful.go index 164c3fd263..1291a502a8 100644 --- a/contrib/emicklei/go-restful/restful.go +++ b/contrib/emicklei/go-restful/restful.go @@ -12,12 +12,12 @@ package restful import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/emicklei/go-restful" ) diff --git a/contrib/emicklei/go-restful/restful_test.go b/contrib/emicklei/go-restful/restful_test.go index 57a83ddae5..5f8d118d7b 100644 --- a/contrib/emicklei/go-restful/restful_test.go +++ b/contrib/emicklei/go-restful/restful_test.go @@ -13,13 +13,13 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/emicklei/go-restful" "github.com/stretchr/testify/assert" diff --git a/contrib/garyburd/redigo/example_test.go b/contrib/garyburd/redigo/example_test.go index 7cf67015fc..62d9754366 100644 --- a/contrib/garyburd/redigo/example_test.go +++ b/contrib/garyburd/redigo/example_test.go @@ -10,8 +10,8 @@ import ( "log" "time" - redigotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/garyburd/redigo" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redigotrace "github.com/DataDog/dd-trace-go/v2/contrib/garyburd/redigo" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/garyburd/redigo/redis" ) diff --git a/contrib/garyburd/redigo/option.go b/contrib/garyburd/redigo/option.go index 99dddfea6f..3bf94f233d 100644 --- a/contrib/garyburd/redigo/option.go +++ b/contrib/garyburd/redigo/option.go @@ -3,13 +3,13 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package redigo // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/garyburd/redigo" +package redigo // import "github.com/DataDog/dd-trace-go/v2/contrib/garyburd/redigo" import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "redis.conn" diff --git a/contrib/garyburd/redigo/redigo.go b/contrib/garyburd/redigo/redigo.go index c3326fa2ed..d1835a1d49 100644 --- a/contrib/garyburd/redigo/redigo.go +++ b/contrib/garyburd/redigo/redigo.go @@ -15,11 +15,11 @@ import ( "net/url" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" redis "github.com/garyburd/redigo/redis" ) diff --git a/contrib/garyburd/redigo/redigo_test.go b/contrib/garyburd/redigo/redigo_test.go index c19ebef06b..6bfed8a5ca 100644 --- a/contrib/garyburd/redigo/redigo_test.go +++ b/contrib/garyburd/redigo/redigo_test.go @@ -11,11 +11,11 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/garyburd/redigo/redis" "github.com/stretchr/testify/assert" diff --git a/contrib/gin-gonic/gin/appsec.go b/contrib/gin-gonic/gin/appsec.go index 3b6501552b..a8e201e5fe 100644 --- a/contrib/gin-gonic/gin/appsec.go +++ b/contrib/gin-gonic/gin/appsec.go @@ -8,8 +8,8 @@ package gin import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" "github.com/gin-gonic/gin" ) diff --git a/contrib/gin-gonic/gin/appsec_test.go b/contrib/gin-gonic/gin/appsec_test.go index c7134d8474..d70b993a58 100644 --- a/contrib/gin-gonic/gin/appsec_test.go +++ b/contrib/gin-gonic/gin/appsec_test.go @@ -13,10 +13,10 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/gin-gonic/gin" "github.com/stretchr/testify/require" diff --git a/contrib/gin-gonic/gin/example_test.go b/contrib/gin-gonic/gin/example_test.go index 6e24a191b1..6aa3989824 100644 --- a/contrib/gin-gonic/gin/example_test.go +++ b/contrib/gin-gonic/gin/example_test.go @@ -6,8 +6,8 @@ package gin_test import ( - gintrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gin-gonic/gin" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + gintrace "github.com/DataDog/dd-trace-go/v2/contrib/gin-gonic/gin" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/gin-gonic/gin" ) diff --git a/contrib/gin-gonic/gin/gintrace.go b/contrib/gin-gonic/gin/gintrace.go index 283b220cdf..c3d88c0e06 100644 --- a/contrib/gin-gonic/gin/gintrace.go +++ b/contrib/gin-gonic/gin/gintrace.go @@ -4,18 +4,18 @@ // Copyright 2016 Datadog, Inc. // Package gin provides functions to trace the gin-gonic/gin package (https://github.com/gin-gonic/gin). -package gin // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/gin-gonic/gin" +package gin // import "github.com/DataDog/dd-trace-go/v2/contrib/gin-gonic/gin" import ( "fmt" "math" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/gin-gonic/gin" ) diff --git a/contrib/gin-gonic/gin/gintrace_test.go b/contrib/gin-gonic/gin/gintrace_test.go index dd6e5e1ff0..c5e1e35c11 100644 --- a/contrib/gin-gonic/gin/gintrace_test.go +++ b/contrib/gin-gonic/gin/gintrace_test.go @@ -14,12 +14,12 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" diff --git a/contrib/gin-gonic/gin/option.go b/contrib/gin-gonic/gin/option.go index 8259a3b362..60bdafa6d5 100644 --- a/contrib/gin-gonic/gin/option.go +++ b/contrib/gin-gonic/gin/option.go @@ -9,10 +9,10 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/gin-gonic/gin" ) diff --git a/contrib/globalsign/mgo/collection.go b/contrib/globalsign/mgo/collection.go index 145dfca02b..3b14eeefd3 100644 --- a/contrib/globalsign/mgo/collection.go +++ b/contrib/globalsign/mgo/collection.go @@ -6,7 +6,7 @@ package mgo import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" diff --git a/contrib/globalsign/mgo/mgo.go b/contrib/globalsign/mgo/mgo.go index 8d46ff6bd1..ae316d2617 100644 --- a/contrib/globalsign/mgo/mgo.go +++ b/contrib/globalsign/mgo/mgo.go @@ -4,18 +4,18 @@ // Copyright 2016 Datadog, Inc. // Package mgo provides functions and types which allow tracing of the MGO MongoDB client (https://github.com/globalsign/mgo) -package mgo // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/globalsign/mgo" +package mgo // import "github.com/DataDog/dd-trace-go/v2/contrib/globalsign/mgo" import ( "math" "net" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/globalsign/mgo" ) diff --git a/contrib/globalsign/mgo/mgo_test.go b/contrib/globalsign/mgo/mgo_test.go index b1e4d21525..f21d703252 100644 --- a/contrib/globalsign/mgo/mgo_test.go +++ b/contrib/globalsign/mgo/mgo_test.go @@ -11,11 +11,11 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" diff --git a/contrib/globalsign/mgo/option.go b/contrib/globalsign/mgo/option.go index aa2ef4813b..b790c3e5d3 100644 --- a/contrib/globalsign/mgo/option.go +++ b/contrib/globalsign/mgo/option.go @@ -9,8 +9,8 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "mongodb" diff --git a/contrib/globalsign/mgo/pipe.go b/contrib/globalsign/mgo/pipe.go index fc62c110bd..b985b8c10b 100644 --- a/contrib/globalsign/mgo/pipe.go +++ b/contrib/globalsign/mgo/pipe.go @@ -6,7 +6,7 @@ package mgo import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/globalsign/mgo" ) diff --git a/contrib/globalsign/mgo/query.go b/contrib/globalsign/mgo/query.go index 00b7bb6de3..3b2786bbd2 100644 --- a/contrib/globalsign/mgo/query.go +++ b/contrib/globalsign/mgo/query.go @@ -8,7 +8,7 @@ package mgo import ( "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/globalsign/mgo" ) diff --git a/contrib/go-chi/chi.v5/appsec.go b/contrib/go-chi/chi.v5/appsec.go index 4a4166d096..a7f03c4fc5 100644 --- a/contrib/go-chi/chi.v5/appsec.go +++ b/contrib/go-chi/chi.v5/appsec.go @@ -8,8 +8,8 @@ package chi import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" "github.com/go-chi/chi/v5" ) diff --git a/contrib/go-chi/chi.v5/chi.go b/contrib/go-chi/chi.v5/chi.go index 9dfde8913a..2b2947c7ba 100644 --- a/contrib/go-chi/chi.v5/chi.go +++ b/contrib/go-chi/chi.v5/chi.go @@ -4,19 +4,19 @@ // Copyright 2016 Datadog, Inc. // Package chi provides tracing functions for tracing the go-chi/chi/v5 package (https://github.com/go-chi/chi). -package chi // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi.v5" +package chi // import "github.com/DataDog/dd-trace-go/v2/contrib/go-chi/chi.v5" import ( "fmt" "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" diff --git a/contrib/go-chi/chi.v5/chi_test.go b/contrib/go-chi/chi.v5/chi_test.go index 3360f643d5..032e45c893 100644 --- a/contrib/go-chi/chi.v5/chi_test.go +++ b/contrib/go-chi/chi.v5/chi_test.go @@ -14,14 +14,14 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/go-chi/chi/v5" "github.com/stretchr/testify/assert" diff --git a/contrib/go-chi/chi.v5/example_test.go b/contrib/go-chi/chi.v5/example_test.go index 23fe79b76e..41436cb2c6 100644 --- a/contrib/go-chi/chi.v5/example_test.go +++ b/contrib/go-chi/chi.v5/example_test.go @@ -8,8 +8,8 @@ package chi_test import ( "net/http" - chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi.v5" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + chitrace "github.com/DataDog/dd-trace-go/v2/contrib/go-chi/chi.v5" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-chi/chi/v5" ) diff --git a/contrib/go-chi/chi.v5/option.go b/contrib/go-chi/chi.v5/option.go index f69f7a4938..f147aa6b8f 100644 --- a/contrib/go-chi/chi.v5/option.go +++ b/contrib/go-chi/chi.v5/option.go @@ -9,11 +9,11 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "chi.router" diff --git a/contrib/go-chi/chi/appsec.go b/contrib/go-chi/chi/appsec.go index 0ff5149ba9..7e17554085 100644 --- a/contrib/go-chi/chi/appsec.go +++ b/contrib/go-chi/chi/appsec.go @@ -8,8 +8,8 @@ package chi import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" "github.com/go-chi/chi" ) diff --git a/contrib/go-chi/chi/chi.go b/contrib/go-chi/chi/chi.go index 03694be506..4901e80563 100644 --- a/contrib/go-chi/chi/chi.go +++ b/contrib/go-chi/chi/chi.go @@ -4,19 +4,19 @@ // Copyright 2016 Datadog, Inc. // Package chi provides tracing functions for tracing the go-chi/chi package (https://github.com/go-chi/chi). -package chi // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi" +package chi // import "github.com/DataDog/dd-trace-go/v2/contrib/go-chi/chi" import ( "fmt" "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" diff --git a/contrib/go-chi/chi/chi_test.go b/contrib/go-chi/chi/chi_test.go index ac0d6c1e65..18efc9b60c 100644 --- a/contrib/go-chi/chi/chi_test.go +++ b/contrib/go-chi/chi/chi_test.go @@ -14,14 +14,14 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/go-chi/chi" "github.com/stretchr/testify/assert" diff --git a/contrib/go-chi/chi/example_test.go b/contrib/go-chi/chi/example_test.go index 325a0f7c5f..caad739284 100644 --- a/contrib/go-chi/chi/example_test.go +++ b/contrib/go-chi/chi/example_test.go @@ -8,8 +8,8 @@ package chi_test import ( "net/http" - chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + chitrace "github.com/DataDog/dd-trace-go/v2/contrib/go-chi/chi" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-chi/chi" ) diff --git a/contrib/go-chi/chi/option.go b/contrib/go-chi/chi/option.go index 5ed63a6485..45f43987d6 100644 --- a/contrib/go-chi/chi/option.go +++ b/contrib/go-chi/chi/option.go @@ -9,11 +9,11 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/go-chi/chi" ) diff --git a/contrib/go-pg/pg.v10/example_test.go b/contrib/go-pg/pg.v10/example_test.go index da840bc5b4..2ae903fce6 100644 --- a/contrib/go-pg/pg.v10/example_test.go +++ b/contrib/go-pg/pg.v10/example_test.go @@ -8,7 +8,7 @@ package pg_test import ( "log" - pgtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-pg/pg.v10" + pgtrace "github.com/DataDog/dd-trace-go/v2/contrib/go-pg/pg.v10" "github.com/go-pg/pg/v10" ) diff --git a/contrib/go-pg/pg.v10/option.go b/contrib/go-pg/pg.v10/option.go index a39a691e3f..92f50a8091 100644 --- a/contrib/go-pg/pg.v10/option.go +++ b/contrib/go-pg/pg.v10/option.go @@ -8,8 +8,8 @@ package pg import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" ) type config struct { diff --git a/contrib/go-pg/pg.v10/pg_go.go b/contrib/go-pg/pg.v10/pg_go.go index 7f95f14a5e..b08d1492e5 100644 --- a/contrib/go-pg/pg.v10/pg_go.go +++ b/contrib/go-pg/pg.v10/pg_go.go @@ -9,11 +9,11 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/go-pg/pg/v10" ) diff --git a/contrib/go-pg/pg.v10/pg_go_test.go b/contrib/go-pg/pg.v10/pg_go_test.go index 5f7a212af6..e041179b69 100644 --- a/contrib/go-pg/pg.v10/pg_go_test.go +++ b/contrib/go-pg/pg.v10/pg_go_test.go @@ -11,10 +11,10 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/go-pg/pg/v10" "github.com/stretchr/testify/assert" diff --git a/contrib/go-redis/redis.v7/example_test.go b/contrib/go-redis/redis.v7/example_test.go index 0d4dc834e4..925f5868a8 100644 --- a/contrib/go-redis/redis.v7/example_test.go +++ b/contrib/go-redis/redis.v7/example_test.go @@ -9,9 +9,9 @@ import ( "context" "time" - redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis.v7" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redistrace "github.com/DataDog/dd-trace-go/v2/contrib/go-redis/redis.v7" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-redis/redis/v7" ) diff --git a/contrib/go-redis/redis.v7/option.go b/contrib/go-redis/redis.v7/option.go index e5eaf5e9f1..08819a8303 100644 --- a/contrib/go-redis/redis.v7/option.go +++ b/contrib/go-redis/redis.v7/option.go @@ -8,8 +8,8 @@ package redis import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "redis.client" diff --git a/contrib/go-redis/redis.v7/redis.go b/contrib/go-redis/redis.v7/redis.go index 5376ae5e9c..0f45c8e5b5 100644 --- a/contrib/go-redis/redis.v7/redis.go +++ b/contrib/go-redis/redis.v7/redis.go @@ -15,10 +15,10 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" "github.com/go-redis/redis/v7" ) diff --git a/contrib/go-redis/redis.v7/redis_test.go b/contrib/go-redis/redis.v7/redis_test.go index 83823a8069..c6f476b9bf 100644 --- a/contrib/go-redis/redis.v7/redis_test.go +++ b/contrib/go-redis/redis.v7/redis_test.go @@ -13,12 +13,12 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/go-redis/redis/v7" "github.com/stretchr/testify/assert" diff --git a/contrib/go-redis/redis.v8/example_test.go b/contrib/go-redis/redis.v8/example_test.go index 12fe41fc6d..a3799c8e38 100644 --- a/contrib/go-redis/redis.v8/example_test.go +++ b/contrib/go-redis/redis.v8/example_test.go @@ -9,9 +9,9 @@ import ( "context" "time" - redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis.v8" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redistrace "github.com/DataDog/dd-trace-go/v2/contrib/go-redis/redis.v8" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-redis/redis/v8" ) diff --git a/contrib/go-redis/redis.v8/option.go b/contrib/go-redis/redis.v8/option.go index 4036d5c6ff..0cfe2c8c4f 100644 --- a/contrib/go-redis/redis.v8/option.go +++ b/contrib/go-redis/redis.v8/option.go @@ -8,8 +8,8 @@ package redis import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "redis.client" diff --git a/contrib/go-redis/redis.v8/redis.go b/contrib/go-redis/redis.v8/redis.go index a3ec7bc1c0..d814d6e7b5 100644 --- a/contrib/go-redis/redis.v8/redis.go +++ b/contrib/go-redis/redis.v8/redis.go @@ -15,10 +15,10 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" "github.com/go-redis/redis/v8" ) diff --git a/contrib/go-redis/redis.v8/redis_test.go b/contrib/go-redis/redis.v8/redis_test.go index 276b82a547..a9383ee311 100644 --- a/contrib/go-redis/redis.v8/redis_test.go +++ b/contrib/go-redis/redis.v8/redis_test.go @@ -13,12 +13,12 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/go-redis/redis/v8" "github.com/stretchr/testify/assert" diff --git a/contrib/go-redis/redis/example_test.go b/contrib/go-redis/redis/example_test.go index 4a976710db..3f83d62d4e 100644 --- a/contrib/go-redis/redis/example_test.go +++ b/contrib/go-redis/redis/example_test.go @@ -9,9 +9,9 @@ import ( "context" "time" - redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redistrace "github.com/DataDog/dd-trace-go/v2/contrib/go-redis/redis" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/go-redis/redis" ) diff --git a/contrib/go-redis/redis/option.go b/contrib/go-redis/redis/option.go index 9b27fe62f5..905f8e2ce4 100644 --- a/contrib/go-redis/redis/option.go +++ b/contrib/go-redis/redis/option.go @@ -3,13 +3,13 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package redis // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis" +package redis // import "github.com/DataDog/dd-trace-go/v2/contrib/go-redis/redis" import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "redis.client" diff --git a/contrib/go-redis/redis/redis.go b/contrib/go-redis/redis/redis.go index 56feb6dcfd..d599b995a8 100644 --- a/contrib/go-redis/redis/redis.go +++ b/contrib/go-redis/redis/redis.go @@ -16,11 +16,11 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/go-redis/redis" ) diff --git a/contrib/go-redis/redis/redis_test.go b/contrib/go-redis/redis/redis_test.go index cc54ed219c..a4f17d961c 100644 --- a/contrib/go-redis/redis/redis_test.go +++ b/contrib/go-redis/redis/redis_test.go @@ -13,11 +13,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/go-redis/redis" "github.com/stretchr/testify/assert" diff --git a/contrib/go.mongodb.org/mongo-driver/mongo/example_test.go b/contrib/go.mongodb.org/mongo-driver/mongo/example_test.go index e614a5bb75..de132157c2 100644 --- a/contrib/go.mongodb.org/mongo-driver/mongo/example_test.go +++ b/contrib/go.mongodb.org/mongo-driver/mongo/example_test.go @@ -8,7 +8,7 @@ package mongo_test import ( "context" - mongotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go.mongodb.org/mongo-driver/mongo" + mongotrace "github.com/DataDog/dd-trace-go/v2/contrib/go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/contrib/go.mongodb.org/mongo-driver/mongo/mongo.go b/contrib/go.mongodb.org/mongo-driver/mongo/mongo.go index c8332874ca..f2e23e9f6b 100644 --- a/contrib/go.mongodb.org/mongo-driver/mongo/mongo.go +++ b/contrib/go.mongodb.org/mongo-driver/mongo/mongo.go @@ -16,11 +16,11 @@ import ( "strings" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/event" diff --git a/contrib/go.mongodb.org/mongo-driver/mongo/mongo_test.go b/contrib/go.mongodb.org/mongo-driver/mongo/mongo_test.go index 4e637b9a5f..759779c2bf 100644 --- a/contrib/go.mongodb.org/mongo-driver/mongo/mongo_test.go +++ b/contrib/go.mongodb.org/mongo-driver/mongo/mongo_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/go.mongodb.org/mongo-driver/mongo/option.go b/contrib/go.mongodb.org/mongo-driver/mongo/option.go index a6c45e8ae3..71f3c53679 100644 --- a/contrib/go.mongodb.org/mongo-driver/mongo/option.go +++ b/contrib/go.mongodb.org/mongo-driver/mongo/option.go @@ -8,8 +8,8 @@ package mongo import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "mongo" diff --git a/contrib/gocql/gocql/example_test.go b/contrib/gocql/gocql/example_test.go index 0313fdd32a..62e8d88381 100644 --- a/contrib/gocql/gocql/example_test.go +++ b/contrib/gocql/gocql/example_test.go @@ -8,9 +8,9 @@ package gocql_test import ( "context" - gocqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gocql/gocql" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + gocqltrace "github.com/DataDog/dd-trace-go/v2/contrib/gocql/gocql" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) func Example() { diff --git a/contrib/gocql/gocql/gocql.go b/contrib/gocql/gocql/gocql.go index 7881392ba4..f979f01943 100644 --- a/contrib/gocql/gocql/gocql.go +++ b/contrib/gocql/gocql/gocql.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package gocql provides functions to trace the gocql/gocql package (https://github.com/gocql/gocql). -package gocql // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/gocql/gocql" +package gocql // import "github.com/DataDog/dd-trace-go/v2/contrib/gocql/gocql" import ( "context" @@ -13,11 +13,11 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/gocql/gocql" ) diff --git a/contrib/gocql/gocql/gocql_test.go b/contrib/gocql/gocql/gocql_test.go index 73a6ba3275..b07a2abdd4 100644 --- a/contrib/gocql/gocql/gocql_test.go +++ b/contrib/gocql/gocql/gocql_test.go @@ -14,11 +14,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/gocql/gocql" "github.com/stretchr/testify/assert" diff --git a/contrib/gocql/gocql/option.go b/contrib/gocql/gocql/option.go index 26ef069339..3493665dc3 100644 --- a/contrib/gocql/gocql/option.go +++ b/contrib/gocql/gocql/option.go @@ -8,8 +8,8 @@ package gocql import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "gocql.query" diff --git a/contrib/gofiber/fiber.v2/example_test.go b/contrib/gofiber/fiber.v2/example_test.go index 29149fdae1..13c9e14221 100644 --- a/contrib/gofiber/fiber.v2/example_test.go +++ b/contrib/gofiber/fiber.v2/example_test.go @@ -6,8 +6,8 @@ package fiber_test import ( - fibertrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gofiber/fiber.v2" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + fibertrace "github.com/DataDog/dd-trace-go/v2/contrib/gofiber/fiber.v2" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/gofiber/fiber/v2" ) diff --git a/contrib/gofiber/fiber.v2/fiber.go b/contrib/gofiber/fiber.v2/fiber.go index f8cf2ac92e..2c28014eec 100644 --- a/contrib/gofiber/fiber.v2/fiber.go +++ b/contrib/gofiber/fiber.v2/fiber.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package fiber provides tracing functions for tracing the fiber package (https://github.com/gofiber/fiber). -package fiber // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/gofiber/fiber.v2" +package fiber // import "github.com/DataDog/dd-trace-go/v2/contrib/gofiber/fiber.v2" import ( "fmt" @@ -12,11 +12,11 @@ import ( "net/http" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/gofiber/fiber/v2" ) @@ -61,8 +61,10 @@ func Middleware(opts ...Option) func(c *fiber.Ctx) error { opts = append(opts, tracer.ChildOf(spanctx)) } opts = append(opts, cfg.spanOpts...) - opts = append(opts, tracer.Tag(ext.Component, componentName)) - opts = append(opts, tracer.Tag(ext.SpanKind, ext.SpanKindServer)) + opts = append(opts, + tracer.Tag(ext.Component, componentName), + tracer.Tag(ext.SpanKind, ext.SpanKindServer), + ) span, ctx := tracer.StartSpanFromContext(c.Context(), cfg.spanName, opts...) defer span.Finish() @@ -74,6 +76,7 @@ func Middleware(opts ...Option) func(c *fiber.Ctx) error { err := c.Next() span.SetTag(ext.ResourceName, cfg.resourceNamer(c)) + span.SetTag(ext.HTTPRoute, c.Route().Path) status := c.Response().StatusCode() // on the off chance we don't yet have a status after the rest of the things have run diff --git a/contrib/gofiber/fiber.v2/fiber_test.go b/contrib/gofiber/fiber.v2/fiber_test.go index 2646d3a970..60ca3e5f99 100644 --- a/contrib/gofiber/fiber.v2/fiber_test.go +++ b/contrib/gofiber/fiber.v2/fiber_test.go @@ -11,11 +11,11 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/gofiber/fiber/v2" "github.com/stretchr/testify/assert" @@ -70,6 +70,7 @@ func TestTrace200(t *testing.T) { assert.Equal("/user/123", span.Tag(ext.HTTPURL)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) assert.Equal("gofiber/fiber.v2", span.Tag(ext.Component)) + assert.Equal("/user/:id", span.Tag(ext.HTTPRoute)) } t.Run("response", func(t *testing.T) { @@ -132,6 +133,7 @@ func TestStatusError(t *testing.T) { assert.Equal("http.request", span.OperationName()) assert.Equal("foobar", span.Tag(ext.ServiceName)) assert.Equal("500", span.Tag(ext.HTTPCode)) + assert.Equal("/err", span.Tag(ext.HTTPRoute)) assert.Equal(wantErr, span.Tag(ext.Error).(error).Error()) } @@ -166,6 +168,7 @@ func TestCustomError(t *testing.T) { assert.Equal(fiber.ErrBadRequest, span.Tag(ext.Error).(*fiber.Error)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) assert.Equal("gofiber/fiber.v2", span.Tag(ext.Component)) + assert.Equal("/err", span.Tag(ext.HTTPRoute)) } func TestUserContext(t *testing.T) { diff --git a/contrib/gofiber/fiber.v2/option.go b/contrib/gofiber/fiber.v2/option.go index 5fcd18a4eb..c7a6d20520 100644 --- a/contrib/gofiber/fiber.v2/option.go +++ b/contrib/gofiber/fiber.v2/option.go @@ -8,10 +8,10 @@ package fiber import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/gofiber/fiber/v2" ) diff --git a/contrib/gomodule/redigo/example_test.go b/contrib/gomodule/redigo/example_test.go index 706a6485b8..3499ef4475 100644 --- a/contrib/gomodule/redigo/example_test.go +++ b/contrib/gomodule/redigo/example_test.go @@ -10,8 +10,8 @@ import ( "log" "time" - redigotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gomodule/redigo" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redigotrace "github.com/DataDog/dd-trace-go/v2/contrib/gomodule/redigo" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/gomodule/redigo/redis" ) diff --git a/contrib/gomodule/redigo/option.go b/contrib/gomodule/redigo/option.go index 7d5c17c79d..72b188becf 100644 --- a/contrib/gomodule/redigo/option.go +++ b/contrib/gomodule/redigo/option.go @@ -3,13 +3,13 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package redigo // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/gomodule/redigo" +package redigo // import "github.com/DataDog/dd-trace-go/v2/contrib/gomodule/redigo" import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) type dialConfig struct { diff --git a/contrib/gomodule/redigo/redigo.go b/contrib/gomodule/redigo/redigo.go index dfabb11bfd..a76b2b0da7 100644 --- a/contrib/gomodule/redigo/redigo.go +++ b/contrib/gomodule/redigo/redigo.go @@ -16,11 +16,11 @@ import ( "strconv" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" redis "github.com/gomodule/redigo/redis" ) diff --git a/contrib/gomodule/redigo/redigo_test.go b/contrib/gomodule/redigo/redigo_test.go index 91010d51ad..a169674b5c 100644 --- a/contrib/gomodule/redigo/redigo_test.go +++ b/contrib/gomodule/redigo/redigo_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/gomodule/redigo/redis" "github.com/stretchr/testify/assert" diff --git a/contrib/google.golang.org/api/api.go b/contrib/google.golang.org/api/api.go index a8bf163f0a..37281d3807 100644 --- a/contrib/google.golang.org/api/api.go +++ b/contrib/google.golang.org/api/api.go @@ -11,7 +11,7 @@ // in some tag values like service.name and resource.name, depending on the google.golang.org/api that you are using in your // project. If this is not an acceptable behavior for your use-case, you can disable this feature using the // WithEndpointMetadataDisabled option. -package api // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/api" +package api // import "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/api" //go:generate go run ./internal/gen_endpoints -o gen_endpoints.json @@ -21,13 +21,13 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/api/internal/tree" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/api/internal/tree" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "golang.org/x/oauth2/google" ) diff --git a/contrib/google.golang.org/api/api_test.go b/contrib/google.golang.org/api/api_test.go index a9b8f54347..109bde2d84 100644 --- a/contrib/google.golang.org/api/api_test.go +++ b/contrib/google.golang.org/api/api_test.go @@ -13,9 +13,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/google.golang.org/api/example_test.go b/contrib/google.golang.org/api/example_test.go index 7fc8c42b4d..700e98dfb3 100644 --- a/contrib/google.golang.org/api/example_test.go +++ b/contrib/google.golang.org/api/example_test.go @@ -8,7 +8,7 @@ package api_test import ( "fmt" - apitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/api" + apitrace "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/api" cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" ) diff --git a/contrib/google.golang.org/api/internal/tree/tree.go b/contrib/google.golang.org/api/internal/tree/tree.go index c6536b3e57..31e19f4e26 100644 --- a/contrib/google.golang.org/api/internal/tree/tree.go +++ b/contrib/google.golang.org/api/internal/tree/tree.go @@ -9,7 +9,7 @@ import ( "regexp" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) type ( diff --git a/contrib/google.golang.org/api/option.go b/contrib/google.golang.org/api/option.go index d11c4e81cb..c2efa55226 100644 --- a/contrib/google.golang.org/api/option.go +++ b/contrib/google.golang.org/api/option.go @@ -9,7 +9,7 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" ) type config struct { diff --git a/contrib/google.golang.org/grpc/appsec.go b/contrib/google.golang.org/grpc/appsec.go index 8f96757eba..d04b62ad9b 100644 --- a/contrib/google.golang.org/grpc/appsec.go +++ b/contrib/google.golang.org/grpc/appsec.go @@ -8,13 +8,13 @@ package grpc import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/grpcsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/sharedsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/grpcsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/sharedsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/appsec-internal-go/netip" "google.golang.org/grpc" diff --git a/contrib/google.golang.org/grpc/appsec_test.go b/contrib/google.golang.org/grpc/appsec_test.go index f43f2dbe5f..79a7d1de9f 100644 --- a/contrib/google.golang.org/grpc/appsec_test.go +++ b/contrib/google.golang.org/grpc/appsec_test.go @@ -12,9 +12,9 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/stretchr/testify/require" "google.golang.org/grpc" diff --git a/contrib/google.golang.org/grpc/client.go b/contrib/google.golang.org/grpc/client.go index b5ecd7c02e..aebccb5850 100644 --- a/contrib/google.golang.org/grpc/client.go +++ b/contrib/google.golang.org/grpc/client.go @@ -9,11 +9,11 @@ import ( "context" "net" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/internal/grpcutil" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/internal/grpcutil" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" diff --git a/contrib/google.golang.org/grpc/example_test.go b/contrib/google.golang.org/grpc/example_test.go index e8c7860ad0..b4c025c0ff 100644 --- a/contrib/google.golang.org/grpc/example_test.go +++ b/contrib/google.golang.org/grpc/example_test.go @@ -9,7 +9,7 @@ import ( "log" "net" - grpctrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc" + grpctrace "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/grpc" "google.golang.org/grpc" ) diff --git a/contrib/google.golang.org/grpc/fixtures_test.proto b/contrib/google.golang.org/grpc/fixtures_test.proto index c9e4610414..b7cefba607 100644 --- a/contrib/google.golang.org/grpc/fixtures_test.proto +++ b/contrib/google.golang.org/grpc/fixtures_test.proto @@ -3,7 +3,7 @@ syntax = "proto3"; option java_multiple_files = true; option java_package = "io.grpc.examples.testgrpc"; option java_outer_classname = "TestGRPCProto"; -option go_package = "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc"; +option go_package = "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/grpc"; package grpc; diff --git a/contrib/google.golang.org/grpc/grpc.go b/contrib/google.golang.org/grpc/grpc.go index 2313add085..c17cbcc4b1 100644 --- a/contrib/google.golang.org/grpc/grpc.go +++ b/contrib/google.golang.org/grpc/grpc.go @@ -6,7 +6,7 @@ //go:generate sh gen_proto.sh // Package grpc provides functions to trace the google.golang.org/grpc package v1.2. -package grpc // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc" +package grpc // import "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/grpc" import ( "context" @@ -14,11 +14,11 @@ import ( "io" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/internal/grpcutil" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/internal/grpcutil" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" diff --git a/contrib/google.golang.org/grpc/grpc_test.go b/contrib/google.golang.org/grpc/grpc_test.go index 674491bf0e..feec246124 100644 --- a/contrib/google.golang.org/grpc/grpc_test.go +++ b/contrib/google.golang.org/grpc/grpc_test.go @@ -18,13 +18,13 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/lists" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/lists" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/google.golang.org/grpc/option.go b/contrib/google.golang.org/grpc/option.go index d23ca5695d..b53ac8cdbf 100644 --- a/contrib/google.golang.org/grpc/option.go +++ b/contrib/google.golang.org/grpc/option.go @@ -6,12 +6,12 @@ package grpc import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "google.golang.org/grpc/codes" ) diff --git a/contrib/google.golang.org/grpc/server.go b/contrib/google.golang.org/grpc/server.go index 2217f41d33..e1344e266c 100644 --- a/contrib/google.golang.org/grpc/server.go +++ b/contrib/google.golang.org/grpc/server.go @@ -8,11 +8,11 @@ package grpc import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/contrib/google.golang.org/grpc/stats_client.go b/contrib/google.golang.org/grpc/stats_client.go index b3d155d0e3..58819659dc 100644 --- a/contrib/google.golang.org/grpc/stats_client.go +++ b/contrib/google.golang.org/grpc/stats_client.go @@ -9,8 +9,9 @@ import ( "context" "net" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "google.golang.org/grpc/stats" ) diff --git a/contrib/google.golang.org/grpc/stats_client_test.go b/contrib/google.golang.org/grpc/stats_client_test.go index f0fd394ee4..19fdcda3ed 100644 --- a/contrib/google.golang.org/grpc/stats_client_test.go +++ b/contrib/google.golang.org/grpc/stats_client_test.go @@ -9,9 +9,9 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" "google.golang.org/grpc" diff --git a/contrib/google.golang.org/grpc/stats_server.go b/contrib/google.golang.org/grpc/stats_server.go index 4da9316001..8bd35dacee 100644 --- a/contrib/google.golang.org/grpc/stats_server.go +++ b/contrib/google.golang.org/grpc/stats_server.go @@ -8,8 +8,8 @@ package grpc import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "google.golang.org/grpc/stats" ) diff --git a/contrib/google.golang.org/grpc/stats_server_test.go b/contrib/google.golang.org/grpc/stats_server_test.go index 7bb38a9042..ced2df82d2 100644 --- a/contrib/google.golang.org/grpc/stats_server_test.go +++ b/contrib/google.golang.org/grpc/stats_server_test.go @@ -9,9 +9,9 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" "google.golang.org/grpc" diff --git a/contrib/google.golang.org/internal/grpcutil/mdcarrier.go b/contrib/google.golang.org/internal/grpcutil/mdcarrier.go index 1612298da9..9168c4445e 100644 --- a/contrib/google.golang.org/internal/grpcutil/mdcarrier.go +++ b/contrib/google.golang.org/internal/grpcutil/mdcarrier.go @@ -3,12 +3,12 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package grpcutil // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/internal/grpcutil" +package grpcutil // import "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/internal/grpcutil" import ( "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "google.golang.org/grpc/metadata" ) diff --git a/contrib/gopkg.in/jinzhu/gorm.v1/example_test.go b/contrib/gopkg.in/jinzhu/gorm.v1/example_test.go index 1debd79f35..0c85b0153a 100644 --- a/contrib/gopkg.in/jinzhu/gorm.v1/example_test.go +++ b/contrib/gopkg.in/jinzhu/gorm.v1/example_test.go @@ -8,8 +8,8 @@ package gorm_test import ( "log" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - gormtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gopkg.in/jinzhu/gorm.v1" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + gormtrace "github.com/DataDog/dd-trace-go/v2/contrib/gopkg.in/jinzhu/gorm.v1" "github.com/lib/pq" "gopkg.in/jinzhu/gorm.v1" diff --git a/contrib/gopkg.in/jinzhu/gorm.v1/gorm.go b/contrib/gopkg.in/jinzhu/gorm.v1/gorm.go index 8b8e9790b7..11ffec0b37 100644 --- a/contrib/gopkg.in/jinzhu/gorm.v1/gorm.go +++ b/contrib/gopkg.in/jinzhu/gorm.v1/gorm.go @@ -4,6 +4,10 @@ // Copyright 2016 Datadog, Inc. // Package gorm provides helper functions for tracing the jinzhu/gorm package (https://github.com/jinzhu/gorm). +// +// Deprecated: The underlying gopkg.in/jinzhu/gorm packages has known security vulnerabilities and is no longer under +// active development. As such consider this package DEPRECATED. +// It is highly recommended that you update to the latest version available here as a contrib package "gorm.io/gorm.v1". package gorm import ( @@ -11,12 +15,12 @@ import ( "math" "time" - sqltraced "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + sqltraced "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "gopkg.in/jinzhu/gorm.v1" ) @@ -35,7 +39,7 @@ const ( ) // Open opens a new (traced) database connection. The used dialect must be formerly registered -// using (gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql).Register. +// using (github.com/DataDog/dd-trace-go/v2/contrib/database/sql).Register. func Open(dialect, source string, opts ...Option) (*gorm.DB, error) { sqldb, err := sqltraced.Open(dialect, source) if err != nil { diff --git a/contrib/gopkg.in/jinzhu/gorm.v1/gorm_test.go b/contrib/gopkg.in/jinzhu/gorm.v1/gorm_test.go index cd0350f78c..949fa442e7 100644 --- a/contrib/gopkg.in/jinzhu/gorm.v1/gorm_test.go +++ b/contrib/gopkg.in/jinzhu/gorm.v1/gorm_test.go @@ -12,12 +12,12 @@ import ( "os" "testing" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" mssql "github.com/denisenkom/go-mssqldb" "github.com/go-sql-driver/mysql" diff --git a/contrib/gopkg.in/jinzhu/gorm.v1/option.go b/contrib/gopkg.in/jinzhu/gorm.v1/option.go index 9d229ff76a..76031c47ec 100644 --- a/contrib/gopkg.in/jinzhu/gorm.v1/option.go +++ b/contrib/gopkg.in/jinzhu/gorm.v1/option.go @@ -8,7 +8,7 @@ package gorm import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "gopkg.in/jinzhu/gorm.v1" ) diff --git a/contrib/gorilla/mux/example_test.go b/contrib/gorilla/mux/example_test.go index e4e1f9bd3c..4803e1ce08 100644 --- a/contrib/gorilla/mux/example_test.go +++ b/contrib/gorilla/mux/example_test.go @@ -8,7 +8,7 @@ package mux_test import ( "net/http" - muxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux" + muxtrace "github.com/DataDog/dd-trace-go/v2/contrib/gorilla/mux" ) func handler(w http.ResponseWriter, _ *http.Request) { diff --git a/contrib/gorilla/mux/mux.go b/contrib/gorilla/mux/mux.go index ebb0657dfc..54a6f3989a 100644 --- a/contrib/gorilla/mux/mux.go +++ b/contrib/gorilla/mux/mux.go @@ -4,18 +4,18 @@ // Copyright 2016 Datadog, Inc. // Package mux provides tracing functions for tracing the gorilla/mux package (https://github.com/gorilla/mux). -package mux // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux" +package mux // import "github.com/DataDog/dd-trace-go/v2/contrib/gorilla/mux" import ( "net/http" - httptraceinternal "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptraceinternal "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/gorilla/mux" ) diff --git a/contrib/gorilla/mux/mux_test.go b/contrib/gorilla/mux/mux_test.go index a338a14246..27eee65964 100644 --- a/contrib/gorilla/mux/mux_test.go +++ b/contrib/gorilla/mux/mux_test.go @@ -14,14 +14,14 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,39 +29,57 @@ import ( func TestHttpTracer(t *testing.T) { for _, ht := range []struct { + name string code int method string url string - resourceName string - errorStr string + wantResource string + wantErr string + wantRoute string }{ { + name: "200", code: http.StatusOK, method: "GET", url: "/200", - resourceName: "GET /200", + wantResource: "GET /200", + wantRoute: "/200", }, { + name: "users/{id}", + code: http.StatusOK, + method: "GET", + url: "/users/123", + wantResource: "GET /users/{id}", + wantRoute: "/users/{id}", + }, + { + name: "404", code: http.StatusNotFound, method: "GET", url: "/not_a_real_route", - resourceName: "GET unknown", + wantResource: "GET unknown", + wantRoute: "", }, { + name: "405", code: http.StatusMethodNotAllowed, method: "POST", url: "/405", - resourceName: "POST unknown", + wantResource: "POST unknown", + wantRoute: "", }, { + name: "500", code: http.StatusInternalServerError, method: "GET", url: "/500", - resourceName: "GET /500", - errorStr: "500: Internal Server Error", + wantResource: "GET /500", + wantErr: "500: Internal Server Error", + wantRoute: "/500", }, } { - t.Run(http.StatusText(ht.code), func(t *testing.T) { + t.Run(ht.name, func(t *testing.T) { assert := assert.New(t) mt := mocktracer.Start() defer mt.Stop() @@ -83,12 +101,17 @@ func TestHttpTracer(t *testing.T) { assert.Equal(codeStr, s.Tag(ext.HTTPCode)) assert.Equal(ht.method, s.Tag(ext.HTTPMethod)) assert.Equal("http://example.com"+ht.url, s.Tag(ext.HTTPURL)) - assert.Equal(ht.resourceName, s.Tag(ext.ResourceName)) + assert.Equal(ht.wantResource, s.Tag(ext.ResourceName)) assert.Equal(ext.SpanKindServer, s.Tag(ext.SpanKind)) assert.Equal("gorilla/mux", s.Tag(ext.Component)) + if ht.wantRoute != "" { + assert.Equal(ht.wantRoute, s.Tag(ext.HTTPRoute)) + } else { + assert.NotContains(s.Tags(), ext.HTTPRoute) + } - if ht.errorStr != "" { - assert.Equal(ht.errorStr, s.Tag(ext.Error).(error).Error()) + if ht.wantErr != "" { + assert.Equal(ht.wantErr, s.Tag(ext.Error).(error).Error()) } }) } @@ -365,6 +388,7 @@ func router() http.Handler { mux.Handle("/200", okHandler()) mux.Handle("/500", errorHandler(http.StatusInternalServerError)) mux.Handle("/405", okHandler()).Methods("GET") + mux.Handle("/users/{id}", okHandler()) mux.NotFoundHandler = errorHandler(http.StatusNotFound) mux.MethodNotAllowedHandler = errorHandler(http.StatusMethodNotAllowed) return mux diff --git a/contrib/gorilla/mux/option.go b/contrib/gorilla/mux/option.go index 4c7d311c98..7402f4519e 100644 --- a/contrib/gorilla/mux/option.go +++ b/contrib/gorilla/mux/option.go @@ -9,13 +9,13 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "mux.router" diff --git a/contrib/gorm.io/gorm.v1/example_test.go b/contrib/gorm.io/gorm.v1/example_test.go index ec45b76a00..3db7bc2d93 100644 --- a/contrib/gorm.io/gorm.v1/example_test.go +++ b/contrib/gorm.io/gorm.v1/example_test.go @@ -9,10 +9,10 @@ import ( "context" "log" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - gormtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorm.io/gorm.v1" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + gormtrace "github.com/DataDog/dd-trace-go/v2/contrib/gorm.io/gorm.v1" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/jackc/pgx/v5/stdlib" "gorm.io/driver/postgres" diff --git a/contrib/gorm.io/gorm.v1/gorm.go b/contrib/gorm.io/gorm.v1/gorm.go index c016d3de28..7c21077f10 100644 --- a/contrib/gorm.io/gorm.v1/gorm.go +++ b/contrib/gorm.io/gorm.v1/gorm.go @@ -11,11 +11,11 @@ import ( "math" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "gorm.io/gorm" ) @@ -34,7 +34,7 @@ const ( ) // Open opens a new (traced) database connection. The used driver must be formerly registered -// using (gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql).Register. +// using (github.com/DataDog/dd-trace-go/v2/contrib/database/sql).Register. func Open(dialector gorm.Dialector, cfg *gorm.Config, opts ...Option) (*gorm.DB, error) { db, err := gorm.Open(dialector, cfg) if err != nil { diff --git a/contrib/gorm.io/gorm.v1/gorm_test.go b/contrib/gorm.io/gorm.v1/gorm_test.go index 0b3a9ea28a..5b9d8521d1 100644 --- a/contrib/gorm.io/gorm.v1/gorm_test.go +++ b/contrib/gorm.io/gorm.v1/gorm_test.go @@ -12,12 +12,12 @@ import ( "os" "testing" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/go-sql-driver/mysql" "github.com/jackc/pgx/v5/stdlib" diff --git a/contrib/gorm.io/gorm.v1/option.go b/contrib/gorm.io/gorm.v1/option.go index f305f8d96f..d5a178cc78 100644 --- a/contrib/gorm.io/gorm.v1/option.go +++ b/contrib/gorm.io/gorm.v1/option.go @@ -8,7 +8,7 @@ package gorm import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "gorm.io/gorm" ) diff --git a/contrib/graph-gophers/graphql-go/example_test.go b/contrib/graph-gophers/graphql-go/example_test.go index 1f434a83ee..de49c23a34 100644 --- a/contrib/graph-gophers/graphql-go/example_test.go +++ b/contrib/graph-gophers/graphql-go/example_test.go @@ -9,7 +9,7 @@ import ( "log" "net/http" - graphqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/graph-gophers/graphql-go" + graphqltrace "github.com/DataDog/dd-trace-go/v2/contrib/graph-gophers/graphql-go" graphql "github.com/graph-gophers/graphql-go" "github.com/graph-gophers/graphql-go/relay" diff --git a/contrib/graph-gophers/graphql-go/graphql.go b/contrib/graph-gophers/graphql-go/graphql.go index c313c42d5e..464b80d172 100644 --- a/contrib/graph-gophers/graphql-go/graphql.go +++ b/contrib/graph-gophers/graphql-go/graphql.go @@ -9,18 +9,18 @@ // https://godoc.org/github.com/graph-gophers/graphql-go/trace subpackage. // Create a new Tracer with `NewTracer` and pass it as an additional option to // `MustParseSchema`. -package graphql // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/graph-gophers/graphql-go" +package graphql // import "github.com/DataDog/dd-trace-go/v2/contrib/graph-gophers/graphql-go" import ( "context" "fmt" "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/graph-gophers/graphql-go/errors" "github.com/graph-gophers/graphql-go/introspection" diff --git a/contrib/graph-gophers/graphql-go/graphql_test.go b/contrib/graph-gophers/graphql-go/graphql_test.go index f9c892ac87..4146df592f 100644 --- a/contrib/graph-gophers/graphql-go/graphql_test.go +++ b/contrib/graph-gophers/graphql-go/graphql_test.go @@ -11,11 +11,11 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/lists" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/lists" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/graph-gophers/graphql-go" "github.com/graph-gophers/graphql-go/relay" diff --git a/contrib/graph-gophers/graphql-go/option.go b/contrib/graph-gophers/graphql-go/option.go index d46a8b5498..476a5c5273 100644 --- a/contrib/graph-gophers/graphql-go/option.go +++ b/contrib/graph-gophers/graphql-go/option.go @@ -8,8 +8,8 @@ package graphql import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "graphql.server" diff --git a/contrib/hashicorp/consul/benchmark_test.go b/contrib/hashicorp/consul/benchmark_test.go index 7abd8ae6b5..fc4da38e99 100644 --- a/contrib/hashicorp/consul/benchmark_test.go +++ b/contrib/hashicorp/consul/benchmark_test.go @@ -8,7 +8,7 @@ package consul import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" consul "github.com/hashicorp/consul/api" ) diff --git a/contrib/hashicorp/consul/consul.go b/contrib/hashicorp/consul/consul.go index 4182156eaa..e9590534d6 100644 --- a/contrib/hashicorp/consul/consul.go +++ b/contrib/hashicorp/consul/consul.go @@ -9,11 +9,11 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" consul "github.com/hashicorp/consul/api" ) diff --git a/contrib/hashicorp/consul/consul_test.go b/contrib/hashicorp/consul/consul_test.go index 82e869d1d4..95cd51e32b 100644 --- a/contrib/hashicorp/consul/consul_test.go +++ b/contrib/hashicorp/consul/consul_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" consul "github.com/hashicorp/consul/api" "github.com/stretchr/testify/assert" diff --git a/contrib/hashicorp/consul/example_test.go b/contrib/hashicorp/consul/example_test.go index 86b4be6da6..96633d9848 100644 --- a/contrib/hashicorp/consul/example_test.go +++ b/contrib/hashicorp/consul/example_test.go @@ -10,8 +10,8 @@ import ( "fmt" "log" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" consul "github.com/hashicorp/consul/api" ) diff --git a/contrib/hashicorp/consul/option.go b/contrib/hashicorp/consul/option.go index 6c642bcf4d..888819c007 100644 --- a/contrib/hashicorp/consul/option.go +++ b/contrib/hashicorp/consul/option.go @@ -9,8 +9,8 @@ import ( "math" "net" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" consul "github.com/hashicorp/consul/api" ) diff --git a/contrib/hashicorp/vault/example_test.go b/contrib/hashicorp/vault/example_test.go index 153effa773..1d520b9c30 100644 --- a/contrib/hashicorp/vault/example_test.go +++ b/contrib/hashicorp/vault/example_test.go @@ -10,7 +10,7 @@ import ( "log" "net/http" - vaulttrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/hashicorp/vault" + vaulttrace "github.com/DataDog/dd-trace-go/v2/contrib/hashicorp/vault" "github.com/hashicorp/vault/api" ) diff --git a/contrib/hashicorp/vault/option.go b/contrib/hashicorp/vault/option.go index c38f0f9762..e62f4e7eb8 100644 --- a/contrib/hashicorp/vault/option.go +++ b/contrib/hashicorp/vault/option.go @@ -8,9 +8,9 @@ package vault import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) type config struct { diff --git a/contrib/hashicorp/vault/vault.go b/contrib/hashicorp/vault/vault.go index 280525d453..f867acd5d0 100644 --- a/contrib/hashicorp/vault/vault.go +++ b/contrib/hashicorp/vault/vault.go @@ -21,11 +21,11 @@ import ( "net" "net/http" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" "github.com/hashicorp/vault/api" "github.com/hashicorp/vault/sdk/helper/consts" diff --git a/contrib/hashicorp/vault/vault_test.go b/contrib/hashicorp/vault/vault_test.go index 4cf3ee4e5b..2292dad2d8 100644 --- a/contrib/hashicorp/vault/vault_test.go +++ b/contrib/hashicorp/vault/vault_test.go @@ -15,9 +15,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/hashicorp/vault/api" "github.com/stretchr/testify/assert" diff --git a/contrib/internal/fasthttptrace/fasthttpheaderscarrier.go b/contrib/internal/fasthttptrace/fasthttpheaderscarrier.go index f1029e2651..d0ef5c5b36 100644 --- a/contrib/internal/fasthttptrace/fasthttpheaderscarrier.go +++ b/contrib/internal/fasthttptrace/fasthttpheaderscarrier.go @@ -6,7 +6,7 @@ package fasthttptrace import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/valyala/fasthttp" ) diff --git a/contrib/internal/fasthttptrace/fasthttpheaderscarrier_test.go b/contrib/internal/fasthttptrace/fasthttpheaderscarrier_test.go index a540c30c15..ae81017a86 100644 --- a/contrib/internal/fasthttptrace/fasthttpheaderscarrier_test.go +++ b/contrib/internal/fasthttptrace/fasthttpheaderscarrier_test.go @@ -9,8 +9,8 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/fasthttptrace/fasthttptrace.go b/contrib/internal/fasthttptrace/fasthttptrace.go index e03b249193..58befddd37 100644 --- a/contrib/internal/fasthttptrace/fasthttptrace.go +++ b/contrib/internal/fasthttptrace/fasthttptrace.go @@ -6,8 +6,8 @@ package fasthttptrace import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/valyala/fasthttp" ) diff --git a/contrib/internal/fasthttptrace/fasthttptrace_test.go b/contrib/internal/fasthttptrace/fasthttptrace_test.go index 9c5b474915..df5a05e326 100644 --- a/contrib/internal/fasthttptrace/fasthttptrace_test.go +++ b/contrib/internal/fasthttptrace/fasthttptrace_test.go @@ -8,8 +8,8 @@ package fasthttptrace import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/stretchr/testify/assert" "github.com/valyala/fasthttp" diff --git a/contrib/internal/httptrace/config.go b/contrib/internal/httptrace/config.go index b545a447ce..380e166762 100644 --- a/contrib/internal/httptrace/config.go +++ b/contrib/internal/httptrace/config.go @@ -9,8 +9,8 @@ import ( "os" "regexp" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // The env vars described below are used to configure the http security tags collection. diff --git a/contrib/internal/httptrace/httptrace.go b/contrib/internal/httptrace/httptrace.go index e8ac3cea0b..9e91c98ae3 100644 --- a/contrib/internal/httptrace/httptrace.go +++ b/contrib/internal/httptrace/httptrace.go @@ -14,12 +14,12 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) var ( diff --git a/contrib/internal/httptrace/httptrace_test.go b/contrib/internal/httptrace/httptrace_test.go index 8207bbdaa4..740ab024aa 100644 --- a/contrib/internal/httptrace/httptrace_test.go +++ b/contrib/internal/httptrace/httptrace_test.go @@ -12,13 +12,13 @@ import ( "strconv" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/DataDog/appsec-internal-go/netip" "github.com/stretchr/testify/assert" diff --git a/contrib/internal/namingschematest/cache.go b/contrib/internal/namingschematest/cache.go index b9c8efbd57..234d32312e 100644 --- a/contrib/internal/namingschematest/cache.go +++ b/contrib/internal/namingschematest/cache.go @@ -8,7 +8,7 @@ package namingschematest import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/namingschematest/client_server.go b/contrib/internal/namingschematest/client_server.go index ece5e03fba..2af1a50dc4 100644 --- a/contrib/internal/namingschematest/client_server.go +++ b/contrib/internal/namingschematest/client_server.go @@ -8,8 +8,8 @@ package namingschematest import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/namingschematest/db.go b/contrib/internal/namingschematest/db.go index 04d681d7b8..7135431983 100644 --- a/contrib/internal/namingschematest/db.go +++ b/contrib/internal/namingschematest/db.go @@ -8,7 +8,7 @@ package namingschematest import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/namingschematest/messaging.go b/contrib/internal/namingschematest/messaging.go index 81ee60cd15..7da4c92b79 100644 --- a/contrib/internal/namingschematest/messaging.go +++ b/contrib/internal/namingschematest/messaging.go @@ -8,7 +8,7 @@ package namingschematest import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/namingschematest/namingschematest.go b/contrib/internal/namingschematest/namingschematest.go index 2b25548920..0e4127e073 100644 --- a/contrib/internal/namingschematest/namingschematest.go +++ b/contrib/internal/namingschematest/namingschematest.go @@ -9,11 +9,11 @@ package namingschematest import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/lists" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/lists" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/internal/namingschematest/option.go b/contrib/internal/namingschematest/option.go index c337d59be0..d2df19da29 100644 --- a/contrib/internal/namingschematest/option.go +++ b/contrib/internal/namingschematest/option.go @@ -5,7 +5,7 @@ package namingschematest -import "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" +import "github.com/DataDog/dd-trace-go/v2/internal/namingschema" type config struct { wantServiceName map[namingschema.Version]ServiceNameAssertions diff --git a/contrib/internal/sqltest/sqltest.go b/contrib/internal/sqltest/sqltest.go index 35dbd1ddd0..026ab87b46 100644 --- a/contrib/internal/sqltest/sqltest.go +++ b/contrib/internal/sqltest/sqltest.go @@ -3,7 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package sqltest // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" +package sqltest // import "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" import ( "context" @@ -12,9 +12,9 @@ import ( "log" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" ) diff --git a/contrib/internal/telemetrytest/telemetry_test.go b/contrib/internal/telemetrytest/telemetry_test.go index 9dd22278f5..3c07a904fe 100644 --- a/contrib/internal/telemetrytest/telemetry_test.go +++ b/contrib/internal/telemetrytest/telemetry_test.go @@ -10,8 +10,8 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/gorilla/mux" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -37,7 +37,7 @@ type contribPkg struct { Dir string } -var TelemetryImport = "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" +var TelemetryImport = "github.com/DataDog/dd-trace-go/v2/internal/telemetry" func (p *contribPkg) hasTelemetryImport() bool { for _, imp := range p.Imports { diff --git a/contrib/internal/validationtest/contrib/bradfitz_memcache.go b/contrib/internal/validationtest/contrib/bradfitz_memcache.go index eaf9518514..49cddf02d3 100644 --- a/contrib/internal/validationtest/contrib/bradfitz_memcache.go +++ b/contrib/internal/validationtest/contrib/bradfitz_memcache.go @@ -8,7 +8,7 @@ package validationtest import ( "testing" - memcachetrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/bradfitz/gomemcache/memcache" + memcachetrace "github.com/DataDog/dd-trace-go/v2/contrib/bradfitz/gomemcache/memcache" "github.com/bradfitz/gomemcache/memcache" "github.com/stretchr/testify/require" diff --git a/contrib/internal/validationtest/contrib/miekg_dns.go b/contrib/internal/validationtest/contrib/miekg_dns.go index 4e38467847..e6cf6194ac 100644 --- a/contrib/internal/validationtest/contrib/miekg_dns.go +++ b/contrib/internal/validationtest/contrib/miekg_dns.go @@ -11,7 +11,7 @@ import ( "testing" "time" - dnstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns" + dnstrace "github.com/DataDog/dd-trace-go/v2/contrib/miekg/dns" "github.com/miekg/dns" "github.com/stretchr/testify/assert" diff --git a/contrib/internal/validationtest/validation_test.go b/contrib/internal/validationtest/validation_test.go index db372a198b..c8d73a9c4d 100644 --- a/contrib/internal/validationtest/validation_test.go +++ b/contrib/internal/validationtest/validation_test.go @@ -16,8 +16,8 @@ import ( "testing" "time" - validationtest "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/validationtest/contrib" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + validationtest "github.com/DataDog/dd-trace-go/v2/contrib/internal/validationtest/contrib" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/jinzhu/gorm/example_test.go b/contrib/jinzhu/gorm/example_test.go index 5246d37a2b..416d2d6dea 100644 --- a/contrib/jinzhu/gorm/example_test.go +++ b/contrib/jinzhu/gorm/example_test.go @@ -8,8 +8,8 @@ package gorm_test import ( "log" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - gormtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/jinzhu/gorm" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + gormtrace "github.com/DataDog/dd-trace-go/v2/contrib/jinzhu/gorm" "github.com/jinzhu/gorm" "github.com/lib/pq" diff --git a/contrib/jinzhu/gorm/gorm.go b/contrib/jinzhu/gorm/gorm.go index c79c134c00..db385ddff3 100644 --- a/contrib/jinzhu/gorm/gorm.go +++ b/contrib/jinzhu/gorm/gorm.go @@ -4,6 +4,10 @@ // Copyright 2016 Datadog, Inc. // Package gorm provides helper functions for tracing the jinzhu/gorm package (https://github.com/jinzhu/gorm). +// +// Deprecated: The underlying github.com/jinzhu/gorm packages has known security vulnerabilities and is no longer under +// active development. +// It is highly recommended that you update to the latest version available here as a contrib package "gorm.io/gorm.v1". package gorm import ( @@ -11,12 +15,12 @@ import ( "math" "time" - sqltraced "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + sqltraced "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/jinzhu/gorm" ) @@ -35,7 +39,7 @@ const ( ) // Open opens a new (traced) database connection. The used dialect must be formerly registered -// using (gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql).Register. +// using (github.com/DataDog/dd-trace-go/v2/contrib/database/sql).Register. func Open(dialect, source string, opts ...Option) (*gorm.DB, error) { sqldb, err := sqltraced.Open(dialect, source) if err != nil { diff --git a/contrib/jinzhu/gorm/gorm_test.go b/contrib/jinzhu/gorm/gorm_test.go index 2c7b07f812..a86f39457f 100644 --- a/contrib/jinzhu/gorm/gorm_test.go +++ b/contrib/jinzhu/gorm/gorm_test.go @@ -12,12 +12,12 @@ import ( "os" "testing" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" mssql "github.com/denisenkom/go-mssqldb" "github.com/go-sql-driver/mysql" diff --git a/contrib/jinzhu/gorm/option.go b/contrib/jinzhu/gorm/option.go index cf83683dad..6957080e43 100644 --- a/contrib/jinzhu/gorm/option.go +++ b/contrib/jinzhu/gorm/option.go @@ -8,7 +8,7 @@ package gorm import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/jinzhu/gorm" ) diff --git a/contrib/jmoiron/sqlx/example_test.go b/contrib/jmoiron/sqlx/example_test.go index c332ddeb88..fcdb7d693b 100644 --- a/contrib/jmoiron/sqlx/example_test.go +++ b/contrib/jmoiron/sqlx/example_test.go @@ -8,8 +8,8 @@ package sqlx_test import ( "log" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - sqlxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/jmoiron/sqlx" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + sqlxtrace "github.com/DataDog/dd-trace-go/v2/contrib/jmoiron/sqlx" "github.com/jmoiron/sqlx" "github.com/lib/pq" diff --git a/contrib/jmoiron/sqlx/sql.go b/contrib/jmoiron/sqlx/sql.go index 9db8ae4e2e..9c2c219af2 100644 --- a/contrib/jmoiron/sqlx/sql.go +++ b/contrib/jmoiron/sqlx/sql.go @@ -9,12 +9,12 @@ // // For more information on registering and why this needs to happen, please check the // github.com/DataDog/dd-trace-go/contrib/database/sql package. -package sqlx // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/jmoiron/sqlx" +package sqlx // import "github.com/DataDog/dd-trace-go/v2/contrib/jmoiron/sqlx" import ( - sqltraced "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + sqltraced "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/jmoiron/sqlx" ) diff --git a/contrib/jmoiron/sqlx/sql_test.go b/contrib/jmoiron/sqlx/sql_test.go index 54322f839a..cc35c10fa2 100644 --- a/contrib/jmoiron/sqlx/sql_test.go +++ b/contrib/jmoiron/sqlx/sql_test.go @@ -11,9 +11,9 @@ import ( "os" "testing" - sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/sqltest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + sqltrace "github.com/DataDog/dd-trace-go/v2/contrib/database/sql" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/sqltest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" mssql "github.com/denisenkom/go-mssqldb" "github.com/go-sql-driver/mysql" diff --git a/contrib/julienschmidt/httprouter/example_test.go b/contrib/julienschmidt/httprouter/example_test.go index 497ada0da8..b301c790ba 100644 --- a/contrib/julienschmidt/httprouter/example_test.go +++ b/contrib/julienschmidt/httprouter/example_test.go @@ -10,9 +10,9 @@ import ( "log" "net/http" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/julienschmidt/httprouter" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/julienschmidt/httprouter" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/julienschmidt/httprouter" ) diff --git a/contrib/julienschmidt/httprouter/httprouter.go b/contrib/julienschmidt/httprouter/httprouter.go index 2b62624f89..f4486d0ba8 100644 --- a/contrib/julienschmidt/httprouter/httprouter.go +++ b/contrib/julienschmidt/httprouter/httprouter.go @@ -4,18 +4,18 @@ // Copyright 2016 Datadog, Inc. // Package httprouter provides functions to trace the julienschmidt/httprouter package (https://github.com/julienschmidt/httprouter). -package httprouter // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/julienschmidt/httprouter" +package httprouter // import "github.com/DataDog/dd-trace-go/v2/contrib/julienschmidt/httprouter" import ( "math" "net/http" "strings" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/julienschmidt/httprouter" ) diff --git a/contrib/julienschmidt/httprouter/httprouter_test.go b/contrib/julienschmidt/httprouter/httprouter_test.go index dbee5f1d30..48df58f541 100644 --- a/contrib/julienschmidt/httprouter/httprouter_test.go +++ b/contrib/julienschmidt/httprouter/httprouter_test.go @@ -10,11 +10,11 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/assert" diff --git a/contrib/julienschmidt/httprouter/option.go b/contrib/julienschmidt/httprouter/option.go index 8f3e3f71c5..db671f2b34 100644 --- a/contrib/julienschmidt/httprouter/option.go +++ b/contrib/julienschmidt/httprouter/option.go @@ -8,10 +8,10 @@ package httprouter import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "http.router" diff --git a/contrib/k8s.io/client-go/kubernetes/example_test.go b/contrib/k8s.io/client-go/kubernetes/example_test.go index 6ad26c51d9..14cd150b40 100644 --- a/contrib/k8s.io/client-go/kubernetes/example_test.go +++ b/contrib/k8s.io/client-go/kubernetes/example_test.go @@ -9,7 +9,7 @@ import ( "context" "fmt" - kubernetestrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/k8s.io/client-go/kubernetes" + kubernetestrace "github.com/DataDog/dd-trace-go/v2/contrib/k8s.io/client-go/kubernetes" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" diff --git a/contrib/k8s.io/client-go/kubernetes/kubernetes.go b/contrib/k8s.io/client-go/kubernetes/kubernetes.go index 976d2ec27d..418a465afa 100644 --- a/contrib/k8s.io/client-go/kubernetes/kubernetes.go +++ b/contrib/k8s.io/client-go/kubernetes/kubernetes.go @@ -4,19 +4,19 @@ // Copyright 2016 Datadog, Inc. // Package kubernetes provides functions to trace k8s.io/client-go (https://github.com/kubernetes/client-go). -package kubernetes // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/k8s.io/client-go/kubernetes" +package kubernetes // import "github.com/DataDog/dd-trace-go/v2/contrib/k8s.io/client-go/kubernetes" import ( "net/http" "strconv" "strings" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) const componentName = "k8s.io/client-go/kubernetes" diff --git a/contrib/k8s.io/client-go/kubernetes/kubernetes_test.go b/contrib/k8s.io/client-go/kubernetes/kubernetes_test.go index 706dc80d3f..3ee21a150e 100644 --- a/contrib/k8s.io/client-go/kubernetes/kubernetes_test.go +++ b/contrib/k8s.io/client-go/kubernetes/kubernetes_test.go @@ -11,10 +11,10 @@ import ( "net/http/httptest" "testing" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/contrib/labstack/echo.v4/appsec.go b/contrib/labstack/echo.v4/appsec.go index 1505ee82d0..4dec18b987 100644 --- a/contrib/labstack/echo.v4/appsec.go +++ b/contrib/labstack/echo.v4/appsec.go @@ -8,8 +8,8 @@ package echo import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" "github.com/labstack/echo/v4" ) diff --git a/contrib/labstack/echo.v4/appsec_test.go b/contrib/labstack/echo.v4/appsec_test.go index 5a28bc9a07..b3d6943ba8 100644 --- a/contrib/labstack/echo.v4/appsec_test.go +++ b/contrib/labstack/echo.v4/appsec_test.go @@ -14,10 +14,10 @@ import ( "strings" "testing" - pappsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + pappsec "github.com/DataDog/dd-trace-go/v2/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/labstack/echo/v4" "github.com/stretchr/testify/require" diff --git a/contrib/labstack/echo.v4/echotrace.go b/contrib/labstack/echo.v4/echotrace.go index fc1a6093f8..f678d1104f 100644 --- a/contrib/labstack/echo.v4/echotrace.go +++ b/contrib/labstack/echo.v4/echotrace.go @@ -12,13 +12,13 @@ import ( "net/http" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/labstack/echo/v4" ) diff --git a/contrib/labstack/echo.v4/echotrace_test.go b/contrib/labstack/echo.v4/echotrace_test.go index 6ac98fe3e1..035961737d 100644 --- a/contrib/labstack/echo.v4/echotrace_test.go +++ b/contrib/labstack/echo.v4/echotrace_test.go @@ -13,12 +13,12 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/labstack/echo/v4" "github.com/stretchr/testify/assert" @@ -92,6 +92,7 @@ func TestTrace200(t *testing.T) { assert.Equal(root.Context().SpanID(), span.ParentID()) assert.Equal("labstack/echo.v4", span.Tag(ext.Component)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) + assert.Equal("/user/:id", span.Tag(ext.HTTPRoute)) assert.Equal("http://example.com/user/123", span.Tag(ext.HTTPURL)) } diff --git a/contrib/labstack/echo.v4/example_test.go b/contrib/labstack/echo.v4/example_test.go index 07b1b3c1e1..9ef66f8534 100644 --- a/contrib/labstack/echo.v4/example_test.go +++ b/contrib/labstack/echo.v4/example_test.go @@ -6,7 +6,7 @@ package echo import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/labstack/echo/v4" ) diff --git a/contrib/labstack/echo.v4/option.go b/contrib/labstack/echo.v4/option.go index 57694c2320..d4280356b2 100644 --- a/contrib/labstack/echo.v4/option.go +++ b/contrib/labstack/echo.v4/option.go @@ -9,10 +9,10 @@ import ( "errors" "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/labstack/echo/v4" ) diff --git a/contrib/miekg/dns/dns.go b/contrib/miekg/dns/dns.go index 95b003ae46..b759b9c836 100644 --- a/contrib/miekg/dns/dns.go +++ b/contrib/miekg/dns/dns.go @@ -11,11 +11,11 @@ import ( "net" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/miekg/dns" ) diff --git a/contrib/miekg/dns/dns_test.go b/contrib/miekg/dns/dns_test.go index c1efa2a799..9f27672934 100644 --- a/contrib/miekg/dns/dns_test.go +++ b/contrib/miekg/dns/dns_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - dnstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + dnstrace "github.com/DataDog/dd-trace-go/v2/contrib/miekg/dns" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" "github.com/miekg/dns" "github.com/stretchr/testify/assert" diff --git a/contrib/miekg/dns/example_test.go b/contrib/miekg/dns/example_test.go index 31b78ebf90..201e35805d 100644 --- a/contrib/miekg/dns/example_test.go +++ b/contrib/miekg/dns/example_test.go @@ -8,7 +8,7 @@ package dns_test import ( "fmt" - dnstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/miekg/dns" + dnstrace "github.com/DataDog/dd-trace-go/v2/contrib/miekg/dns" "github.com/miekg/dns" ) diff --git a/contrib/net/http/example_test.go b/contrib/net/http/example_test.go index 748e5477d6..02e0710efb 100644 --- a/contrib/net/http/example_test.go +++ b/contrib/net/http/example_test.go @@ -8,7 +8,7 @@ package http_test import ( "net/http" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" ) func Example() { diff --git a/contrib/net/http/http.go b/contrib/net/http/http.go index 963483c2db..360e960100 100644 --- a/contrib/net/http/http.go +++ b/contrib/net/http/http.go @@ -4,16 +4,16 @@ // Copyright 2016 Datadog, Inc. // Package http provides functions to trace the net/http package (https://golang.org/pkg/net/http). -package http // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" +package http // import "github.com/DataDog/dd-trace-go/v2/contrib/net/http" import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" ) // ServeMux is an HTTP request multiplexer that traces all the incoming requests. @@ -85,8 +85,9 @@ func WrapHandler(h http.Handler, service, resource string, opts ...Option) http. if r := cfg.resourceNamer(req); r != "" { resc = r } - so := make([]ddtrace.StartSpanOption, len(cfg.spanOpts)) + so := make([]ddtrace.StartSpanOption, len(cfg.spanOpts), len(cfg.spanOpts)+1) copy(so, cfg.spanOpts) + so = append(so, httptrace.HeaderTagsFromRequest(req, cfg.headerTags)) TraceAndServe(h, w, req, &ServeConfig{ Service: service, Resource: resc, diff --git a/contrib/net/http/http_test.go b/contrib/net/http/http_test.go index 0a6bba960c..513195ad7f 100644 --- a/contrib/net/http/http_test.go +++ b/contrib/net/http/http_test.go @@ -12,12 +12,12 @@ import ( "sync" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/stretchr/testify/assert" ) @@ -104,6 +104,41 @@ func TestWithHeaderTags(t *testing.T) { assert.NotContains(s.Tags(), "http.headers.x-datadog-header") assert.NotContains(s.Tags(), globalT) }) + + t.Run("wrap-handler", func(t *testing.T) { + mt := mocktracer.Start() + defer mt.Stop() + htArgs := []string{"h!e@a-d.e*r", "2header", "3header"} + + handler := WrapHandler(http.HandlerFunc(handler200), "my-service", "my-resource", + WithHeaderTags(htArgs), + ) + + url := "/" + r := httptest.NewRequest("GET", url, nil) + r.Header.Set("h!e@a-d.e*r", "val") + r.Header.Add("h!e@a-d.e*r", "val2") + r.Header.Set("2header", "2val") + r.Header.Set("3header", "3val") + r.Header.Set("x-datadog-header", "value") + w := httptest.NewRecorder() + handler.ServeHTTP(w, r) + + assert := assert.New(t) + assert.Equal(200, w.Code) + assert.Equal("OK\n", w.Body.String()) + + spans := mt.FinishedSpans() + assert.Equal(1, len(spans)) + + s := spans[0] + assert.Equal("http.request", s.OperationName()) + + for _, arg := range htArgs { + header, tag := normalizer.HeaderTag(arg) + assert.Equal(strings.Join(r.Header.Values(header), ","), s.Tags()[tag]) + } + }) } func TestHttpTracer200(t *testing.T) { diff --git a/contrib/net/http/make_responsewriter.go b/contrib/net/http/make_responsewriter.go index b9ff8a2e13..b42b6f63da 100644 --- a/contrib/net/http/make_responsewriter.go +++ b/contrib/net/http/make_responsewriter.go @@ -17,7 +17,7 @@ import ( "os" "text/template" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/lists" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/lists" ) func main() { diff --git a/contrib/net/http/option.go b/contrib/net/http/option.go index e956e7ac4c..7c0915a8fd 100644 --- a/contrib/net/http/option.go +++ b/contrib/net/http/option.go @@ -9,13 +9,13 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "http.router" diff --git a/contrib/net/http/roundtripper.go b/contrib/net/http/roundtripper.go index 20ba543ddd..5692c67884 100644 --- a/contrib/net/http/roundtripper.go +++ b/contrib/net/http/roundtripper.go @@ -12,9 +12,9 @@ import ( "os" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) type roundTripper struct { diff --git a/contrib/net/http/roundtripper_test.go b/contrib/net/http/roundtripper_test.go index 5528799f19..7155c4b9e0 100644 --- a/contrib/net/http/roundtripper_test.go +++ b/contrib/net/http/roundtripper_test.go @@ -16,12 +16,12 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/net/http/trace.go b/contrib/net/http/trace.go index 031c848b83..69688aaa61 100644 --- a/contrib/net/http/trace.go +++ b/contrib/net/http/trace.go @@ -3,20 +3,20 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package http // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" +package http // import "github.com/DataDog/dd-trace-go/v2/contrib/net/http" //go:generate sh -c "go run make_responsewriter.go | gofmt > trace_gen.go" import ( "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) const componentName = "net/http" diff --git a/contrib/net/http/trace_test.go b/contrib/net/http/trace_test.go index f44789ae9a..acb0aecc46 100644 --- a/contrib/net/http/trace_test.go +++ b/contrib/net/http/trace_test.go @@ -12,10 +12,10 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" ) diff --git a/contrib/olivere/elastic/elastictrace.go b/contrib/olivere/elastic/elastictrace.go index a5440dc5db..b1cdab0d20 100644 --- a/contrib/olivere/elastic/elastictrace.go +++ b/contrib/olivere/elastic/elastictrace.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package elastic provides functions to trace the gopkg.in/olivere/elastic.v{3,5} packages. -package elastic // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/olivere/elastic" +package elastic // import "github.com/DataDog/dd-trace-go/v2/contrib/olivere/elastic" import ( "bufio" @@ -18,11 +18,11 @@ import ( "regexp" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) const componentName = "olivere/elastic" diff --git a/contrib/olivere/elastic/elastictrace_test.go b/contrib/olivere/elastic/elastictrace_test.go index 2633f2faff..39ab62385c 100644 --- a/contrib/olivere/elastic/elastictrace_test.go +++ b/contrib/olivere/elastic/elastictrace_test.go @@ -14,10 +14,10 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/olivere/elastic/example_test.go b/contrib/olivere/elastic/example_test.go index b21759b761..d9441cd522 100644 --- a/contrib/olivere/elastic/example_test.go +++ b/contrib/olivere/elastic/example_test.go @@ -8,8 +8,8 @@ package elastic_test import ( "context" - elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/olivere/elastic" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + elastictrace "github.com/DataDog/dd-trace-go/v2/contrib/olivere/elastic" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" elasticv3 "gopkg.in/olivere/elastic.v3" elasticv5 "gopkg.in/olivere/elastic.v5" diff --git a/contrib/olivere/elastic/option.go b/contrib/olivere/elastic/option.go index 9b9d6b6f7f..e885b039a4 100644 --- a/contrib/olivere/elastic/option.go +++ b/contrib/olivere/elastic/option.go @@ -9,8 +9,8 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "elastic.client" diff --git a/contrib/redis/go-redis.v9/example_test.go b/contrib/redis/go-redis.v9/example_test.go index 0b65ab52ae..947978ae24 100644 --- a/contrib/redis/go-redis.v9/example_test.go +++ b/contrib/redis/go-redis.v9/example_test.go @@ -9,9 +9,9 @@ import ( "context" "time" - redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/redis/go-redis.v9" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + redistrace "github.com/DataDog/dd-trace-go/v2/contrib/redis/go-redis.v9" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/redis/go-redis/v9" ) diff --git a/contrib/redis/go-redis.v9/option.go b/contrib/redis/go-redis.v9/option.go index 4036d5c6ff..0cfe2c8c4f 100644 --- a/contrib/redis/go-redis.v9/option.go +++ b/contrib/redis/go-redis.v9/option.go @@ -8,8 +8,8 @@ package redis import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "redis.client" diff --git a/contrib/redis/go-redis.v9/redis.go b/contrib/redis/go-redis.v9/redis.go index 97a4fa6b10..a698d1b571 100644 --- a/contrib/redis/go-redis.v9/redis.go +++ b/contrib/redis/go-redis.v9/redis.go @@ -14,10 +14,10 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/telemetry" "github.com/redis/go-redis/v9" ) diff --git a/contrib/redis/go-redis.v9/redis_test.go b/contrib/redis/go-redis.v9/redis_test.go index 5df40ed7af..511301d8b6 100644 --- a/contrib/redis/go-redis.v9/redis_test.go +++ b/contrib/redis/go-redis.v9/redis_test.go @@ -13,12 +13,12 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/redis/go-redis/v9" "github.com/stretchr/testify/assert" diff --git a/contrib/segmentio/kafka.go.v0/example_test.go b/contrib/segmentio/kafka.go.v0/example_test.go index 11dbd328a3..1229c90765 100644 --- a/contrib/segmentio/kafka.go.v0/example_test.go +++ b/contrib/segmentio/kafka.go.v0/example_test.go @@ -10,8 +10,8 @@ import ( "log" "time" - kafkatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/segmentio/kafka.go.v0" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + kafkatrace "github.com/DataDog/dd-trace-go/v2/contrib/segmentio/kafka.go.v0" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" kafka "github.com/segmentio/kafka-go" ) diff --git a/contrib/segmentio/kafka.go.v0/headers.go b/contrib/segmentio/kafka.go.v0/headers.go index ce19449d5a..81e65870a7 100644 --- a/contrib/segmentio/kafka.go.v0/headers.go +++ b/contrib/segmentio/kafka.go.v0/headers.go @@ -6,8 +6,8 @@ package kafka import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/segmentio/kafka-go" ) diff --git a/contrib/segmentio/kafka.go.v0/kafka.go b/contrib/segmentio/kafka.go.v0/kafka.go index d008dd04fe..7225572dfa 100644 --- a/contrib/segmentio/kafka.go.v0/kafka.go +++ b/contrib/segmentio/kafka.go.v0/kafka.go @@ -3,18 +3,18 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package kafka // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/segmentio/kafka.go.v0" +package kafka // import "github.com/DataDog/dd-trace-go/v2/contrib/segmentio/kafka.go.v0" import ( "context" "math" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/segmentio/kafka-go" ) diff --git a/contrib/segmentio/kafka.go.v0/kafka_test.go b/contrib/segmentio/kafka.go.v0/kafka_test.go index 072048442d..74fd9cb259 100644 --- a/contrib/segmentio/kafka.go.v0/kafka_test.go +++ b/contrib/segmentio/kafka.go.v0/kafka_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" kafka "github.com/segmentio/kafka-go" "github.com/stretchr/testify/assert" diff --git a/contrib/segmentio/kafka.go.v0/option.go b/contrib/segmentio/kafka.go.v0/option.go index 82a7bcce0d..db8441508a 100644 --- a/contrib/segmentio/kafka.go.v0/option.go +++ b/contrib/segmentio/kafka.go.v0/option.go @@ -8,8 +8,8 @@ package kafka import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "kafka" diff --git a/contrib/segmentio/kafka.go.v0/option_test.go b/contrib/segmentio/kafka.go.v0/option_test.go index c97e149801..939c1fc902 100644 --- a/contrib/segmentio/kafka.go.v0/option_test.go +++ b/contrib/segmentio/kafka.go.v0/option_test.go @@ -9,7 +9,7 @@ import ( "math" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" ) diff --git a/contrib/sirupsen/logrus/example_test.go b/contrib/sirupsen/logrus/example_test.go index 4cafbcaebf..105ad7b575 100644 --- a/contrib/sirupsen/logrus/example_test.go +++ b/contrib/sirupsen/logrus/example_test.go @@ -10,7 +10,7 @@ import ( "os" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/sirupsen/logrus" ) diff --git a/contrib/sirupsen/logrus/logrus.go b/contrib/sirupsen/logrus/logrus.go index cce5dd43f4..29934c76e8 100644 --- a/contrib/sirupsen/logrus/logrus.go +++ b/contrib/sirupsen/logrus/logrus.go @@ -7,8 +7,8 @@ package logrus import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/sirupsen/logrus" ) diff --git a/contrib/sirupsen/logrus/logrus_test.go b/contrib/sirupsen/logrus/logrus_test.go index be23324b4d..558986f44e 100644 --- a/contrib/sirupsen/logrus/logrus_test.go +++ b/contrib/sirupsen/logrus/logrus_test.go @@ -9,7 +9,7 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" diff --git a/contrib/syndtr/goleveldb/leveldb/example_test.go b/contrib/syndtr/goleveldb/leveldb/example_test.go index 850d40f74d..2fd0ae4358 100644 --- a/contrib/syndtr/goleveldb/leveldb/example_test.go +++ b/contrib/syndtr/goleveldb/leveldb/example_test.go @@ -8,8 +8,8 @@ package leveldb_test import ( "context" - leveldbtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + leveldbtrace "github.com/DataDog/dd-trace-go/v2/contrib/syndtr/goleveldb/leveldb" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) func Example() { diff --git a/contrib/syndtr/goleveldb/leveldb/leveldb.go b/contrib/syndtr/goleveldb/leveldb/leveldb.go index 8047d6bf72..d971f8aae6 100644 --- a/contrib/syndtr/goleveldb/leveldb/leveldb.go +++ b/contrib/syndtr/goleveldb/leveldb/leveldb.go @@ -4,17 +4,17 @@ // Copyright 2016 Datadog, Inc. // Package leveldb provides functions to trace the syndtr/goleveldb package (https://github.com/syndtr/goleveldb). -package leveldb // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/syndtr/goleveldb/leveldb" +package leveldb // import "github.com/DataDog/dd-trace-go/v2/contrib/syndtr/goleveldb/leveldb" import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/contrib/syndtr/goleveldb/leveldb/leveldb_test.go b/contrib/syndtr/goleveldb/leveldb/leveldb_test.go index a0fe6dd631..8a5b3f0594 100644 --- a/contrib/syndtr/goleveldb/leveldb/leveldb_test.go +++ b/contrib/syndtr/goleveldb/leveldb/leveldb_test.go @@ -9,11 +9,11 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/syndtr/goleveldb/leveldb/option.go b/contrib/syndtr/goleveldb/leveldb/option.go index 84f3918b93..634815db20 100644 --- a/contrib/syndtr/goleveldb/leveldb/option.go +++ b/contrib/syndtr/goleveldb/leveldb/option.go @@ -9,8 +9,8 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "leveldb" diff --git a/contrib/tidwall/buntdb/buntdb.go b/contrib/tidwall/buntdb/buntdb.go index 363a08db62..6d85c732a8 100644 --- a/contrib/tidwall/buntdb/buntdb.go +++ b/contrib/tidwall/buntdb/buntdb.go @@ -10,11 +10,11 @@ import ( "math" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/tidwall/buntdb" ) diff --git a/contrib/tidwall/buntdb/buntdb_test.go b/contrib/tidwall/buntdb/buntdb_test.go index 8f75ef7816..afbca0bf5f 100644 --- a/contrib/tidwall/buntdb/buntdb_test.go +++ b/contrib/tidwall/buntdb/buntdb_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/tidwall/buntdb/example_test.go b/contrib/tidwall/buntdb/example_test.go index d17c460a20..e910d89cc0 100644 --- a/contrib/tidwall/buntdb/example_test.go +++ b/contrib/tidwall/buntdb/example_test.go @@ -9,8 +9,8 @@ import ( "context" "log" - buntdbtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/tidwall/buntdb" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + buntdbtrace "github.com/DataDog/dd-trace-go/v2/contrib/tidwall/buntdb" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) func Example() { diff --git a/contrib/tidwall/buntdb/option.go b/contrib/tidwall/buntdb/option.go index 576121f625..bf55d8a8dd 100644 --- a/contrib/tidwall/buntdb/option.go +++ b/contrib/tidwall/buntdb/option.go @@ -9,8 +9,8 @@ import ( "context" "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "buntdb" diff --git a/contrib/twitchtv/twirp/example_test.go b/contrib/twitchtv/twirp/example_test.go index c1a593dd96..f1190bc21a 100644 --- a/contrib/twitchtv/twirp/example_test.go +++ b/contrib/twitchtv/twirp/example_test.go @@ -10,8 +10,8 @@ import ( "fmt" "net/http" - twirptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/twitchtv/twirp" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + twirptrace "github.com/DataDog/dd-trace-go/v2/contrib/twitchtv/twirp" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/twitchtv/twirp/example" ) diff --git a/contrib/twitchtv/twirp/option.go b/contrib/twitchtv/twirp/option.go index 6b5c46aa49..2b84da708d 100644 --- a/contrib/twitchtv/twirp/option.go +++ b/contrib/twitchtv/twirp/option.go @@ -8,9 +8,9 @@ package twirp import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const ( diff --git a/contrib/twitchtv/twirp/twirp.go b/contrib/twitchtv/twirp/twirp.go index e940e6a057..759988715e 100644 --- a/contrib/twitchtv/twirp/twirp.go +++ b/contrib/twitchtv/twirp/twirp.go @@ -5,7 +5,7 @@ // Package twirp provides tracing functions for tracing clients and servers generated // by the twirp framework (https://github.com/twitchtv/twirp). -package twirp // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/twitchtv/twirp" +package twirp // import "github.com/DataDog/dd-trace-go/v2/contrib/twitchtv/twirp" import ( "context" @@ -14,11 +14,11 @@ import ( "net/http" "strconv" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/twitchtv/twirp" ) diff --git a/contrib/twitchtv/twirp/twirp_test.go b/contrib/twitchtv/twirp/twirp_test.go index b8100b8f01..16231ada0e 100644 --- a/contrib/twitchtv/twirp/twirp_test.go +++ b/contrib/twitchtv/twirp/twirp_test.go @@ -12,11 +12,11 @@ import ( "net/http" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/urfave/negroni/example_test.go b/contrib/urfave/negroni/example_test.go index ad2057ecc4..7a89e0c80c 100644 --- a/contrib/urfave/negroni/example_test.go +++ b/contrib/urfave/negroni/example_test.go @@ -7,8 +7,8 @@ package negroni_test import ( "net/http" - negronitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/urfave/negroni" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + negronitrace "github.com/DataDog/dd-trace-go/v2/contrib/urfave/negroni" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/urfave/negroni" ) diff --git a/contrib/urfave/negroni/negroni.go b/contrib/urfave/negroni/negroni.go index fa72670bf4..ff62f532c5 100644 --- a/contrib/urfave/negroni/negroni.go +++ b/contrib/urfave/negroni/negroni.go @@ -11,11 +11,11 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/httptrace" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/urfave/negroni" ) @@ -33,12 +33,15 @@ type DatadogMiddleware struct { } func (m *DatadogMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { - opts := append(m.cfg.spanOpts, tracer.ServiceName(m.cfg.serviceName), tracer.ResourceName(m.cfg.resourceNamer(r))) - opts = append(opts, httptrace.HeaderTagsFromRequest(r, m.cfg.headerTags)) + opts := append( + m.cfg.spanOpts, + tracer.ServiceName(m.cfg.serviceName), + tracer.ResourceName(m.cfg.resourceNamer(r)), + httptrace.HeaderTagsFromRequest(r, m.cfg.headerTags), + ) if !math.IsNaN(m.cfg.analyticsRate) { opts = append(opts, tracer.Tag(ext.EventSampleRate, m.cfg.analyticsRate)) } - span, ctx := httptrace.StartRequestSpan(r, opts...) defer func() { // check if the responseWriter is of type negroni.ResponseWriter diff --git a/contrib/urfave/negroni/negroni_test.go b/contrib/urfave/negroni/negroni_test.go index 67e38bab40..71e5424909 100644 --- a/contrib/urfave/negroni/negroni_test.go +++ b/contrib/urfave/negroni/negroni_test.go @@ -14,12 +14,12 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/contrib/urfave/negroni/option.go b/contrib/urfave/negroni/option.go index b855d7d53f..0e86466bc0 100644 --- a/contrib/urfave/negroni/option.go +++ b/contrib/urfave/negroni/option.go @@ -10,11 +10,11 @@ import ( "math" "net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" ) const defaultServiceName = "negroni.router" diff --git a/contrib/zenazn/goji.v1/web/example_test.go b/contrib/zenazn/goji.v1/web/example_test.go index ec7051c4f0..9f99a4a799 100644 --- a/contrib/zenazn/goji.v1/web/example_test.go +++ b/contrib/zenazn/goji.v1/web/example_test.go @@ -9,7 +9,7 @@ import ( "fmt" "net/http" - webtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/zenazn/goji.v1/web" + webtrace "github.com/DataDog/dd-trace-go/v2/contrib/zenazn/goji.v1/web" "github.com/zenazn/goji" "github.com/zenazn/goji/web" diff --git a/contrib/zenazn/goji.v1/web/goji.go b/contrib/zenazn/goji.v1/web/goji.go index 784b8de08e..05ca4066da 100644 --- a/contrib/zenazn/goji.v1/web/goji.go +++ b/contrib/zenazn/goji.v1/web/goji.go @@ -4,7 +4,7 @@ // Copyright 2016 Datadog, Inc. // Package web provides functions to trace the zenazn/goji/web package (https://github.com/zenazn/goji). -package web // import "gopkg.in/DataDog/dd-trace-go.v1/contrib/zenazn/goji.v1/web" +package web // import "github.com/DataDog/dd-trace-go/v2/contrib/zenazn/goji.v1/web" import ( "fmt" @@ -12,11 +12,11 @@ import ( "net/http" "sync" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "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/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/zenazn/goji/web" ) @@ -52,8 +52,10 @@ func Middleware(opts ...Option) func(*web.C, http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { resource := r.Method p := web.GetMatch(*c).RawPattern() + route := "" if p != nil { - resource += fmt.Sprintf(" %s", p) + route = fmt.Sprintf("%s", p) + resource = resource + " " + route } else { warnonce.Do(func() { log.Warn("contrib/zenazn/goji.v1/web: routes are unavailable. To enable them add the goji Router middleware before the tracer middleware.") @@ -64,6 +66,7 @@ func Middleware(opts ...Option) func(*web.C, http.Handler) http.Handler { Resource: resource, FinishOpts: cfg.finishOpts, SpanOpts: cfg.spanOpts, + Route: route, }) }) } diff --git a/contrib/zenazn/goji.v1/web/goji_test.go b/contrib/zenazn/goji.v1/web/goji_test.go index 03db7a73bf..0cae1fe07d 100644 --- a/contrib/zenazn/goji.v1/web/goji_test.go +++ b/contrib/zenazn/goji.v1/web/goji_test.go @@ -11,12 +11,12 @@ import ( "net/http/httptest" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/contrib/internal/namingschematest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -52,6 +52,7 @@ func TestNoRouter(t *testing.T) { assert.Equal("http://example.com/user/123", span.Tag(ext.HTTPURL)) assert.Equal("zenazn/goji.v1/web", span.Tag(ext.Component)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) + assert.NotContains(span.Tags(), ext.HTTPRoute) } func TestTraceWithRouter(t *testing.T) { @@ -91,6 +92,7 @@ func TestTraceWithRouter(t *testing.T) { assert.Equal("http://example.com/user/123", span.Tag(ext.HTTPURL)) assert.Equal("zenazn/goji.v1/web", span.Tag(ext.Component)) assert.Equal(ext.SpanKindServer, span.Tag(ext.SpanKind)) + assert.Equal("/user/:id", span.Tag(ext.HTTPRoute)) } func TestError(t *testing.T) { diff --git a/contrib/zenazn/goji.v1/web/option.go b/contrib/zenazn/goji.v1/web/option.go index 8dc88f0e4a..95ca8e37b0 100644 --- a/contrib/zenazn/goji.v1/web/option.go +++ b/contrib/zenazn/goji.v1/web/option.go @@ -8,11 +8,11 @@ package web import ( "math" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" ) const defaultServiceName = "http.router" diff --git a/datastreams/pathway.go b/datastreams/pathway.go index 233fd6cad4..828e843445 100644 --- a/datastreams/pathway.go +++ b/datastreams/pathway.go @@ -8,7 +8,7 @@ package datastreams import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/internal/datastreams" ) type Pathway interface { diff --git a/datastreams/propagation.go b/datastreams/propagation.go index ca657b9d80..9229048b08 100644 --- a/datastreams/propagation.go +++ b/datastreams/propagation.go @@ -8,7 +8,7 @@ package datastreams import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/internal/datastreams" ) // MergeContexts returns the first context which includes the pathway resulting from merging the pathways diff --git a/datastreams/propagation_test.go b/datastreams/propagation_test.go index f29960cdeb..0209f72d24 100644 --- a/datastreams/propagation_test.go +++ b/datastreams/propagation_test.go @@ -9,9 +9,9 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/datastreams" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/ddtrace.go b/ddtrace/ddtrace.go index c4d106458c..be2ae1eee1 100644 --- a/ddtrace/ddtrace.go +++ b/ddtrace/ddtrace.go @@ -10,14 +10,14 @@ // package "ext" provides a set of tag names and values specific to Datadog's APM product. // // To get started, visit the documentation for any of the packages you'd like to begin -// with by accessing the subdirectories of this package: https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace#pkg-subdirectories. -package ddtrace // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" +// with by accessing the subdirectories of this package: https://godoc.org/github.com/DataDog/dd-trace-go/v2/ddtrace#pkg-subdirectories. +package ddtrace // import "github.com/DataDog/dd-trace-go/v2/ddtrace" import ( "context" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // SpanContextW3C represents a SpanContext with an additional method to allow diff --git a/ddtrace/example_test.go b/ddtrace/example_test.go index 29217082ce..c35b3bd626 100644 --- a/ddtrace/example_test.go +++ b/ddtrace/example_test.go @@ -10,11 +10,11 @@ import ( "log" "os" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/opentracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/ddtrace/ext/app_types.go b/ddtrace/ext/app_types.go index eb6ded8f60..3261e1a9b7 100644 --- a/ddtrace/ext/app_types.go +++ b/ddtrace/ext/app_types.go @@ -3,7 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package ext // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" +package ext // import "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" // App types determine how to categorize a trace in the Datadog application. // For more fine-grained behaviour, use the SpanType* constants. diff --git a/ddtrace/internal/globaltracer.go b/ddtrace/internal/globaltracer.go index 363d1f9983..ebd4c96cce 100644 --- a/ddtrace/internal/globaltracer.go +++ b/ddtrace/internal/globaltracer.go @@ -3,12 +3,12 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package internal // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" +package internal // import "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" import ( "sync/atomic" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" ) var ( diff --git a/ddtrace/internal/globaltracer_test.go b/ddtrace/internal/globaltracer_test.go index 09a0bd5422..534adf9152 100644 --- a/ddtrace/internal/globaltracer_test.go +++ b/ddtrace/internal/globaltracer_test.go @@ -3,13 +3,13 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package internal // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" +package internal // import "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" import ( "sync" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" ) type raceTestTracer struct { diff --git a/ddtrace/mocktracer/example_test.go b/ddtrace/mocktracer/example_test.go index c7a0c0822f..8a0a206414 100644 --- a/ddtrace/mocktracer/example_test.go +++ b/ddtrace/mocktracer/example_test.go @@ -6,7 +6,7 @@ package mocktracer_test import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" ) func Example() { diff --git a/ddtrace/mocktracer/mockspan.go b/ddtrace/mocktracer/mockspan.go index 506cb1145b..d8e4041d29 100644 --- a/ddtrace/mocktracer/mockspan.go +++ b/ddtrace/mocktracer/mockspan.go @@ -3,16 +3,16 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package mocktracer // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" +package mocktracer // import "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" import ( "fmt" "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) var _ ddtrace.Span = (*mockspan)(nil) diff --git a/ddtrace/mocktracer/mockspan_test.go b/ddtrace/mocktracer/mockspan_test.go index ad289434f4..6976d4988b 100644 --- a/ddtrace/mocktracer/mockspan_test.go +++ b/ddtrace/mocktracer/mockspan_test.go @@ -10,9 +10,9 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/ddtrace/mocktracer/mockspancontext.go b/ddtrace/mocktracer/mockspancontext.go index 738a24cfff..a2e9291416 100644 --- a/ddtrace/mocktracer/mockspancontext.go +++ b/ddtrace/mocktracer/mockspancontext.go @@ -9,7 +9,7 @@ import ( "sync" "sync/atomic" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" ) var _ ddtrace.SpanContext = (*spanContext)(nil) diff --git a/ddtrace/mocktracer/mocktracer.go b/ddtrace/mocktracer/mocktracer.go index e397088af7..c3c8d07286 100644 --- a/ddtrace/mocktracer/mocktracer.go +++ b/ddtrace/mocktracer/mocktracer.go @@ -17,10 +17,10 @@ import ( "strings" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/datastreams" ) var _ ddtrace.Tracer = (*mocktracer)(nil) diff --git a/ddtrace/mocktracer/mocktracer_test.go b/ddtrace/mocktracer/mocktracer_test.go index 1b761f94e7..2ffa0808af 100644 --- a/ddtrace/mocktracer/mocktracer_test.go +++ b/ddtrace/mocktracer/mocktracer_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/opentelemetry/example_test.go b/ddtrace/opentelemetry/example_test.go index 70eebbf5f1..ec5d10db4a 100644 --- a/ddtrace/opentelemetry/example_test.go +++ b/ddtrace/opentelemetry/example_test.go @@ -10,9 +10,9 @@ import ( "log" "os" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - ddotel "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentelemetry" - ddtracer "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + ddotel "github.com/DataDog/dd-trace-go/v2/ddtrace/opentelemetry" + ddtracer "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" diff --git a/ddtrace/opentelemetry/options.go b/ddtrace/opentelemetry/options.go index a00024b90d..ffe6c275cc 100644 --- a/ddtrace/opentelemetry/options.go +++ b/ddtrace/opentelemetry/options.go @@ -8,7 +8,7 @@ package opentelemetry import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) type contextOptionsKey struct{} diff --git a/ddtrace/opentelemetry/span.go b/ddtrace/opentelemetry/span.go index 04551bea28..9630d72936 100644 --- a/ddtrace/opentelemetry/span.go +++ b/ddtrace/opentelemetry/span.go @@ -7,13 +7,14 @@ package opentelemetry import ( "encoding/binary" + "errors" "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" "go.opentelemetry.io/otel/attribute" otelcodes "go.opentelemetry.io/otel/codes" @@ -45,6 +46,7 @@ func (s *span) End(options ...oteltrace.SpanEndOption) { var opts []tracer.FinishOption if s.statusInfo.code == otelcodes.Error { s.SetTag(ext.ErrorMsg, s.statusInfo.description) + opts = append(opts, tracer.WithError(errors.New(s.statusInfo.description))) } if t := finishCfg.Timestamp(); !t.IsZero() { opts = append(opts, tracer.FinishTime(t)) diff --git a/ddtrace/opentelemetry/span_test.go b/ddtrace/opentelemetry/span_test.go index 6a16132723..c45bbb262b 100644 --- a/ddtrace/opentelemetry/span_test.go +++ b/ddtrace/opentelemetry/span_test.go @@ -16,9 +16,9 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/httpmem" + "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/internal/httpmem" "github.com/stretchr/testify/assert" "github.com/tinylib/msgp/msgp" @@ -148,6 +148,7 @@ func TestSpanEnd(t *testing.T) { assert.NotContains(payload, ignoredName) assert.Contains(payload, msg) assert.NotContains(payload, ignoredMsg) + assert.Contains(payload, `"error":1`) // this should be an error span for k, v := range attributes { assert.Contains(payload, fmt.Sprintf("\"%s\":\"%s\"", k, v)) @@ -374,6 +375,7 @@ func TestSpanEndOptions(t *testing.T) { assert.Contains(p, fmt.Sprint(startTime.UnixNano())) assert.Contains(p, `"duration":5000000000,`) assert.Contains(p, `persisted_option`) + assert.Contains(p, `"error":1`) } func TestSpanSetAttributes(t *testing.T) { diff --git a/ddtrace/opentelemetry/telemetry_test.go b/ddtrace/opentelemetry/telemetry_test.go index f897004e93..780d4620d5 100644 --- a/ddtrace/opentelemetry/telemetry_test.go +++ b/ddtrace/opentelemetry/telemetry_test.go @@ -9,8 +9,8 @@ import ( "fmt" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/opentelemetry/tracer.go b/ddtrace/opentelemetry/tracer.go index 33f5fd63aa..f5b616eb24 100644 --- a/ddtrace/opentelemetry/tracer.go +++ b/ddtrace/opentelemetry/tracer.go @@ -10,9 +10,9 @@ import ( "encoding/binary" "encoding/hex" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" oteltrace "go.opentelemetry.io/otel/trace" ) diff --git a/ddtrace/opentelemetry/tracer_provider.go b/ddtrace/opentelemetry/tracer_provider.go index d8b906ef6b..c3d7e431de 100644 --- a/ddtrace/opentelemetry/tracer_provider.go +++ b/ddtrace/opentelemetry/tracer_provider.go @@ -31,9 +31,9 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/log" oteltrace "go.opentelemetry.io/otel/trace" ) diff --git a/ddtrace/opentelemetry/tracer_test.go b/ddtrace/opentelemetry/tracer_test.go index e3b8480f12..43e78bcfed 100644 --- a/ddtrace/opentelemetry/tracer_test.go +++ b/ddtrace/opentelemetry/tracer_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel" diff --git a/ddtrace/opentracer/example_test.go b/ddtrace/opentracer/example_test.go index ac0fe71fe5..1d93efaefb 100644 --- a/ddtrace/opentracer/example_test.go +++ b/ddtrace/opentracer/example_test.go @@ -6,8 +6,8 @@ package opentracer_test import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/opentracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/ddtrace/opentracer/option.go b/ddtrace/opentracer/option.go index 735426b58c..04e59a5ad5 100644 --- a/ddtrace/opentracer/option.go +++ b/ddtrace/opentracer/option.go @@ -3,10 +3,10 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016 Datadog, Inc. -package opentracer // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer" +package opentracer // import "github.com/DataDog/dd-trace-go/v2/ddtrace/opentracer" import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/ddtrace/opentracer/span.go b/ddtrace/opentracer/span.go index 82439f8021..141e24493c 100644 --- a/ddtrace/opentracer/span.go +++ b/ddtrace/opentracer/span.go @@ -8,9 +8,9 @@ package opentracer import ( "fmt" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" opentracing "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/log" diff --git a/ddtrace/opentracer/tracer.go b/ddtrace/opentracer/tracer.go index caf57dc1f7..ac4a3a2ab7 100644 --- a/ddtrace/opentracer/tracer.go +++ b/ddtrace/opentracer/tracer.go @@ -20,17 +20,17 @@ // opentracing.StartSpan("http.request", opentracer.ResourceName("/user/profile")) // // Some libraries and frameworks are supported out-of-the-box by using our integrations. You can see a list -// of supported integrations here: https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib. They are fully +// of supported integrations here: https://godoc.org/github.com/DataDog/dd-trace-go/v2/contrib. They are fully // compatible with the Opentracing implementation. package opentracer import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/ddtrace/opentracer/tracer_test.go b/ddtrace/opentracer/tracer_test.go index 6a57d9a6d3..f7518ab2b6 100644 --- a/ddtrace/opentracer/tracer_test.go +++ b/ddtrace/opentracer/tracer_test.go @@ -9,11 +9,11 @@ import ( "context" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" "github.com/opentracing/opentracing-go" "github.com/stretchr/testify/assert" diff --git a/ddtrace/tracer/abandonedspans.go b/ddtrace/tracer/abandonedspans.go index defad41831..8f4de08446 100644 --- a/ddtrace/tracer/abandonedspans.go +++ b/ddtrace/tracer/abandonedspans.go @@ -14,7 +14,7 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) var ( diff --git a/ddtrace/tracer/abandonedspans_test.go b/ddtrace/tracer/abandonedspans_test.go index ae8f91feb7..bdf4bc30d1 100644 --- a/ddtrace/tracer/abandonedspans_test.go +++ b/ddtrace/tracer/abandonedspans_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/tracer/context.go b/ddtrace/tracer/context.go index 5698dea685..f9d33f02cf 100644 --- a/ddtrace/tracer/context.go +++ b/ddtrace/tracer/context.go @@ -8,9 +8,9 @@ package tracer import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - traceinternal "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + traceinternal "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/internal" ) // ContextWithSpan returns a copy of the given context which includes the span s. diff --git a/ddtrace/tracer/context_test.go b/ddtrace/tracer/context_test.go index d9ff53ba14..baac923332 100644 --- a/ddtrace/tracer/context_test.go +++ b/ddtrace/tracer/context_test.go @@ -11,9 +11,9 @@ import ( "encoding/hex" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - traceinternal "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + traceinternal "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/tracer/data_streams.go b/ddtrace/tracer/data_streams.go index 32585cd41a..803192a833 100644 --- a/ddtrace/tracer/data_streams.go +++ b/ddtrace/tracer/data_streams.go @@ -8,9 +8,9 @@ package tracer import ( "context" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams/options" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - idatastreams "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/datastreams/options" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + idatastreams "github.com/DataDog/dd-trace-go/v2/internal/datastreams" ) // dataStreamsContainer is an object that contains a data streams processor. diff --git a/ddtrace/tracer/doc.go b/ddtrace/tracer/doc.go index 0880db0d1c..c165d8ad21 100644 --- a/ddtrace/tracer/doc.go +++ b/ddtrace/tracer/doc.go @@ -67,7 +67,7 @@ // not approach this limit as traces of this size are not useful and impossible to // visualize. // -// See the contrib package ( https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib ) +// See the contrib package ( https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib ) // for integrating datadog with various libraries, frameworks and clients. // // All spans created by the tracer contain a context hereby referred to as the span @@ -86,7 +86,7 @@ // interfaces. An example alternate implementation is the MDCarrier in our gRPC integration. // // As an example, injecting a span's context into an HTTP request would look like this. -// (See the net/http contrib package for more examples https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http): +// (See the net/http contrib package for more examples https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/contrib/net/http): // // req, err := http.NewRequest("GET", "http://example.com", nil) // // ... @@ -106,5 +106,5 @@ // // Some libraries and frameworks are supported out-of-the-box by using one // of our integrations. You can see a list of supported integrations here: -// https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib -package tracer // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" +// https://godoc.org/github.com/DataDog/dd-trace-go/v2/contrib +package tracer // import "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" diff --git a/ddtrace/tracer/dynamic_config.go b/ddtrace/tracer/dynamic_config.go new file mode 100644 index 0000000000..e9c0cac931 --- /dev/null +++ b/ddtrace/tracer/dynamic_config.go @@ -0,0 +1,60 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016 Datadog, Inc. + +package tracer + +import ( + "sync" +) + +// dynamicConfig is a thread-safe generic data structure to represent configuration fields. +// It's designed to satisfy the dynamic configuration semantics (i.e reset, update, apply configuration changes). +// This structure will be extended to track the origin of configuration values as well (e.g remote_config, env_var). +type dynamicConfig[T any] struct { + sync.RWMutex + current T // holds the current configuration value + startup T // holds the startup configuration value + apply func(T) // applies a configuration value + isReset bool // internal boolean to avoid unnecessary resets +} + +func newDynamicConfig[T any](val T, apply func(T)) dynamicConfig[T] { + return dynamicConfig[T]{ + current: val, + startup: val, + apply: apply, + isReset: true, + } +} + +// update applies a new configuration value +func (dc *dynamicConfig[T]) update(val T) { + dc.Lock() + defer dc.Unlock() + dc.current = val + dc.apply(val) + dc.isReset = false +} + +// reset re-applies the startup configuration value +func (dc *dynamicConfig[T]) reset() { + dc.Lock() + defer dc.Unlock() + if dc.isReset { + return + } + dc.current = dc.startup + dc.apply(dc.startup) + dc.isReset = true +} + +// handleRC processes a new configuration value from remote config +func (dc *dynamicConfig[T]) handleRC(val *T) { + if val != nil { + dc.update(*val) + return + } + dc.reset() +} diff --git a/ddtrace/tracer/example_test.go b/ddtrace/tracer/example_test.go index ae7ce0883a..8869f83920 100644 --- a/ddtrace/tracer/example_test.go +++ b/ddtrace/tracer/example_test.go @@ -10,8 +10,8 @@ import ( "fmt" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" ) // A basic example demonstrating how to start the tracer, as well as how diff --git a/ddtrace/tracer/exec_tracer_test.go b/ddtrace/tracer/exec_tracer_test.go new file mode 100644 index 0000000000..0ff8e239f9 --- /dev/null +++ b/ddtrace/tracer/exec_tracer_test.go @@ -0,0 +1,95 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016 Datadog, Inc. + +// Tests in this file rely on parsing execution tracer data, which can change +// formats across Go releases. This guard should be updated as the Go trace +// parser library is upgraded to support new versions. +//go:build !go1.21 + +package tracer + +import ( + "bytes" + "context" + "encoding/binary" + rt "runtime/trace" + "testing" + + "github.com/stretchr/testify/assert" + gotraceui "honnef.co/go/gotraceui/trace" +) + +func TestExecutionTraceSpans(t *testing.T) { + if rt.IsEnabled() { + t.Skip("runtime execution tracing is already enabled") + } + + buf := new(bytes.Buffer) + if err := rt.Start(buf); err != nil { + t.Fatal(err) + } + // Ensure we unconditionally stop tracing. It's safe to call this + // multiple times. + defer rt.Stop() + + _, _, _, stop := startTestTracer(t) + defer stop() + + root, ctx := StartSpanFromContext(context.Background(), "root") + child, _ := StartSpanFromContext(ctx, "child") + root.Finish() + child.Finish() + + rt.Stop() + + execTrace, err := gotraceui.Parse(buf, nil) + if err != nil { + t.Fatalf("parsing trace: %s", err) + } + + type traceSpan struct { + name string + parent string + spanID uint64 + } + + spans := make(map[int]*traceSpan) + for _, ev := range execTrace.Events { + switch ev.Type { + case gotraceui.EvUserTaskCreate: + id := int(ev.Args[0]) + name := execTrace.Strings[ev.Args[2]] + var parent string + if p, ok := spans[int(ev.Args[1])]; ok { + parent = p.name + } + spans[id] = &traceSpan{ + name: name, + parent: parent, + } + case gotraceui.EvUserLog: + id := int(ev.Args[0]) + span, ok := spans[id] + if !ok { + continue + } + key := execTrace.Strings[ev.Args[1]] + if key == "datadog.uint64_span_id" { + span.spanID = binary.LittleEndian.Uint64([]byte(execTrace.Strings[ev.Args[3]])) + } + } + } + + want := []traceSpan{ + {name: "root", spanID: root.Context().SpanID()}, + {name: "child", parent: "root", spanID: child.Context().SpanID()}, + } + var got []traceSpan + for _, v := range spans { + got = append(got, *v) + } + + assert.ElementsMatch(t, want, got) +} diff --git a/ddtrace/tracer/log.go b/ddtrace/tracer/log.go index 654d7a4d25..fb2f04a7b9 100644 --- a/ddtrace/tracer/log.go +++ b/ddtrace/tracer/log.go @@ -14,11 +14,11 @@ import ( "runtime" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/osinfo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/osinfo" + "github.com/DataDog/dd-trace-go/v2/internal/version" ) // startupInfo contains various information about the status of the tracer on startup. diff --git a/ddtrace/tracer/log_test.go b/ddtrace/tracer/log_test.go index af20e8a48d..e2a8bedbbe 100644 --- a/ddtrace/tracer/log_test.go +++ b/ddtrace/tracer/log_test.go @@ -11,9 +11,9 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/ddtrace/tracer/metrics.go b/ddtrace/tracer/metrics.go index 409d8a439a..b2532284da 100644 --- a/ddtrace/tracer/metrics.go +++ b/ddtrace/tracer/metrics.go @@ -11,7 +11,7 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // defaultMetricsReportInterval specifies the interval at which runtime metrics will diff --git a/ddtrace/tracer/metrics_test.go b/ddtrace/tracer/metrics_test.go index 30208350ef..e3c71faa23 100644 --- a/ddtrace/tracer/metrics_test.go +++ b/ddtrace/tracer/metrics_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - globalinternal "gopkg.in/DataDog/dd-trace-go.v1/internal" + globalinternal "github.com/DataDog/dd-trace-go/v2/internal" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/tracer/option.go b/ddtrace/tracer/option.go index 1f17f1c837..84d09957f8 100644 --- a/ddtrace/tracer/option.go +++ b/ddtrace/tracer/option.go @@ -22,15 +22,15 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/normalizer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/normalizer" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/DataDog/datadog-go/v5/statsd" ) @@ -253,6 +253,12 @@ type config struct { // orchestrionCfg holds Orchestrion (aka auto-instrumentation) configuration. // Only used for telemetry currently. orchestrionCfg orchestrionConfig + + // traceSampleRate holds the trace sample rate. + traceSampleRate dynamicConfig[float64] + + // headerAsTags holds the header as tags configuration. + headerAsTags dynamicConfig[[]string] } // orchestrionConfig contains Orchestrion configuration. @@ -317,6 +323,7 @@ func newConfig(opts ...StartOption) (*config, error) { if v := os.Getenv("DD_SERVICE_MAPPING"); v != "" { internal.ForEachStringTag(v, func(key, val string) { WithServiceMapping(key, val)(c) }) } + c.headerAsTags = newDynamicConfig(nil, setHeaderTags) if v := os.Getenv("DD_TRACE_HEADER_TAGS"); v != "" { WithHeaderTags(strings.Split(v, ","))(c) } @@ -825,6 +832,26 @@ func WithAgentAddr(addr string) StartOption { } } +// WithAgentURL sets the full trace agent URL +func WithAgentURL(agentURL string) StartOption { + return func(c *config) { + u, err := url.Parse(agentURL) + if err != nil { + log.Warn("Fail to parse Agent URL: %v", err) + return + } + switch u.Scheme { + case "unix", "http", "https": + c.agentURL = &url.URL{ + Scheme: u.Scheme, + Host: u.Host, + } + default: + log.Warn("Unsupported protocol %q in Agent URL %q. Must be one of: http, https, unix.", u.Scheme, agentURL) + } + } +} + // WithEnv sets the environment to which all traces started by the tracer will be submitted. // The default value is the environment variable DD_ENV, if it is set. func WithEnv(env string) StartOption { @@ -1210,14 +1237,19 @@ func StackFrames(n, skip uint) FinishOption { // Special headers can not be sub-selected. E.g., an entire Cookie header would be transmitted, without the ability to choose specific Cookies. func WithHeaderTags(headerAsTags []string) StartOption { return func(c *config) { - globalconfig.ClearHeaderTags() - for _, h := range headerAsTags { - if strings.HasPrefix(h, "x-datadog-") { - continue - } - header, tag := normalizer.HeaderTag(h) - globalconfig.SetHeaderTag(header, tag) + c.headerAsTags = newDynamicConfig(headerAsTags, setHeaderTags) + setHeaderTags(headerAsTags) + } +} + +func setHeaderTags(headerAsTags []string) { + globalconfig.ClearHeaderTags() + for _, h := range headerAsTags { + if strings.HasPrefix(h, "x-datadog-") { + continue } + header, tag := normalizer.HeaderTag(h) + globalconfig.SetHeaderTag(header, tag) } } diff --git a/ddtrace/tracer/option_test.go b/ddtrace/tracer/option_test.go index c9dc002162..37aa38ffe9 100644 --- a/ddtrace/tracer/option_test.go +++ b/ddtrace/tracer/option_test.go @@ -24,10 +24,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -554,6 +555,29 @@ func TestTracerOptionsDefaults(t *testing.T) { c := tracer.config assert.Equal(t, &url.URL{Scheme: "http", Host: "testhost:3333"}, c.agentURL) }) + + t.Run("code-override-full-URL", func(t *testing.T) { + t.Setenv("DD_TRACE_AGENT_URL", "https://custom:1234") + tracer := newTracer(WithAgentURL("http://testhost:3333")) + defer tracer.Stop() + c := tracer.config + assert.Equal(t, &url.URL{Scheme: "http", Host: "testhost:3333"}, c.agentURL) + }) + + t.Run("code-override-full-URL-error", func(t *testing.T) { + tp := new(log.RecordLogger) + // Have to use UseLogger directly before tracer logger is set + defer log.UseLogger(tp)() + t.Setenv("DD_TRACE_AGENT_URL", "https://localhost:1234") + tracer := newTracer(WithAgentURL("go://testhost:3333")) + defer tracer.Stop() + c := tracer.config + assert.Equal(t, &url.URL{Scheme: "https", Host: "localhost:1234"}, c.agentURL) + cond := func() bool { + return strings.Contains(strings.Join(tp.Logs(), ""), "Unsupported protocol") + } + assert.Eventually(t, cond, 1*time.Second, 75*time.Millisecond) + }) }) t.Run("override", func(t *testing.T) { diff --git a/ddtrace/tracer/propagator.go b/ddtrace/tracer/propagator.go index d2ace0d275..b0e07f37ac 100644 --- a/ddtrace/tracer/propagator.go +++ b/ddtrace/tracer/propagator.go @@ -8,7 +8,7 @@ package tracer import ( "errors" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace" ) // Propagator implementations should be able to inject and extract diff --git a/ddtrace/tracer/rand.go b/ddtrace/tracer/rand.go index ecedc3ed10..a8a10e0e7a 100644 --- a/ddtrace/tracer/rand.go +++ b/ddtrace/tracer/rand.go @@ -13,7 +13,7 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // random holds a thread-safe source of random numbers. diff --git a/ddtrace/tracer/remote_config.go b/ddtrace/tracer/remote_config.go new file mode 100644 index 0000000000..91c6d8e533 --- /dev/null +++ b/ddtrace/tracer/remote_config.go @@ -0,0 +1,83 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016 Datadog, Inc. + +package tracer + +import ( + "encoding/json" + "strings" + + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" + + "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" +) + +type configData struct { + Action string `json:"action"` + ServiceTarget target `json:"service_target"` + LibConfig libConfig `json:"lib_config"` +} + +type target struct { + Service string `json:"service"` + Env string `json:"env"` +} + +type libConfig struct { + SamplingRate *float64 `json:"tracing_sampling_rate,omitempty"` + HeaderTags *headerTags `json:"tracing_header_tags,omitempty"` +} + +type headerTags []headerTag + +type headerTag struct { + Header string `json:"header"` + TagName string `json:"tag_name"` +} + +func (hts *headerTags) toSlice() *[]string { + if hts == nil { + return nil + } + s := make([]string, len(*hts)) + for i, ht := range *hts { + s[i] = ht.toString() + } + return &s +} + +func (ht headerTag) toString() string { + var sb strings.Builder + sb.WriteString(ht.Header) + sb.WriteString(":") + sb.WriteString(ht.TagName) + return sb.String() +} + +// onRemoteConfigUpdate is a remote config callaback responsible for processing APM_TRACING RC-product updates. +func (t *tracer) onRemoteConfigUpdate(updates map[string]remoteconfig.ProductUpdate) map[string]state.ApplyStatus { + statuses := map[string]state.ApplyStatus{} + u, found := updates[state.ProductAPMTracing] + if !found { + return statuses + } + for path, raw := range u { + if raw == nil { + continue + } + log.Debug("Processing config from RC. Path: %s. Raw: %s", path, raw) + var c configData + if err := json.Unmarshal(raw, &c); err != nil { + log.Debug("Error while unmarshalling payload for %s: %v. Configuration won't be applied.", path, err) + statuses[path] = state.ApplyStatus{State: state.ApplyStateError, Error: err.Error()} + continue + } + statuses[path] = state.ApplyStatus{State: state.ApplyStateAcknowledged} + t.config.traceSampleRate.handleRC(c.LibConfig.SamplingRate) + t.config.headerAsTags.handleRC(c.LibConfig.HeaderTags.toSlice()) + } + return statuses +} diff --git a/ddtrace/tracer/remote_config_test.go b/ddtrace/tracer/remote_config_test.go new file mode 100644 index 0000000000..9bcbd1dc73 --- /dev/null +++ b/ddtrace/tracer/remote_config_test.go @@ -0,0 +1,140 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016 Datadog, Inc. + +package tracer + +import ( + "testing" + + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" + + "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" + "github.com/stretchr/testify/require" +) + +func TestOnRemoteConfigUpdate(t *testing.T) { + t.Run("RC sampling rate = 0.5 is applied and can be reverted", func(t *testing.T) { + tracer, _, _, stop := startTestTracer(t) + defer stop() + + // Apply RC. Assert _dd.rule_psr shows the RC sampling rate (0.2) is applied + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_sampling_rate": 0.5}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + s := tracer.StartSpan("web.request").(*span) + s.Finish() + require.Equal(t, 0.5, s.Metrics[keyRulesSamplerAppliedRate]) + + // Unset RC. Assert _dd.rule_psr is not set + input["APM_TRACING"] = remoteconfig.ProductUpdate{"path": []byte(`{"lib_config": {}}`)} + applyStatus = tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + s = tracer.StartSpan("web.request").(*span) + s.Finish() + require.NotContains(t, keyRulesSamplerAppliedRate, s.Metrics) + }) + + t.Run("DD_TRACE_SAMPLE_RATE=0.1 and RC sampling rate = 0.2", func(t *testing.T) { + t.Setenv("DD_TRACE_SAMPLE_RATE", "0.1") + tracer, _, _, stop := startTestTracer(t) + defer stop() + + // Apply RC. Assert _dd.rule_psr shows the RC sampling rate (0.2) is applied + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_sampling_rate": 0.2}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + s := tracer.StartSpan("web.request").(*span) + s.Finish() + require.Equal(t, 0.2, s.Metrics[keyRulesSamplerAppliedRate]) + + // Unset RC. Assert _dd.rule_psr shows the previous sampling rate (0.1) is applied + input["APM_TRACING"] = remoteconfig.ProductUpdate{"path": []byte(`{"lib_config": {}}`)} + applyStatus = tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + s = tracer.StartSpan("web.request").(*span) + s.Finish() + require.Equal(t, 0.1, s.Metrics[keyRulesSamplerAppliedRate]) + }) + + t.Run("RC header tags = X-Test-Header:my-tag-name is applied and can be reverted", func(t *testing.T) { + tracer, _, _, stop := startTestTracer(t) + defer stop() + + // Apply RC. Assert global config shows the RC header tag is applied + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_header_tags": [{"header": "X-Test-Header", "tag_name": "my-tag-name"}]}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 1, globalconfig.HeaderTagsLen()) + require.Equal(t, "my-tag-name", globalconfig.HeaderTag("X-Test-Header")) + + // Unset RC. Assert header tags are not set + input["APM_TRACING"] = remoteconfig.ProductUpdate{"path": []byte(`{"lib_config": {}}`)} + applyStatus = tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 0, globalconfig.HeaderTagsLen()) + }) + + t.Run("DD_TRACE_HEADER_TAGS=X-Test-Header:my-tag-name-from-env and RC header tags = X-Test-Header:my-tag-name-from-rc", func(t *testing.T) { + t.Setenv("DD_TRACE_HEADER_TAGS", "X-Test-Header:my-tag-name-from-env") + tracer, _, _, stop := startTestTracer(t) + defer stop() + + // Apply RC. Assert global config shows the RC header tag is applied + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_header_tags": [{"header": "X-Test-Header", "tag_name": "my-tag-name-from-rc"}]}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 1, globalconfig.HeaderTagsLen()) + require.Equal(t, "my-tag-name-from-rc", globalconfig.HeaderTag("X-Test-Header")) + + // Unset RC. Assert global config shows the DD_TRACE_HEADER_TAGS header tag + input["APM_TRACING"] = remoteconfig.ProductUpdate{"path": []byte(`{"lib_config": {}}`)} + applyStatus = tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 1, globalconfig.HeaderTagsLen()) + require.Equal(t, "my-tag-name-from-env", globalconfig.HeaderTag("X-Test-Header")) + }) + + t.Run("In code header tags = X-Test-Header:my-tag-name-in-code and RC header tags = X-Test-Header:my-tag-name-from-rc", func(t *testing.T) { + tracer, _, _, stop := startTestTracer(t, WithHeaderTags([]string{"X-Test-Header:my-tag-name-in-code"})) + defer stop() + + // Apply RC. Assert global config shows the RC header tag is applied + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_header_tags": [{"header": "X-Test-Header", "tag_name": "my-tag-name-from-rc"}]}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 1, globalconfig.HeaderTagsLen()) + require.Equal(t, "my-tag-name-from-rc", globalconfig.HeaderTag("X-Test-Header")) + + // Unset RC. Assert global config shows the in-code header tag + input["APM_TRACING"] = remoteconfig.ProductUpdate{"path": []byte(`{"lib_config": {}}`)} + applyStatus = tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateAcknowledged, applyStatus["path"].State) + require.Equal(t, 1, globalconfig.HeaderTagsLen()) + require.Equal(t, "my-tag-name-in-code", globalconfig.HeaderTag("X-Test-Header")) + }) + + t.Run("Invalid payload", func(t *testing.T) { + tracer, _, _, stop := startTestTracer(t) + defer stop() + + input := map[string]remoteconfig.ProductUpdate{ + "APM_TRACING": {"path": []byte(`{"lib_config": {"tracing_sampling_rate": "string value"}}`)}, + } + applyStatus := tracer.onRemoteConfigUpdate(input) + require.Equal(t, state.ApplyStateError, applyStatus["path"].State) + require.NotEmpty(t, applyStatus["path"].Error) + }) +} diff --git a/ddtrace/tracer/rules_sampler.go b/ddtrace/tracer/rules_sampler.go index cf5d200d96..9503a67612 100644 --- a/ddtrace/tracer/rules_sampler.go +++ b/ddtrace/tracer/rules_sampler.go @@ -16,9 +16,9 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" "golang.org/x/time/rate" ) @@ -37,9 +37,9 @@ type rulesSampler struct { // Rules are split between trace and single span sampling rules according to their type. // Such rules are user-defined through environment variable or WithSamplingRules option. // Invalid rules or environment variable values are tolerated, by logging warnings and then ignoring them. -func newRulesSampler(traceRules, spanRules []SamplingRule) *rulesSampler { +func newRulesSampler(traceRules, spanRules []SamplingRule, traceSampleRate float64) *rulesSampler { return &rulesSampler{ - traces: newTraceRulesSampler(traceRules), + traces: newTraceRulesSampler(traceRules, traceSampleRate), spans: newSingleSpanRulesSampler(spanRules), } } @@ -199,6 +199,7 @@ func SpanNameServiceMPSRule(name, service string, rate, limit float64) SamplingR // Its value is the number of spans to sample per second. // Spans that matched the rules but exceeded the rate limit are not sampled. type traceRulesSampler struct { + m sync.RWMutex rules []SamplingRule // the rules to match spans with globalRate float64 // a rate to apply when no rules match a span limiter *rateLimiter // used to limit the volume of spans sampled @@ -206,10 +207,10 @@ type traceRulesSampler struct { // newTraceRulesSampler configures a *traceRulesSampler instance using the given set of rules. // Invalid rules or environment variable values are tolerated, by logging warnings and then ignoring them. -func newTraceRulesSampler(rules []SamplingRule) *traceRulesSampler { +func newTraceRulesSampler(rules []SamplingRule, traceSampleRate float64) *traceRulesSampler { return &traceRulesSampler{ rules: rules, - globalRate: globalSampleRate(), + globalRate: traceSampleRate, limiter: newRateLimiter(), } } @@ -235,9 +236,17 @@ func globalSampleRate() float64 { } func (rs *traceRulesSampler) enabled() bool { + rs.m.RLock() + defer rs.m.RUnlock() return len(rs.rules) > 0 || !math.IsNaN(rs.globalRate) } +func (rs *traceRulesSampler) setGlobalSampleRate(rate float64) { + rs.m.Lock() + defer rs.m.Unlock() + rs.globalRate = rate +} + // apply uses the sampling rules to determine the sampling rate for the // provided span. If the rules don't match, and a default rate hasn't been // set using DD_TRACE_SAMPLE_RATE, then it returns false and the span is not @@ -249,7 +258,9 @@ func (rs *traceRulesSampler) apply(span *span) bool { } var matched bool + rs.m.RLock() rate := rs.globalRate + rs.m.RUnlock() for _, rule := range rs.rules { if rule.match(span) { matched = true diff --git a/ddtrace/tracer/sampler.go b/ddtrace/tracer/sampler.go index 2c95caf26f..5a989ac03e 100644 --- a/ddtrace/tracer/sampler.go +++ b/ddtrace/tracer/sampler.go @@ -11,9 +11,9 @@ import ( "math" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) // Sampler is the generic interface of any sampler. It must be safe for concurrent use. diff --git a/ddtrace/tracer/sampler_test.go b/ddtrace/tracer/sampler_test.go index 2a952987c2..8dd15adca8 100644 --- a/ddtrace/tracer/sampler_test.go +++ b/ddtrace/tracer/sampler_test.go @@ -16,8 +16,8 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" "github.com/stretchr/testify/assert" "golang.org/x/time/rate" @@ -392,7 +392,7 @@ func TestRulesSampler(t *testing.T) { } t.Run("no-rules", func(t *testing.T) { assert := assert.New(t) - rs := newRulesSampler(nil, nil) + rs := newRulesSampler(nil, nil, globalSampleRate()) span := makeSpan("http.request", "test-service") result := rs.SampleTrace(span) @@ -410,7 +410,7 @@ func TestRulesSampler(t *testing.T) { for _, v := range traceRules { t.Run("", func(t *testing.T) { assert := assert.New(t) - rs := newRulesSampler(v, nil) + rs := newRulesSampler(v, nil, globalSampleRate()) span := makeSpan("http.request", "test-service") result := rs.SampleTrace(span) @@ -433,7 +433,7 @@ func TestRulesSampler(t *testing.T) { for _, v := range traceRules { t.Run("", func(t *testing.T) { assert := assert.New(t) - rs := newRulesSampler(v, nil) + rs := newRulesSampler(v, nil, globalSampleRate()) span := makeSpan("http.request", "test-service") result := rs.SampleTrace(span) @@ -470,7 +470,7 @@ func TestRulesSampler(t *testing.T) { _, rules, _ := samplingRulesFromEnv() assert := assert.New(t) - rs := newRulesSampler(nil, rules) + rs := newRulesSampler(nil, rules, globalSampleRate()) span := makeFinishedSpan(tt.spanName, tt.spanSrv) result := rs.SampleSpan(span) @@ -510,7 +510,7 @@ func TestRulesSampler(t *testing.T) { _, rules, _ := samplingRulesFromEnv() assert := assert.New(t) - rs := newRulesSampler(nil, rules) + rs := newRulesSampler(nil, rules, globalSampleRate()) span := makeFinishedSpan(tt.spanName, tt.spanSrv) result := rs.SampleSpan(span) @@ -551,7 +551,7 @@ func TestRulesSampler(t *testing.T) { _, rules, _ := samplingRulesFromEnv() assert := assert.New(t) - rs := newRulesSampler(nil, rules) + rs := newRulesSampler(nil, rules, globalSampleRate()) span := makeFinishedSpan(tt.spanName, tt.spanSrv) result := rs.SampleSpan(span) @@ -594,7 +594,7 @@ func TestRulesSampler(t *testing.T) { assert := assert.New(t) c, err := newConfig(WithSamplingRules(tt.rules)) assert.NoError(err) - rs := newRulesSampler(nil, c.spanRules) + rs := newRulesSampler(nil, c.spanRules, globalSampleRate()) span := makeFinishedSpan(tt.spanName, tt.spanSrv) result := rs.SampleSpan(span) @@ -622,7 +622,7 @@ func TestRulesSampler(t *testing.T) { assert := assert.New(t) os.Setenv("DD_TRACE_SAMPLE_RATE", fmt.Sprint(rate)) defer os.Unsetenv("DD_TRACE_SAMPLE_RATE") - rs := newRulesSampler(nil, rules) + rs := newRulesSampler(nil, rules, globalSampleRate()) span := makeSpan("http.request", "test-service") result := rs.SampleTrace(span) @@ -680,7 +680,7 @@ func TestRulesSamplerInternals(t *testing.T) { t.Run("full-rate", func(t *testing.T) { assert := assert.New(t) now := time.Now() - rs := newRulesSampler(nil, nil) + rs := newRulesSampler(nil, nil, globalSampleRate()) // set samplingLimiter to specific state rs.traces.limiter.prevTime = now.Add(-1 * time.Second) rs.traces.limiter.allowed = 1 @@ -695,7 +695,7 @@ func TestRulesSamplerInternals(t *testing.T) { t.Run("limited-rate", func(t *testing.T) { assert := assert.New(t) now := time.Now() - rs := newRulesSampler(nil, nil) + rs := newRulesSampler(nil, nil, globalSampleRate()) // force sampling limiter to 1.0 spans/sec rs.traces.limiter.limiter = rate.NewLimiter(rate.Limit(1.0), 1) rs.traces.limiter.prevTime = now.Add(-1 * time.Second) diff --git a/ddtrace/tracer/span.go b/ddtrace/tracer/span.go index c4a0530409..d6e66dfeb2 100644 --- a/ddtrace/tracer/span.go +++ b/ddtrace/tracer/span.go @@ -23,14 +23,14 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - sharedinternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + sharedinternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" "github.com/DataDog/datadog-agent/pkg/obfuscate" "github.com/tinylib/msgp/msgp" diff --git a/ddtrace/tracer/span_test.go b/ddtrace/tracer/span_test.go index d24b1afd82..fbf8d8b3ca 100644 --- a/ddtrace/tracer/span_test.go +++ b/ddtrace/tracer/span_test.go @@ -15,11 +15,11 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" "github.com/DataDog/datadog-agent/pkg/obfuscate" "github.com/stretchr/testify/assert" diff --git a/ddtrace/tracer/spancontext.go b/ddtrace/tracer/spancontext.go index 0f71e3f225..db00c9e424 100644 --- a/ddtrace/tracer/spancontext.go +++ b/ddtrace/tracer/spancontext.go @@ -15,14 +15,14 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - ginternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - sharedinternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + ginternal "github.com/DataDog/dd-trace-go/v2/internal" + sharedinternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) var _ ddtrace.SpanContext = (*spanContext)(nil) diff --git a/ddtrace/tracer/spancontext_test.go b/ddtrace/tracer/spancontext_test.go index 568e6fff70..ecf2cf6ba0 100644 --- a/ddtrace/tracer/spancontext_test.go +++ b/ddtrace/tracer/spancontext_test.go @@ -12,12 +12,12 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/ddtrace/tracer/sqlcomment.go b/ddtrace/tracer/sqlcomment.go index b220d5c6fa..30b26dcbb5 100644 --- a/ddtrace/tracer/sqlcomment.go +++ b/ddtrace/tracer/sqlcomment.go @@ -9,11 +9,11 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) // SQLCommentInjectionMode represents the mode of SQL comment injection. diff --git a/ddtrace/tracer/sqlcomment_test.go b/ddtrace/tracer/sqlcomment_test.go index 85e368f5f8..4ee173a197 100644 --- a/ddtrace/tracer/sqlcomment_test.go +++ b/ddtrace/tracer/sqlcomment_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/ddtrace/tracer/stats.go b/ddtrace/tracer/stats.go index 720a2a0230..36abb963e9 100644 --- a/ddtrace/tracer/stats.go +++ b/ddtrace/tracer/stats.go @@ -12,8 +12,8 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/datadog-go/v5/statsd" "github.com/DataDog/sketches-go/ddsketch" diff --git a/ddtrace/tracer/telemetry.go b/ddtrace/tracer/telemetry.go index 927cff9fff..51a178a313 100644 --- a/ddtrace/tracer/telemetry.go +++ b/ddtrace/tracer/telemetry.go @@ -9,7 +9,7 @@ import ( "fmt" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) // startTelemetry starts the global instrumentation telemetry client with tracer data diff --git a/ddtrace/tracer/telemetry_test.go b/ddtrace/tracer/telemetry_test.go index bf255abadc..9e816f19aa 100644 --- a/ddtrace/tracer/telemetry_test.go +++ b/ddtrace/tracer/telemetry_test.go @@ -8,10 +8,10 @@ package tracer import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" - "gopkg.in/DataDog/dd-trace-go.v1/profiler" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/profiler" "github.com/stretchr/testify/assert" ) diff --git a/ddtrace/tracer/textmap.go b/ddtrace/tracer/textmap.go index bff595e154..0c33eaf456 100644 --- a/ddtrace/tracer/textmap.go +++ b/ddtrace/tracer/textmap.go @@ -13,10 +13,10 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) // HTTPHeadersCarrier wraps an http.Header as a TextMapWriter and TextMapReader, allowing diff --git a/ddtrace/tracer/textmap_test.go b/ddtrace/tracer/textmap_test.go index 1575644375..d694b5fe28 100644 --- a/ddtrace/tracer/textmap_test.go +++ b/ddtrace/tracer/textmap_test.go @@ -16,12 +16,12 @@ import ( "sync" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/httpmem" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/internal/httpmem" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/DataDog/datadog-go/v5/statsd" "github.com/stretchr/testify/assert" diff --git a/ddtrace/tracer/time_windows.go b/ddtrace/tracer/time_windows.go index e8b0076f1b..a4993c9686 100644 --- a/ddtrace/tracer/time_windows.go +++ b/ddtrace/tracer/time_windows.go @@ -10,7 +10,7 @@ import ( "golang.org/x/sys/windows" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // This method is more precise than the go1.8 time.Now on Windows diff --git a/ddtrace/tracer/tracer.go b/ddtrace/tracer/tracer.go index 0be96bc46a..fa3c47230d 100644 --- a/ddtrace/tracer/tracer.go +++ b/ddtrace/tracer/tracer.go @@ -7,6 +7,7 @@ package tracer import ( gocontext "context" + "encoding/binary" "fmt" "os" "runtime/pprof" @@ -16,18 +17,18 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - globalinternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + globalinternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/datastreams" + "github.com/DataDog/dd-trace-go/v2/internal/hostname" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" "github.com/DataDog/datadog-agent/pkg/obfuscate" ) @@ -249,6 +250,9 @@ func newUnstartedTracer(opts ...StartOption) (*tracer, error) { if spans != nil { c.spanRules = spans } + globalRate := globalSampleRate() + rulesSampler := newRulesSampler(c.traceRules, c.spanRules, globalRate) + c.traceSampleRate = newDynamicConfig(globalRate, rulesSampler.traces.setGlobalSampleRate) var dataStreamsProcessor *datastreams.Processor if c.dataStreamsMonitoringEnabled { dataStreamsProcessor = datastreams.NewProcessor(statsd, c.env, c.serviceName, c.version, c.agentURL, c.httpClient, func() bool { @@ -262,7 +266,7 @@ func newUnstartedTracer(opts ...StartOption) (*tracer, error) { out: make(chan *chunk, payloadQueueSize), stop: make(chan struct{}), flush: make(chan chan<- struct{}), - rulesSampling: newRulesSampler(c.traceRules, c.spanRules), + rulesSampling: rulesSampler, prioritySampling: sampler, pid: os.Getpid(), stats: newConcentrator(c, defaultStatsBucketSize), @@ -715,7 +719,12 @@ func startExecutionTracerTask(ctx gocontext.Context, span *span) (gocontext.Cont // skipped. ctx = globalinternal.WithExecutionNotTraced(ctx) } - rt.Log(ctx, "span id", strconv.FormatUint(span.SpanID, 10)) + var b [8]byte + binary.LittleEndian.PutUint64(b[:], span.SpanID) + // TODO: can we make string(b[:]) not allocate? e.g. with unsafe + // shenanigans? rt.Log won't retain the message string, though perhaps + // we can't assume that will always be the case. + rt.Log(ctx, "datadog.uint64_span_id", string(b[:])) return ctx, end } diff --git a/ddtrace/tracer/tracer_test.go b/ddtrace/tracer/tracer_test.go index d6186c043e..16636507ea 100644 --- a/ddtrace/tracer/tracer_test.go +++ b/ddtrace/tracer/tracer_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - maininternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + maininternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -1888,10 +1888,26 @@ func TestGitMetadata(t *testing.T) { assert.Equal("somepath", sp.Meta[maininternal.TraceTagGoPath]) }) + t.Run("git-metadata-from-dd-tags-with-credentials", func(t *testing.T) { + t.Setenv(maininternal.EnvDDTags, "git.commit.sha:123456789ABCD git.repository_url:https://user:passwd@github.com/user/repo go_path:somepath") + + tracer, _, _, stop := startTestTracer(t) + defer stop() + defer maininternal.ResetGitMetadataTags() + + assert := assert.New(t) + sp := tracer.StartSpan("http.request").(*span) + sp.context.finish() + + assert.Equal("123456789ABCD", sp.Meta[maininternal.TraceTagCommitSha]) + assert.Equal("https://github.com/user/repo", sp.Meta[maininternal.TraceTagRepositoryURL]) + assert.Equal("somepath", sp.Meta[maininternal.TraceTagGoPath]) + }) + t.Run("git-metadata-from-env", func(t *testing.T) { t.Setenv(maininternal.EnvDDTags, "git.commit.sha:123456789ABCD git.repository_url:github.com/user/repo") - // git metadata env has priority under DD_TAGS + // git metadata env has priority over DD_TAGS t.Setenv(maininternal.EnvGitRepositoryURL, "github.com/user/repo_new") t.Setenv(maininternal.EnvGitCommitSha, "123456789ABCDE") @@ -1908,6 +1924,22 @@ func TestGitMetadata(t *testing.T) { assert.Equal("github.com/user/repo_new", sp.Meta[maininternal.TraceTagRepositoryURL]) }) + t.Run("git-metadata-from-env-with-credentials", func(t *testing.T) { + t.Setenv(maininternal.EnvGitRepositoryURL, "https://u:t@github.com/user/repo_new") + t.Setenv(maininternal.EnvGitCommitSha, "123456789ABCDE") + + tracer, _, _, stop := startTestTracer(t) + defer stop() + defer maininternal.ResetGitMetadataTags() + + assert := assert.New(t) + sp := tracer.StartSpan("http.request").(*span) + sp.context.finish() + + assert.Equal("123456789ABCDE", sp.Meta[maininternal.TraceTagCommitSha]) + assert.Equal("https://github.com/user/repo_new", sp.Meta[maininternal.TraceTagRepositoryURL]) + }) + t.Run("git-metadata-from-env-and-tags", func(t *testing.T) { t.Setenv(maininternal.EnvDDTags, "git.commit.sha:123456789ABCD") t.Setenv(maininternal.EnvGitRepositoryURL, "github.com/user/repo") diff --git a/ddtrace/tracer/transport.go b/ddtrace/tracer/transport.go index 7a6e80a56a..c748d82494 100644 --- a/ddtrace/tracer/transport.go +++ b/ddtrace/tracer/transport.go @@ -19,9 +19,9 @@ import ( "sync/atomic" "time" - traceinternal "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + traceinternal "github.com/DataDog/dd-trace-go/v2/ddtrace/internal" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/tinylib/msgp/msgp" ) diff --git a/ddtrace/tracer/util.go b/ddtrace/tracer/util.go index 67ee16149f..62cd5bc7ae 100644 --- a/ddtrace/tracer/util.go +++ b/ddtrace/tracer/util.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) // toFloat64 attempts to convert value into a float64. If the value is an integer diff --git a/ddtrace/tracer/writer.go b/ddtrace/tracer/writer.go index a4665bddb5..82dedefcac 100644 --- a/ddtrace/tracer/writer.go +++ b/ddtrace/tracer/writer.go @@ -16,8 +16,8 @@ import ( "sync" "time" - globalinternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + globalinternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) type traceWriter interface { diff --git a/ddtrace/tracer/writer_test.go b/ddtrace/tracer/writer_test.go index 1590ca992c..7c9341e9d2 100644 --- a/ddtrace/tracer/writer_test.go +++ b/ddtrace/tracer/writer_test.go @@ -15,7 +15,7 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/go.mod b/go.mod index f8b0f3836f..ab45490ef8 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gopkg.in/DataDog/dd-trace-go.v1 +module github.com/DataDog/dd-trace-go/v2 go 1.19 @@ -6,8 +6,8 @@ require ( cloud.google.com/go/pubsub v1.33.0 github.com/99designs/gqlgen v0.17.36 github.com/DataDog/appsec-internal-go v1.0.0 - github.com/DataDog/datadog-agent/pkg/obfuscate v0.46.0 - github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.0-devel.0.20230725154044-2549ba9058df + github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 + github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 github.com/DataDog/datadog-go/v5 v5.3.0 github.com/DataDog/go-libddwaf v1.5.0 github.com/DataDog/gostackparse v0.7.0 @@ -91,7 +91,7 @@ require ( golang.org/x/time v0.3.0 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 google.golang.org/api v0.128.0 - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.57.1 google.golang.org/protobuf v1.30.0 gopkg.in/jinzhu/gorm.v1 v1.9.2 gopkg.in/olivere/elastic.v3 v3.0.75 diff --git a/go.sum b/go.sum index abc7a42bf3..467d98ce9a 100644 --- a/go.sum +++ b/go.sum @@ -626,10 +626,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/appsec-internal-go v1.0.0 h1:2u5IkF4DBj3KVeQn5Vg2vjPUtt513zxEYglcqnd500U= github.com/DataDog/appsec-internal-go v1.0.0/go.mod h1:+Y+4klVWKPOnZx6XESG7QHydOaUGEXyH2j/vSg9JiNM= -github.com/DataDog/datadog-agent/pkg/obfuscate v0.46.0 h1:rUNnUcHC4AlxoImuXmZeOfi6H80BDBHzeagWXWCVhnA= -github.com/DataDog/datadog-agent/pkg/obfuscate v0.46.0/go.mod h1:e933RWa4kAWuHi5jpzEuOiULlv21HcCFEVIYegmaB5c= -github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.0-devel.0.20230725154044-2549ba9058df h1:PbzrhHhs2+RRdKKti7JBSM8ATIeiji2T2cVt/d8GT8k= -github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.0-devel.0.20230725154044-2549ba9058df/go.mod h1:5Q39ZOIOwZMnFyRadp+5gH1bFdjmb+Pgxe+j5XOwaTg= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 h1:bUMSNsw1iofWiju9yc1f+kBd33E3hMJtq9GuU602Iy8= +github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0/go.mod h1:HzySONXnAgSmIQfL6gOv9hWprKJkx8CicuXuUbmgWfo= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 h1:5nE6N3JSs2IG3xzMthNFhXfOaXlrsdgqmJ73lndFf8c= +github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1/go.mod h1:Vc+snp0Bey4MrrJyiV2tVxxJb6BmLomPvN1RgAvjGaQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go/v5 v5.1.1/go.mod h1:KhiYb2Badlv9/rofz+OznKoEF5XKTonWyhx5K83AP8E= github.com/DataDog/datadog-go/v5 v5.3.0 h1:2q2qjFOb3RwAZNU+ez27ZVDwErJv5/VpbBPprz7Z+s8= @@ -703,8 +703,8 @@ github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= -github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= +github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= @@ -1572,8 +1572,8 @@ github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.1 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g= +github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -1639,8 +1639,8 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -2109,21 +2109,21 @@ go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUz go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0/go.mod h1:vEhqr0m4eTc+DWxfsXoXue2GBgV2uUwVznkGIHW/e5w= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1:XiYsayHc36K3EByOO6nbAXnAWbrUxdjUROCEeeROOH8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= go.opentelemetry.io/otel v1.6.3/go.mod h1:7BgNga5fNlF/iZjG06hM3yofffp0ofKCDwSXx1GC4dI= -go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= -go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel v1.18.0 h1:TgVozPGZ01nHyDZxK5WGPFB9QexeTMXEH7+tIClWfzs= +go.opentelemetry.io/otel v1.18.0/go.mod h1:9lWqYO0Db579XzVuCKFNPDl4s73Voa+zEck3wHaAYQI= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1:QNX1aly8ehqqX1LEa6YniTU7VY9I6R3X/oPxhGdTceE= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= -go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= -go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/metric v1.18.0 h1:JwVzw94UYmbx3ej++CwLUQZxEODDj/pOuTCvzhtRrSQ= +go.opentelemetry.io/otel/metric v1.18.0/go.mod h1:nNSpsVDjWGfb7chbRLUNW+PBNdcSTHD4Uu5pfFMOI0k= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= @@ -2132,8 +2132,8 @@ go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4 go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk= go.opentelemetry.io/otel/trace v1.6.3/go.mod h1:GNJQusJlUgZl9/TQBPKU/Y/ty+0iVB5fjhKeJGZPGFs= -go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= -go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= +go.opentelemetry.io/otel/trace v1.18.0 h1:NY+czwbHbmndxojTEKiSMHkG2ClNH2PwmcHrdo0JY10= +go.opentelemetry.io/otel/trace v1.18.0/go.mod h1:T2+SGJGuYZY3bjj5rgh/hN7KIrlpWC5nS8Mjvzckz+0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -2930,8 +2930,8 @@ google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= +google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/internal/agent.go b/internal/agent.go index c8f835166c..4e25b7c45b 100644 --- a/internal/agent.go +++ b/internal/agent.go @@ -9,7 +9,7 @@ import ( "net/url" "os" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // AgentURLFromEnv determines the trace agent URL from environment variable diff --git a/internal/apps/unit-of-work/go.mod b/internal/apps/unit-of-work/go.mod index bc9e018951..4a0aa2caea 100644 --- a/internal/apps/unit-of-work/go.mod +++ b/internal/apps/unit-of-work/go.mod @@ -3,8 +3,8 @@ module github.com/DataDog/dd-trace-go/internal/apps/unit-of-work go 1.19 require ( + github.com/DataDog/dd-trace-go/v2 v2.0.0-20231026141357-d9d8b0ef3849 golang.org/x/sync v0.3.0 - gopkg.in/DataDog/dd-trace-go.v1 v1.49.0 ) require ( @@ -51,4 +51,4 @@ require ( ) // use local version of dd-trace-go -replace gopkg.in/DataDog/dd-trace-go.v1 => ../../.. +replace github.com/DataDog/dd-trace-go/v2 => ../../.. diff --git a/internal/apps/unit-of-work/go.sum b/internal/apps/unit-of-work/go.sum index 97aa3ece62..7c20fa4a85 100644 --- a/internal/apps/unit-of-work/go.sum +++ b/internal/apps/unit-of-work/go.sum @@ -150,7 +150,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/internal/apps/unit-of-work/main.go b/internal/apps/unit-of-work/main.go index 09f4a5b68b..b7a5dd06a3 100644 --- a/internal/apps/unit-of-work/main.go +++ b/internal/apps/unit-of-work/main.go @@ -17,9 +17,9 @@ import ( "os/signal" "time" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/profiler" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/profiler" ) var dummyData struct { diff --git a/internal/appsec/_testlib/mockspan.go b/internal/appsec/_testlib/mockspan.go index e9b46142b7..faa9c8ea7d 100644 --- a/internal/appsec/_testlib/mockspan.go +++ b/internal/appsec/_testlib/mockspan.go @@ -6,9 +6,9 @@ package testlib import ( - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) type MockSpan struct { diff --git a/internal/appsec/appsec.go b/internal/appsec/appsec.go index 98be47e8df..3f63e15e48 100644 --- a/internal/appsec/appsec.go +++ b/internal/appsec/appsec.go @@ -12,11 +12,10 @@ import ( "fmt" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/log" - "github.com/DataDog/go-libddwaf" + waf "github.com/DataDog/go-libddwaf" ) // Enabled returns true when AppSec is up and running. Meaning that the appsec build tag is enabled, the env var @@ -66,7 +65,9 @@ func Start(opts ...StartOption) { // Start the remote configuration client log.Debug("appsec: starting the remote configuration client") - appsec.startRC() + if err := appsec.startRC(); err != nil { + log.Error("appsec: Remote config: disabled due to an instanciation error: %v", err) + } if !set { // AppSec is not enforced by the env var and can be enabled through remote config @@ -114,23 +115,13 @@ func setActiveAppSec(a *appsec) { type appsec struct { cfg *Config limiter *TokenTicker - rc *remoteconfig.Client wafHandle *wafHandle started bool } func newAppSec(cfg *Config) *appsec { - var client *remoteconfig.Client - var err error - if cfg.rc != nil { - client, err = remoteconfig.NewClient(*cfg.rc) - } - if err != nil { - log.Error("appsec: Remote config: disabled due to a client creation error: %v", err) - } return &appsec{ cfg: cfg, - rc: client, } } diff --git a/internal/appsec/appsec_disabled.go b/internal/appsec/appsec_disabled.go index 09f262175f..2ee0ae4b70 100644 --- a/internal/appsec/appsec_disabled.go +++ b/internal/appsec/appsec_disabled.go @@ -8,7 +8,7 @@ package appsec -import "gopkg.in/DataDog/dd-trace-go.v1/internal/log" +import "github.com/DataDog/dd-trace-go/v2/internal/log" // Enabled returns true when AppSec is up and running. Meaning that the appsec build tag is enabled, the env var // DD_APPSEC_ENABLED is set to true, and the tracer is started. diff --git a/internal/appsec/appsec_disabled_test.go b/internal/appsec/appsec_disabled_test.go index 6058ca8c70..1428d859a8 100644 --- a/internal/appsec/appsec_disabled_test.go +++ b/internal/appsec/appsec_disabled_test.go @@ -12,8 +12,8 @@ import ( "os" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/appsec/appsec_test.go b/internal/appsec/appsec_test.go index 3da30b125d..fbfa556631 100644 --- a/internal/appsec/appsec_test.go +++ b/internal/appsec/appsec_test.go @@ -13,8 +13,8 @@ import ( "strconv" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" waf "github.com/DataDog/go-libddwaf" "github.com/stretchr/testify/assert" diff --git a/internal/appsec/config.go b/internal/appsec/config.go index 1aaf419c9b..555b5eb9ea 100644 --- a/internal/appsec/config.go +++ b/internal/appsec/config.go @@ -14,8 +14,8 @@ import ( "unicode" "unicode/utf8" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" ) const ( diff --git a/internal/appsec/dyngo/instrumentation/common.go b/internal/appsec/dyngo/instrumentation/common.go index 6784deff57..1b11d29198 100644 --- a/internal/appsec/dyngo/instrumentation/common.go +++ b/internal/appsec/dyngo/instrumentation/common.go @@ -11,8 +11,8 @@ import ( "fmt" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" ) // BlockedRequestTag used to convey whether a request is blocked diff --git a/internal/appsec/dyngo/instrumentation/grpcsec/grpc.go b/internal/appsec/dyngo/instrumentation/grpcsec/grpc.go index f95e9418ec..84ccd9d511 100644 --- a/internal/appsec/dyngo/instrumentation/grpcsec/grpc.go +++ b/internal/appsec/dyngo/instrumentation/grpcsec/grpc.go @@ -14,8 +14,8 @@ import ( "encoding/json" "reflect" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" "github.com/DataDog/appsec-internal-go/netip" ) diff --git a/internal/appsec/dyngo/instrumentation/grpcsec/grpc_test.go b/internal/appsec/dyngo/instrumentation/grpcsec/grpc_test.go index 099b556bac..62122834b6 100644 --- a/internal/appsec/dyngo/instrumentation/grpcsec/grpc_test.go +++ b/internal/appsec/dyngo/instrumentation/grpcsec/grpc_test.go @@ -11,8 +11,8 @@ import ( "fmt" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/grpcsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/grpcsec" "github.com/stretchr/testify/require" ) diff --git a/internal/appsec/dyngo/instrumentation/grpcsec/tags.go b/internal/appsec/dyngo/instrumentation/grpcsec/tags.go index f014610608..7eeedaaa94 100644 --- a/internal/appsec/dyngo/instrumentation/grpcsec/tags.go +++ b/internal/appsec/dyngo/instrumentation/grpcsec/tags.go @@ -8,10 +8,10 @@ package grpcsec import ( "encoding/json" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // SetSecurityEventsTags sets the AppSec events span tags. diff --git a/internal/appsec/dyngo/instrumentation/grpcsec/tags_test.go b/internal/appsec/dyngo/instrumentation/grpcsec/tags_test.go index 9dda447e4c..b7280d464a 100644 --- a/internal/appsec/dyngo/instrumentation/grpcsec/tags_test.go +++ b/internal/appsec/dyngo/instrumentation/grpcsec/tags_test.go @@ -11,8 +11,8 @@ import ( "net" "testing" - testlib "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/_testlib" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" + testlib "github.com/DataDog/dd-trace-go/v2/internal/appsec/_testlib" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" "github.com/DataDog/appsec-internal-go/netip" "github.com/stretchr/testify/require" diff --git a/internal/appsec/dyngo/instrumentation/httpsec/http.go b/internal/appsec/dyngo/instrumentation/httpsec/http.go index bcb4fb4442..ba96f6b577 100644 --- a/internal/appsec/dyngo/instrumentation/httpsec/http.go +++ b/internal/appsec/dyngo/instrumentation/httpsec/http.go @@ -20,11 +20,11 @@ import ( "strings" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/sharedsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/sharedsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/appsec-internal-go/netip" ) diff --git a/internal/appsec/dyngo/instrumentation/httpsec/tags.go b/internal/appsec/dyngo/instrumentation/httpsec/tags.go index 1fa0349ebb..bc8445a0b7 100644 --- a/internal/appsec/dyngo/instrumentation/httpsec/tags.go +++ b/internal/appsec/dyngo/instrumentation/httpsec/tags.go @@ -11,8 +11,8 @@ import ( "sort" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/log" "github.com/DataDog/appsec-internal-go/httpsec" "github.com/DataDog/appsec-internal-go/netip" diff --git a/internal/appsec/dyngo/instrumentation/httpsec/tags_test.go b/internal/appsec/dyngo/instrumentation/httpsec/tags_test.go index 30b90e697d..7357746011 100644 --- a/internal/appsec/dyngo/instrumentation/httpsec/tags_test.go +++ b/internal/appsec/dyngo/instrumentation/httpsec/tags_test.go @@ -10,7 +10,7 @@ import ( "fmt" "testing" - testlib "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/_testlib" + testlib "github.com/DataDog/dd-trace-go/v2/internal/appsec/_testlib" "github.com/stretchr/testify/require" ) diff --git a/internal/appsec/dyngo/instrumentation/sharedsec/actions.go b/internal/appsec/dyngo/instrumentation/sharedsec/actions.go index 09d84828ea..19639823e3 100644 --- a/internal/appsec/dyngo/instrumentation/sharedsec/actions.go +++ b/internal/appsec/dyngo/instrumentation/sharedsec/actions.go @@ -12,7 +12,7 @@ import ( "os" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // blockedTemplateJSON is the default JSON template used to write responses for blocked requests diff --git a/internal/appsec/dyngo/instrumentation/sharedsec/shared.go b/internal/appsec/dyngo/instrumentation/sharedsec/shared.go index 0a0966a130..0fd8cdf247 100644 --- a/internal/appsec/dyngo/instrumentation/sharedsec/shared.go +++ b/internal/appsec/dyngo/instrumentation/sharedsec/shared.go @@ -9,9 +9,9 @@ import ( "context" "reflect" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) type ( diff --git a/internal/appsec/dyngo/operation.go b/internal/appsec/dyngo/operation.go index d45492d22f..6a5cf9f843 100644 --- a/internal/appsec/dyngo/operation.go +++ b/internal/appsec/dyngo/operation.go @@ -24,7 +24,7 @@ import ( "reflect" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" "go.uber.org/atomic" ) diff --git a/internal/appsec/dyngo/operation_test.go b/internal/appsec/dyngo/operation_test.go index f9dcfca7dc..a42b5b2ff3 100644 --- a/internal/appsec/dyngo/operation_test.go +++ b/internal/appsec/dyngo/operation_test.go @@ -17,7 +17,7 @@ import ( "sync/atomic" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/appsec/remoteconfig.go b/internal/appsec/remoteconfig.go index 23a116299f..cc7bc9ed5b 100644 --- a/internal/appsec/remoteconfig.go +++ b/internal/appsec/remoteconfig.go @@ -14,8 +14,8 @@ import ( "fmt" "os" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" rc "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" ) @@ -287,95 +287,109 @@ func mergeRulesDataEntries(entries1, entries2 []rc.ASMDataRuleDataEntry) []rc.AS return entries } -func (a *appsec) startRC() { - if a.rc != nil { - a.rc.Start() +func (a *appsec) startRC() error { + if a.cfg.rc != nil { + return remoteconfig.Start(*a.cfg.rc) } + return nil } func (a *appsec) stopRC() { - if a.rc != nil { - a.rc.Stop() + if a.cfg.rc != nil { + remoteconfig.Stop() } } func (a *appsec) registerRCProduct(p string) error { - if a.rc == nil { + if a.cfg.rc == nil { return fmt.Errorf("no valid remote configuration client") } - a.cfg.rc.Products[p] = struct{}{} - a.rc.RegisterProduct(p) - return nil -} - -func (a *appsec) unregisterRCProduct(p string) error { - if a.rc == nil { - return fmt.Errorf("no valid remote configuration client") - } - delete(a.cfg.rc.Products, p) - a.rc.UnregisterProduct(p) - return nil + return remoteconfig.RegisterProduct(p) } func (a *appsec) registerRCCapability(c remoteconfig.Capability) error { - a.cfg.rc.Capabilities[c] = struct{}{} - if a.rc == nil { + if a.cfg.rc == nil { return fmt.Errorf("no valid remote configuration client") } - a.rc.RegisterCapability(c) - return nil + return remoteconfig.RegisterCapability(c) } -func (a *appsec) unregisterRCCapability(c remoteconfig.Capability) { - if a.rc == nil { +func (a *appsec) unregisterRCCapability(c remoteconfig.Capability) error { + if a.cfg.rc == nil { log.Debug("appsec: Remote config: no valid remote configuration client") - return + return nil } - delete(a.cfg.rc.Capabilities, c) - a.rc.UnregisterCapability(c) + return remoteconfig.UnregisterCapability(c) } func (a *appsec) enableRemoteActivation() error { - if a.rc == nil { + if a.cfg.rc == nil { return fmt.Errorf("no valid remote configuration client") } - a.registerRCProduct(rc.ProductASMFeatures) - a.registerRCCapability(remoteconfig.ASMActivation) - a.rc.RegisterCallback(a.onRemoteActivation) - return nil + err := a.registerRCProduct(rc.ProductASMFeatures) + if err != nil { + return err + } + err = a.registerRCCapability(remoteconfig.ASMActivation) + if err != nil { + return err + } + return remoteconfig.RegisterCallback(a.onRemoteActivation) } func (a *appsec) enableRCBlocking() { - if a.rc == nil { + if a.cfg.rc == nil { log.Debug("appsec: Remote config: no valid remote configuration client") return } - a.registerRCProduct(rc.ProductASM) - a.registerRCProduct(rc.ProductASMDD) - a.registerRCProduct(rc.ProductASMData) - a.rc.RegisterCallback(a.onRCRulesUpdate) + products := []string{rc.ProductASM, rc.ProductASMDD, rc.ProductASMData} + for _, p := range products { + if err := a.registerRCProduct(p); err != nil { + log.Debug("appsec: Remote config: couldn't register product %s: %v", p, err) + } + } + + if err := remoteconfig.RegisterCallback(a.onRCRulesUpdate); err != nil { + log.Debug("appsec: Remote config: couldn't register callback: %v", err) + } if _, isSet := os.LookupEnv(rulesEnvVar); !isSet { - a.registerRCCapability(remoteconfig.ASMUserBlocking) - a.registerRCCapability(remoteconfig.ASMRequestBlocking) - a.registerRCCapability(remoteconfig.ASMIPBlocking) - a.registerRCCapability(remoteconfig.ASMDDRules) - a.registerRCCapability(remoteconfig.ASMExclusions) - a.registerRCCapability(remoteconfig.ASMCustomRules) - a.registerRCCapability(remoteconfig.ASMCustomBlockingResponse) + caps := []remoteconfig.Capability{ + remoteconfig.ASMUserBlocking, + remoteconfig.ASMRequestBlocking, + remoteconfig.ASMIPBlocking, + remoteconfig.ASMDDRules, + remoteconfig.ASMExclusions, + remoteconfig.ASMCustomRules, + remoteconfig.ASMCustomBlockingResponse, + } + for _, c := range caps { + if err := a.registerRCCapability(c); err != nil { + log.Debug("appsec: Remote config: couldn't register capability %v: %v", c, err) + } + } } } func (a *appsec) disableRCBlocking() { - if a.rc == nil { + if a.cfg.rc == nil { return } - a.unregisterRCCapability(remoteconfig.ASMDDRules) - a.unregisterRCCapability(remoteconfig.ASMExclusions) - a.unregisterRCCapability(remoteconfig.ASMIPBlocking) - a.unregisterRCCapability(remoteconfig.ASMRequestBlocking) - a.unregisterRCCapability(remoteconfig.ASMUserBlocking) - a.unregisterRCCapability(remoteconfig.ASMCustomRules) - a.rc.UnregisterCallback(a.onRCRulesUpdate) + caps := []remoteconfig.Capability{ + remoteconfig.ASMDDRules, + remoteconfig.ASMExclusions, + remoteconfig.ASMIPBlocking, + remoteconfig.ASMRequestBlocking, + remoteconfig.ASMUserBlocking, + remoteconfig.ASMCustomRules, + } + for _, c := range caps { + if err := a.unregisterRCCapability(c); err != nil { + log.Debug("appsec: Remote config: couldn't unregister capability %v: %v", c, err) + } + } + if err := remoteconfig.UnregisterCallback(a.onRCRulesUpdate); err != nil { + log.Debug("appsec: Remote config: couldn't unregister callback: %v", err) + } } diff --git a/internal/appsec/remoteconfig_test.go b/internal/appsec/remoteconfig_test.go index cd5af7f630..46f2b98295 100644 --- a/internal/appsec/remoteconfig_test.go +++ b/internal/appsec/remoteconfig_test.go @@ -17,7 +17,7 @@ import ( "strings" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/remoteconfig" + "github.com/DataDog/dd-trace-go/v2/internal/remoteconfig" rc "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" waf "github.com/DataDog/go-libddwaf" @@ -33,6 +33,8 @@ func TestASMFeaturesCallback(t *testing.T) { cfg, err := newConfig() require.NoError(t, err) a := newAppSec(cfg) + err = a.startRC() + require.NoError(t, err) t.Setenv(enabledEnvVar, "") os.Unsetenv(enabledEnvVar) @@ -333,22 +335,27 @@ func TestRemoteActivationScenarios(t *testing.T) { require.NotNil(t, activeAppSec) require.False(t, Enabled()) - client := activeAppSec.rc - require.NotNil(t, client) - require.Contains(t, client.Capabilities, remoteconfig.ASMActivation) - require.Contains(t, client.Products, rc.ProductASMFeatures) + found, err := remoteconfig.HasCapability(remoteconfig.ASMActivation) + require.NoError(t, err) + require.True(t, found) + found, err = remoteconfig.HasProduct(rc.ProductASMFeatures) + require.NoError(t, err) + require.True(t, found) }) t.Run("DD_APPSEC_ENABLED=true", func(t *testing.T) { t.Setenv(enabledEnvVar, "true") + remoteconfig.Reset() Start(WithRCConfig(remoteconfig.DefaultClientConfig())) defer Stop() require.True(t, Enabled()) - client := activeAppSec.rc - require.NotNil(t, client) - require.NotContains(t, client.Capabilities, remoteconfig.ASMActivation) - require.NotContains(t, client.Products, rc.ProductASMFeatures) + found, err := remoteconfig.HasCapability(remoteconfig.ASMActivation) + require.NoError(t, err) + require.False(t, found) + found, err = remoteconfig.HasProduct(rc.ProductASMFeatures) + require.NoError(t, err) + require.False(t, found) }) t.Run("DD_APPSEC_ENABLED=false", func(t *testing.T) { @@ -397,11 +404,10 @@ func TestCapabilities(t *testing.T) { if !Enabled() && activeAppSec == nil { t.Skip() } - require.NotNil(t, activeAppSec.rc) - require.Len(t, activeAppSec.rc.Capabilities, len(tc.expected)) for _, cap := range tc.expected { - _, contained := activeAppSec.rc.Capabilities[cap] - require.True(t, contained) + found, err := remoteconfig.HasCapability(cap) + require.NoError(t, err) + require.True(t, found) } }) } diff --git a/internal/appsec/rules.go b/internal/appsec/rules.go index f34e2a49a1..1dadab104f 100644 --- a/internal/appsec/rules.go +++ b/internal/appsec/rules.go @@ -10,8 +10,8 @@ package appsec import _ "embed" -// Static recommended AppSec rule 1.7.1 -// Source: https://github.com/DataDog/appsec-event-rules/blob/1.7.1/build/recommended.json +// Static recommended AppSec rule 1.8.0 +// Source: https://github.com/DataDog/appsec-event-rules/blob/1.8.0/build/recommended.json // //go:embed rules.json var staticRecommendedRules string diff --git a/internal/appsec/rules.json b/internal/appsec/rules.json index ba65c5cf5c..a6e0146854 100644 --- a/internal/appsec/rules.json +++ b/internal/appsec/rules.json @@ -1,7 +1,7 @@ { "version": "2.2", "metadata": { - "rules_version": "1.7.1" + "rules_version": "1.8.0" }, "rules": [ { @@ -62,6 +62,8 @@ "crs_id": "913110", "category": "attack_attempt", "tool_name": "Acunetix", + "cwe": "200", + "capec": "1000/118/169", "confidence": "0" }, "conditions": [ @@ -94,6 +96,8 @@ "type": "security_scanner", "crs_id": "913120", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -108,6 +112,12 @@ }, { "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -144,6 +154,8 @@ "type": "http_protocol_violation", "crs_id": "920260", "category": "attack_attempt", + "cwe": "176", + "capec": "1000/255/153/267/71", "confidence": "0" }, "conditions": [ @@ -171,7 +183,9 @@ "tags": { "type": "http_protocol_violation", "crs_id": "921110", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "444", + "capec": "1000/210/272/220/33" }, "conditions": [ { @@ -206,7 +220,9 @@ "tags": { "type": "http_protocol_violation", "crs_id": "921160", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "113", + "capec": "1000/210/272/220/105" }, "conditions": [ { @@ -239,6 +255,8 @@ "type": "lfi", "crs_id": "930100", "category": "attack_attempt", + "cwe": "22", + "capec": "1000/255/153/126", "confidence": "1" }, "conditions": [ @@ -271,6 +289,8 @@ "type": "lfi", "crs_id": "930110", "category": "attack_attempt", + "cwe": "22", + "capec": "1000/255/153/126", "confidence": "1" }, "conditions": [ @@ -304,6 +324,8 @@ "type": "lfi", "crs_id": "930120", "category": "attack_attempt", + "cwe": "22", + "capec": "1000/255/153/126", "confidence": "1" }, "conditions": [ @@ -321,6 +343,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -1743,7 +1768,10 @@ "sys/hypervisor", "sys/kernel", "sys/module", - "sys/power" + "sys/power", + "windows\\win.ini", + "default\\ntuser.dat", + "/var/run/secrets/kubernetes.io/serviceaccount" ] }, "operator": "phrase_match" @@ -1761,6 +1789,8 @@ "type": "rfi", "crs_id": "931110", "category": "attack_attempt", + "cwe": "98", + "capec": "1000/152/175/253/193", "confidence": "1" }, "conditions": [ @@ -1787,7 +1817,9 @@ "tags": { "type": "rfi", "crs_id": "931120", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "98", + "capec": "1000/152/175/253/193" }, "conditions": [ { @@ -1801,6 +1833,12 @@ }, { "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^(?i:file|ftps?)://.*?\\?+$", @@ -1821,6 +1859,8 @@ "type": "command_injection", "crs_id": "932160", "category": "attack_attempt", + "cwe": "77", + "capec": "1000/152/248/88", "confidence": "1" }, "conditions": [ @@ -1838,6 +1878,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -2312,7 +2355,8 @@ } ], "transformers": [ - "lowercase" + "lowercase", + "cmdLine" ] }, { @@ -2322,6 +2366,8 @@ "type": "command_injection", "crs_id": "932171", "category": "attack_attempt", + "cwe": "77", + "capec": "1000/152/248/88", "confidence": "1" }, "conditions": [ @@ -2342,6 +2388,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^\\(\\s*\\)\\s+{", @@ -2362,6 +2411,8 @@ "type": "command_injection", "crs_id": "932180", "category": "attack_attempt", + "cwe": "706", + "capec": "1000/225/122/17/177", "confidence": "1" }, "conditions": [ @@ -2421,6 +2472,8 @@ "type": "unrestricted_file_upload", "crs_id": "933111", "category": "attack_attempt", + "cwe": "434", + "capec": "1000/225/122/17/650", "confidence": "1" }, "conditions": [ @@ -2472,6 +2525,8 @@ "type": "php_code_injection", "crs_id": "933130", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/225/122/17/650", "confidence": "1" }, "conditions": [ @@ -2489,6 +2544,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -2528,7 +2586,9 @@ "tags": { "type": "php_code_injection", "crs_id": "933131", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/225/122/17/650" }, "conditions": [ { @@ -2545,6 +2605,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:HTTP_(?:ACCEPT(?:_(?:ENCODING|LANGUAGE|CHARSET))?|(?:X_FORWARDED_FO|REFERE)R|(?:USER_AGEN|HOS)T|CONNECTION|KEEP_ALIVE)|PATH_(?:TRANSLATED|INFO)|ORIG_PATH_INFO|QUERY_STRING|REQUEST_URI|AUTH_TYPE)", @@ -2565,6 +2628,8 @@ "type": "php_code_injection", "crs_id": "933140", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/225/122/17/650", "confidence": "1" }, "conditions": [ @@ -2582,6 +2647,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "php://(?:std(?:in|out|err)|(?:in|out)put|fd|memory|temp|filter)", @@ -2601,6 +2669,8 @@ "type": "php_code_injection", "crs_id": "933150", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/225/122/17/650", "confidence": "1" }, "conditions": [ @@ -2618,6 +2688,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -2680,7 +2753,9 @@ "tags": { "type": "php_code_injection", "crs_id": "933160", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/225/122/17/650" }, "conditions": [ { @@ -2697,6 +2772,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:s(?:e(?:t(?:_(?:e(?:xception|rror)_handler|magic_quotes_runtime|include_path)|defaultstub)|ssion_s(?:et_save_handler|tart))|qlite_(?:(?:(?:unbuffered|single|array)_)?query|create_(?:aggregate|function)|p?open|exec)|tr(?:eam_(?:context_create|socket_client)|ipc?slashes|rev)|implexml_load_(?:string|file)|ocket_c(?:onnect|reate)|h(?:ow_sourc|a1_fil)e|pl_autoload_register|ystem)|p(?:r(?:eg_(?:replace(?:_callback(?:_array)?)?|match(?:_all)?|split)|oc_(?:(?:terminat|clos|nic)e|get_status|open)|int_r)|o(?:six_(?:get(?:(?:e[gu]|g)id|login|pwnam)|mk(?:fifo|nod)|ttyname|kill)|pen)|hp(?:_(?:strip_whitespac|unam)e|version|info)|g_(?:(?:execut|prepar)e|connect|query)|a(?:rse_(?:ini_file|str)|ssthru)|utenv)|r(?:unkit_(?:function_(?:re(?:defin|nam)e|copy|add)|method_(?:re(?:defin|nam)e|copy|add)|constant_(?:redefine|add))|e(?:(?:gister_(?:shutdown|tick)|name)_function|ad(?:(?:gz)?file|_exif_data|dir))|awurl(?:de|en)code)|i(?:mage(?:createfrom(?:(?:jpe|pn)g|x[bp]m|wbmp|gif)|(?:jpe|pn)g|g(?:d2?|if)|2?wbmp|xbm)|s_(?:(?:(?:execut|write?|read)ab|fi)le|dir)|ni_(?:get(?:_all)?|set)|terator_apply|ptcembed)|g(?:et(?:_(?:c(?:urrent_use|fg_va)r|meta_tags)|my(?:[gpu]id|inode)|(?:lastmo|cw)d|imagesize|env)|z(?:(?:(?:defla|wri)t|encod|fil)e|compress|open|read)|lob)|a(?:rray_(?:u(?:intersect(?:_u?assoc)?|diff(?:_u?assoc)?)|intersect_u(?:assoc|key)|diff_u(?:assoc|key)|filter|reduce|map)|ssert(?:_options)?|tob)|h(?:tml(?:specialchars(?:_decode)?|_entity_decode|entities)|(?:ash(?:_(?:update|hmac))?|ighlight)_file|e(?:ader_register_callback|x2bin))|f(?:i(?:le(?:(?:[acm]tim|inod)e|(?:_exist|perm)s|group)?|nfo_open)|tp_(?:nb_(?:ge|pu)|connec|ge|pu)t|(?:unction_exis|pu)ts|write|open)|o(?:b_(?:get_(?:c(?:ontents|lean)|flush)|end_(?:clean|flush)|clean|flush|start)|dbc_(?:result(?:_all)?|exec(?:ute)?|connect)|pendir)|m(?:b_(?:ereg(?:_(?:replace(?:_callback)?|match)|i(?:_replace)?)?|parse_str)|(?:ove_uploaded|d5)_file|ethod_exists|ysql_query|kdir)|e(?:x(?:if_(?:t(?:humbnail|agname)|imagetype|read_data)|ec)|scapeshell(?:arg|cmd)|rror_reporting|val)|c(?:url_(?:file_create|exec|init)|onvert_uuencode|reate_function|hr)|u(?:n(?:serialize|pack)|rl(?:de|en)code|[ak]?sort)|b(?:(?:son_(?:de|en)|ase64_en)code|zopen|toa)|(?:json_(?:de|en)cod|debug_backtrac|tmpfil)e|var_dump)(?:\\s|/\\*.*\\*/|//.*|#.*|\\\"|')*\\((?:(?:\\s|/\\*.*\\*/|//.*|#.*)*(?:\\$\\w+|[A-Z\\d]\\w*|\\w+\\(.*\\)|\\\\?\"(?:[^\"]|\\\\\"|\"\"|\"\\+\")*\\\\?\"|\\\\?'(?:[^']|''|'\\+')*\\\\?')(?:\\s|/\\*.*\\*/|//.*|#.*)*(?:(?:::|\\.|->)(?:\\s|/\\*.*\\*/|//.*|#.*)*\\w+(?:\\(.*\\))?)?,)*(?:(?:\\s|/\\*.*\\*/|//.*|#.*)*(?:\\$\\w+|[A-Z\\d]\\w*|\\w+\\(.*\\)|\\\\?\"(?:[^\"]|\\\\\"|\"\"|\"\\+\")*\\\\?\"|\\\\?'(?:[^']|''|'\\+')*\\\\?')(?:\\s|/\\*.*\\*/|//.*|#.*)*(?:(?:::|\\.|->)(?:\\s|/\\*.*\\*/|//.*|#.*)*\\w+(?:\\(.*\\))?)?)?\\)", @@ -2717,6 +2795,8 @@ "type": "php_code_injection", "crs_id": "933170", "category": "attack_attempt", + "cwe": "502", + "capec": "1000/152/586", "confidence": "1" }, "conditions": [ @@ -2737,6 +2817,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "[oOcC]:\\d+:\\\".+?\\\":\\d+:{[\\W\\w]*}", @@ -2756,7 +2839,9 @@ "tags": { "type": "php_code_injection", "crs_id": "933200", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "502", + "capec": "1000/152/586" }, "conditions": [ { @@ -2773,6 +2858,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:(?:bzip|ssh)2|z(?:lib|ip)|(?:ph|r)ar|expect|glob|ogg)://", @@ -2794,7 +2882,9 @@ "tags": { "type": "js_code_injection", "crs_id": "934100", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -2811,6 +2901,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:(?:l(?:(?:utimes|chmod)(?:Sync)?|(?:stat|ink)Sync)|w(?:rite(?:(?:File|v)(?:Sync)?|Sync)|atchFile)|u(?:n(?:watchFile|linkSync)|times(?:Sync)?)|s(?:(?:ymlink|tat)Sync|pawn(?:File|Sync))|ex(?:ec(?:File(?:Sync)?|Sync)|istsSync)|a(?:ppendFile|ccess)(?:Sync)?|(?:Caveat|Inode)s|open(?:dir)?Sync|new\\s+Function|Availability|\\beval)\\s*\\(|m(?:ain(?:Module\\s*(?:\\W*\\s*(?:constructor|require)|\\[)|\\s*(?:\\W*\\s*(?:constructor|require)|\\[))|kd(?:temp(?:Sync)?|irSync)\\s*\\(|odule\\.exports\\s*=)|c(?:(?:(?:h(?:mod|own)|lose)Sync|reate(?:Write|Read)Stream|p(?:Sync)?)\\s*\\(|o(?:nstructor\\s*(?:\\W*\\s*_load|\\[)|pyFile(?:Sync)?\\s*\\())|f(?:(?:(?:s(?:(?:yncS)?|tatS)|datas(?:yncS)?)ync|ch(?:mod|own)(?:Sync)?)\\s*\\(|u(?:nction\\s*\\(\\s*\\)\\s*{|times(?:Sync)?\\s*\\())|r(?:e(?:(?:ad(?:(?:File|link|dir)?Sync|v(?:Sync)?)|nameSync)\\s*\\(|quire\\s*(?:\\W*\\s*main|\\[))|m(?:Sync)?\\s*\\()|process\\s*(?:\\W*\\s*(?:mainModule|binding)|\\[)|t(?:his\\.constructor|runcateSync\\s*\\()|_(?:\\$\\$ND_FUNC\\$\\$_|_js_function)|global\\s*(?:\\W*\\s*process|\\[)|String\\s*\\.\\s*fromCharCode|binding\\s*\\[)", @@ -2831,7 +2924,9 @@ "type": "js_code_injection", "crs_id": "934101", "category": "attack_attempt", - "confidence": "1" + "confidence": "1", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -2848,6 +2943,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:w(?:atch|rite)|(?:spaw|ope)n|exists|close|fork|read)\\s*\\(", @@ -2868,6 +2966,8 @@ "type": "xss", "crs_id": "941110", "category": "attack_attempt", + "cwe": "80", + "capec": "1000/152/242/63/591", "confidence": "1" }, "conditions": [ @@ -2897,6 +2997,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "]*>[\\s\\S]*?", @@ -2919,6 +3022,8 @@ "type": "xss", "crs_id": "941120", "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", "confidence": "1" }, "conditions": [ @@ -2948,9 +3053,12 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], - "regex": "[\\s\\\"'`;\\/0-9=\\x0B\\x09\\x0C\\x3B\\x2C\\x28\\x3B]on(?:d(?:r(?:ag(?:en(?:ter|d)|leave|start|over)?|op)|urationchange|blclick)|s(?:e(?:ek(?:ing|ed)|arch|lect)|u(?:spend|bmit)|talled|croll|how)|m(?:ouse(?:(?:lea|mo)ve|o(?:ver|ut)|enter|down|up)|essage)|p(?:a(?:ge(?:hide|show)|(?:st|us)e)|lay(?:ing)?|rogress)|c(?:anplay(?:through)?|o(?:ntextmenu|py)|hange|lick|ut)|a(?:nimation(?:iteration|start|end)|(?:fterprin|bor)t)|t(?:o(?:uch(?:cancel|start|move|end)|ggle)|imeupdate)|f(?:ullscreen(?:change|error)|ocus(?:out|in)?)|(?:(?:volume|hash)chang|o(?:ff|n)lin)e|b(?:efore(?:unload|print)|lur)|load(?:ed(?:meta)?data|start)?|r(?:es(?:ize|et)|atechange)|key(?:press|down|up)|w(?:aiting|heel)|in(?:valid|put)|e(?:nded|rror)|unload)[\\s\\x0B\\x09\\x0C\\x3B\\x2C\\x28\\x3B]*?=[^=]", + "regex": "\\bon(?:d(?:r(?:ag(?:en(?:ter|d)|leave|start|over)?|op)|urationchange|blclick)|s(?:e(?:ek(?:ing|ed)|arch|lect)|u(?:spend|bmit)|talled|croll|how)|m(?:ouse(?:(?:lea|mo)ve|o(?:ver|ut)|enter|down|up)|essage)|p(?:a(?:ge(?:hide|show)|(?:st|us)e)|lay(?:ing)?|rogress|aste|ointer(?:cancel|down|enter|leave|move|out|over|rawupdate|up))|c(?:anplay(?:through)?|o(?:ntextmenu|py)|hange|lick|ut)|a(?:nimation(?:iteration|start|end)|(?:fterprin|bor)t|uxclick|fterscriptexecute)|t(?:o(?:uch(?:cancel|start|move|end)|ggle)|imeupdate)|f(?:ullscreen(?:change|error)|ocus(?:out|in)?|inish)|(?:(?:volume|hash)chang|o(?:ff|n)lin)e|b(?:efore(?:unload|print)|lur)|load(?:ed(?:meta)?data|start|end)?|r(?:es(?:ize|et)|atechange)|key(?:press|down|up)|w(?:aiting|heel)|in(?:valid|put)|e(?:nded|rror)|unload)[\\s\\x0B\\x09\\x0C\\x3B\\x2C\\x28\\x3B]*?=[^=]", "options": { "min_length": 8 } @@ -2970,6 +3078,8 @@ "type": "xss", "crs_id": "941140", "category": "attack_attempt", + "cwe": "84", + "capec": "1000/152/242/63/591/244", "confidence": "1" }, "conditions": [ @@ -2999,6 +3109,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "[a-z]+=(?:[^:=]+:.+;)*?[^:=]+:url\\(javascript", @@ -3021,6 +3134,8 @@ "type": "xss", "crs_id": "941170", "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", "confidence": "1" }, "conditions": [ @@ -3047,6 +3162,12 @@ }, { "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:\\W|^)(?:javascript:(?:[\\s\\S]+[=\\x5c\\(\\[\\.<]|[\\s\\S]*?(?:\\bname\\b|\\x5c[ux]\\d)))|@\\W*?i\\W*?m\\W*?p\\W*?o\\W*?r\\W*?t\\W*?(?:/\\*[\\s\\S]*?)?(?:[\\\"']|\\W*?u\\W*?r\\W*?l[\\s\\S]*?\\()|[^-]*?-\\W*?m\\W*?o\\W*?z\\W*?-\\W*?b\\W*?i\\W*?n\\W*?d\\W*?i\\W*?n\\W*?g[^:]*?:\\W*?u\\W*?r\\W*?l[\\s\\S]*?\\(", @@ -3068,7 +3189,9 @@ "tags": { "type": "xss", "crs_id": "941180", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "79", + "capec": "1000/152/242/63/591" }, "conditions": [ { @@ -3085,6 +3208,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -3111,6 +3237,8 @@ "type": "xss", "crs_id": "941200", "category": "attack_attempt", + "cwe": "80", + "capec": "1000/152/242/63/591", "confidence": "1" }, "conditions": [ @@ -3128,6 +3256,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:<.*[:]?vmlframe.*?[\\s/+]*?src[\\s/+]*=)", @@ -3150,6 +3281,8 @@ "type": "xss", "crs_id": "941210", "category": "attack_attempt", + "cwe": "80", + "capec": "1000/152/242/63/591", "confidence": "1" }, "conditions": [ @@ -3167,6 +3300,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:(?:j|&#x?0*(?:74|4A|106|6A);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:a|&#x?0*(?:65|41|97|61);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:v|&#x?0*(?:86|56|118|76);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:a|&#x?0*(?:65|41|97|61);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:s|&#x?0*(?:83|53|115|73);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:c|&#x?0*(?:67|43|99|63);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:r|&#x?0*(?:82|52|114|72);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:i|&#x?0*(?:73|49|105|69);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:p|&#x?0*(?:80|50|112|70);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:t|&#x?0*(?:84|54|116|74);?)(?:\\t|\\n|\\r|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?::|&(?:#x?0*(?:58|3A);?|colon;)).)", @@ -3189,6 +3325,8 @@ "type": "xss", "crs_id": "941220", "category": "attack_attempt", + "cwe": "80", + "capec": "1000/152/242/63/591", "confidence": "1" }, "conditions": [ @@ -3206,6 +3344,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:(?:v|&#x?0*(?:86|56|118|76);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:b|&#x?0*(?:66|42|98|62);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:s|&#x?0*(?:83|53|115|73);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:c|&#x?0*(?:67|43|99|63);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:r|&#x?0*(?:82|52|114|72);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:i|&#x?0*(?:73|49|105|69);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:p|&#x?0*(?:80|50|112|70);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?:t|&#x?0*(?:84|54|116|74);?)(?:\\t|&(?:#x?0*(?:9|13|10|A|D);?|tab;|newline;))*(?::|&(?:#x?0*(?:58|3A);?|colon;)).)", @@ -3228,6 +3369,8 @@ "type": "xss", "crs_id": "941230", "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", "confidence": "1" }, "conditions": [ @@ -3245,6 +3388,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "]", @@ -3419,6 +3585,8 @@ "type": "xss", "crs_id": "941300", "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", "confidence": "1" }, "conditions": [ @@ -3436,6 +3604,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": ")|<.*\\+AD4-", @@ -3493,7 +3669,9 @@ "tags": { "type": "xss", "crs_id": "941360", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "87", + "capec": "1000/152/242/63/591/199" }, "conditions": [ { @@ -3510,6 +3688,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "![!+ ]\\[\\]", @@ -3530,7 +3711,9 @@ "type": "xss", "crs_id": "941390", "category": "attack_attempt", - "confidence": "1" + "confidence": "1", + "cwe": "79", + "capec": "1000/152/242/63/591" }, "conditions": [ { @@ -3547,6 +3730,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?i:eval|settimeout|setinterval|new\\s+Function|alert|prompt)[\\s+]*\\([^\\)]", @@ -3566,7 +3752,9 @@ "tags": { "type": "sql_injection", "crs_id": "942100", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66" }, "conditions": [ { @@ -3583,6 +3771,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ] }, @@ -3600,6 +3791,8 @@ "type": "sql_injection", "crs_id": "942160", "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66/7", "confidence": "1" }, "conditions": [ @@ -3617,6 +3810,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:sleep\\(\\s*?\\d*?\\s*?\\)|benchmark\\(.*?\\,.*?\\))", @@ -3637,6 +3833,8 @@ "type": "sql_injection", "crs_id": "942240", "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66/7", "confidence": "1" }, "conditions": [ @@ -3654,6 +3852,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:[\\\"'`](?:;*?\\s*?waitfor\\s+(?:delay|time)\\s+[\\\"'`]|;.*?:\\s*?goto)|alter\\s*?\\w+.*?cha(?:racte)?r\\s+set\\s+\\w+)", @@ -3672,7 +3873,9 @@ "tags": { "type": "sql_injection", "crs_id": "942250", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66" }, "conditions": [ { @@ -3689,6 +3892,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:merge.*?using\\s*?\\(|execute\\s*?immediate\\s*?[\\\"'`]|match\\s*?[\\w(?:),+-]+\\s*?against\\s*?\\()", @@ -3708,7 +3914,9 @@ "tags": { "type": "sql_injection", "crs_id": "942270", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66" }, "conditions": [ { @@ -3725,6 +3933,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "union.*?select.*?from", @@ -3744,6 +3955,8 @@ "type": "sql_injection", "crs_id": "942280", "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66/7", "confidence": "1" }, "conditions": [ @@ -3761,6 +3974,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:;\\s*?shutdown\\s*?(?:[#;{]|\\/\\*|--)|waitfor\\s*?delay\\s?[\\\"'`]+\\s?\\d|select\\s*?pg_sleep)", @@ -3779,7 +3995,9 @@ "tags": { "type": "nosql_injection", "crs_id": "942290", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "943", + "capec": "1000/152/248/676" }, "conditions": [ { @@ -3796,6 +4014,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:(?:\\[?\\$(?:(?:s(?:lic|iz)|wher)e|e(?:lemMatch|xists|q)|n(?:o[rt]|in?|e)|l(?:ike|te?)|t(?:ext|ype)|a(?:ll|nd)|jsonSchema|between|regex|x?or|div|mod)\\]?)\\b)", @@ -3817,7 +4038,9 @@ "tags": { "type": "sql_injection", "crs_id": "942360", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66/470" }, "conditions": [ { @@ -3834,6 +4057,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:^[\\W\\d]+\\s*?(?:alter\\s*(?:a(?:(?:pplication\\s*rol|ggregat)e|s(?:ymmetric\\s*ke|sembl)y|u(?:thorization|dit)|vailability\\s*group)|c(?:r(?:yptographic\\s*provider|edential)|o(?:l(?:latio|um)|nversio)n|ertificate|luster)|s(?:e(?:rv(?:ice|er)|curity|quence|ssion|arch)|y(?:mmetric\\s*key|nonym)|togroup|chema)|m(?:a(?:s(?:ter\\s*key|k)|terialized)|e(?:ssage\\s*type|thod)|odule)|l(?:o(?:g(?:file\\s*group|in)|ckdown)|a(?:ngua|r)ge|ibrary)|t(?:(?:abl(?:espac)?|yp)e|r(?:igger|usted)|hreshold|ext)|p(?:a(?:rtition|ckage)|ro(?:cedur|fil)e|ermission)|d(?:i(?:mension|skgroup)|atabase|efault|omain)|r(?:o(?:l(?:lback|e)|ute)|e(?:sourc|mot)e)|f(?:u(?:lltext|nction)|lashback|oreign)|e(?:xte(?:nsion|rnal)|(?:ndpoi|ve)nt)|in(?:dex(?:type)?|memory|stance)|b(?:roker\\s*priority|ufferpool)|x(?:ml\\s*schema|srobject)|w(?:ork(?:load)?|rapper)|hi(?:erarchy|stogram)|o(?:perator|utline)|(?:nicknam|queu)e|us(?:age|er)|group|java|view)|union\\s*(?:(?:distin|sele)ct|all))\\b|\\b(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\\s+(?:group_concat|load_file|char)\\b\\s*\\(?|[\\s(]load_file\\s*?\\(|[\\\"'`]\\s+regexp\\W)", @@ -3852,7 +4078,9 @@ "tags": { "type": "sql_injection", "crs_id": "942500", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "89", + "capec": "1000/152/248/66" }, "conditions": [ { @@ -3869,6 +4097,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:/\\*[!+](?:[\\w\\s=_\\-(?:)]+)?\\*/)", @@ -3889,6 +4120,8 @@ "type": "http_protocol_violation", "crs_id": "943100", "category": "attack_attempt", + "cwe": "384", + "capec": "1000/225/21/593/61", "confidence": "1" }, "conditions": [ @@ -3903,6 +4136,12 @@ }, { "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i:\\.cookie\\b.*?;\\W*?(?:expires|domain)\\W*?=|\\bhttp-equiv\\W+set-cookie\\b)", @@ -3923,6 +4162,8 @@ "type": "java_code_injection", "crs_id": "944100", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -3943,6 +4184,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "java\\.lang\\.(?:runtime|processbuilder)", @@ -3964,7 +4208,9 @@ "tags": { "type": "java_code_injection", "crs_id": "944110", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -3984,6 +4230,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:runtime|processbuilder)", @@ -4011,6 +4260,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:unmarshaller|base64data|java\\.)", @@ -4032,7 +4284,9 @@ "tags": { "type": "java_code_injection", "crs_id": "944130", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -4052,6 +4306,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "list": [ @@ -4112,6 +4369,8 @@ "type": "java_code_injection", "crs_id": "944260", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -4132,6 +4391,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:class\\.module\\.classLoader\\.resources\\.context\\.parent\\.pipeline|springframework\\.context\\.support\\.FileSystemXmlApplicationContext)", @@ -4150,7 +4412,9 @@ "name": "Look for Cassandra injections", "tags": { "type": "nosql_injection", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "943", + "capec": "1000/152/248/676" }, "conditions": [ { @@ -4165,6 +4429,12 @@ { "address": "server.request.path_params" }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" + }, { "address": "server.request.headers.no_cookies" } @@ -4183,7 +4453,9 @@ "name": "OGNL - Look for formatting injection patterns", "tags": { "type": "java_code_injection", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -4204,6 +4476,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "[#%$]{(?:[^}]+[^\\w\\s}\\-_][^}]+|\\d+-\\d+)}", @@ -4221,6 +4496,8 @@ "tags": { "type": "java_code_injection", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -4242,6 +4519,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "[@#]ognl", @@ -4259,6 +4539,8 @@ "tags": { "type": "exploit_detection", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -4287,6 +4569,8 @@ "tags": { "type": "js_code_injection", "category": "attack_attempt", + "cwe": "1321", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -4315,6 +4599,8 @@ "tags": { "type": "js_code_injection", "category": "attack_attempt", + "cwe": "1321", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -4357,6 +4643,8 @@ "tags": { "type": "java_code_injection", "category": "attack_attempt", + "cwe": "1336", + "capec": "1000/152/242/19", "confidence": "1" }, "conditions": [ @@ -4377,6 +4665,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "#(?:set|foreach|macro|parse|if)\\(.*\\)|<#assign.*>" @@ -4393,6 +4684,8 @@ "type": "attack_tool", "category": "attack_attempt", "tool_name": "BurpCollaborator", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -4413,6 +4706,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:burpcollaborator\\.net|oastify\\.com)\\b" @@ -4429,6 +4725,8 @@ "type": "commercial_scanner", "category": "attack_attempt", "tool_name": "Qualys", + "cwe": "200", + "capec": "1000/118/169", "confidence": "0" }, "conditions": [ @@ -4449,6 +4747,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\bqualysperiscope\\.com\\b" @@ -4465,6 +4766,8 @@ "type": "commercial_scanner", "category": "attack_attempt", "tool_name": "Probely", + "cwe": "200", + "capec": "1000/118/169", "confidence": "0" }, "conditions": [ @@ -4485,6 +4788,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\bprbly\\.win\\b" @@ -4500,6 +4806,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -4520,6 +4828,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:webhook\\.site|\\.canarytokens\\.com|vii\\.one|act1on3\\.ru|gdsburp\\.com)\\b" @@ -4535,6 +4846,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "0" }, "conditions": [ @@ -4555,6 +4868,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:\\.ngrok\\.io|requestbin\\.com|requestbin\\.net)\\b" @@ -4571,6 +4887,8 @@ "type": "commercial_scanner", "category": "attack_attempt", "tool_name": "Rapid7", + "cwe": "200", + "capec": "1000/118/169", "confidence": "0" }, "conditions": [ @@ -4591,6 +4909,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\bappspidered\\.rapid7\\." @@ -4607,6 +4928,8 @@ "type": "attack_tool", "category": "attack_attempt", "tool_name": "interact.sh", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -4627,6 +4950,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\b(?:interact\\.sh|oast\\.(?:pro|live|site|online|fun|me))\\b" @@ -4636,12 +4962,59 @@ ], "transformers": [] }, + { + "id": "dog-913-008", + "name": "Netsparker OOB domain", + "tags": { + "type": "commercial_scanner", + "category": "attack_attempt", + "tool_name": "Netsparker", + "cwe": "200", + "capec": "1000/118/169", + "confidence": "0" + }, + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.query" + }, + { + "address": "server.request.body" + }, + { + "address": "server.request.path_params" + }, + { + "address": "server.request.headers.no_cookies" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" + } + ], + "regex": "\\b(?:\\.|(?:\\\\|&#)(?:0*46|x0*2e);)r87(?:\\.|(?:\\\\|&#)(?:0*46|x0*2e);)(?:me|com)\\b", + "options": { + "case_sensitive": false, + "min_length": 7 + } + }, + "operator": "match_regex" + } + ], + "transformers": [] + }, { "id": "dog-931-001", "name": "RFI: URL Payload to well known RFI target", "tags": { "type": "rfi", "category": "attack_attempt", + "cwe": "98", + "capec": "1000/152/175/253/193", "confidence": "1" }, "conditions": [ @@ -4656,6 +5029,12 @@ }, { "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^(?i:file|ftps?|https?).*/rfiinc\\.txt\\?+$", @@ -4675,6 +5054,8 @@ "tags": { "type": "xxe", "category": "attack_attempt", + "cwe": "91", + "capec": "1000/152/248/250", "confidence": "0" }, "conditions": [ @@ -4686,6 +5067,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?:<\\?xml[^>]*>.*)]+SYSTEM\\s+[^>]+>", @@ -4699,12 +5083,69 @@ ], "transformers": [] }, + { + "id": "dog-941-001", + "name": "XSS in source property", + "tags": { + "type": "xss", + "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", + "confidence": "0" + }, + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.headers.no_cookies", + "key_path": [ + "user-agent" + ] + }, + { + "address": "server.request.headers.no_cookies", + "key_path": [ + "referer" + ] + }, + { + "address": "server.request.query" + }, + { + "address": "server.request.body" + }, + { + "address": "server.request.path_params" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" + } + ], + "regex": "<(?:iframe|esi:include)(?:(?:\\s|/)*\\w+=[\"'\\w]+)*(?:\\s|/)*src(?:doc)?=[\"']?(?:data:|javascript:|http:|//)[^\\s'\"]+['\"]?", + "options": { + "min_length": 14 + } + }, + "operator": "match_regex" + } + ], + "transformers": [ + "removeNulls", + "urlDecodeUni" + ] + }, { "id": "dog-942-001", "name": "Blind XSS callback domains", "tags": { "type": "xss", "category": "attack_attempt", + "cwe": "83", + "capec": "1000/152/242/63/591/243", "confidence": "1" }, "conditions": [ @@ -4725,6 +5166,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "https?:\\/\\/(?:.*\\.)?(?:bxss\\.in|xss\\.ht|js\\.rip)", @@ -4743,6 +5187,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -4978,6 +5424,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5018,6 +5466,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5058,6 +5508,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5098,6 +5550,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5138,6 +5592,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5178,6 +5634,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5218,6 +5676,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5258,6 +5718,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5298,6 +5760,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "1" }, "conditions": [ @@ -5315,6 +5779,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i)^\\W*((http|ftp)s?://)?\\W*((::f{4}:)?(169|(0x)?0*a9|0+251)\\.?(254|(0x)?0*fe|0+376)[0-9a-fx\\.:]+|metadata\\.google\\.internal|metadata\\.goog)\\W*/", @@ -5334,7 +5801,9 @@ "name": "Server-side Javascript injection: Try to detect obvious JS injection", "tags": { "type": "js_code_injection", - "category": "attack_attempt" + "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242" }, "conditions": [ { @@ -5351,6 +5820,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "require\\(['\"][\\w\\.]+['\"]\\)|process\\.\\w+\\([\\w\\.]*\\)|\\.toString\\(\\)", @@ -5371,6 +5843,8 @@ "tags": { "type": "command_injection", "category": "attack_attempt", + "cwe": "78", + "capec": "1000/152/248/88", "confidence": "1" }, "conditions": [ @@ -5391,6 +5865,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i)[&|]\\s*type\\s+%\\w+%\\\\+\\w+\\.ini\\s*[&|]" @@ -5406,6 +5883,8 @@ "tags": { "type": "command_injection", "category": "attack_attempt", + "cwe": "78", + "capec": "1000/152/248/88", "confidence": "1" }, "conditions": [ @@ -5426,14 +5905,19 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], - "regex": "(?i)[&|]\\s*cat\\s+\\/etc\\/[\\w\\.\\/]*passwd\\s*[&|]" + "regex": "(?i)[&|]\\s*cat\\s*\\/etc\\/[\\w\\.\\/]*passwd\\s*[&|]" }, "operator": "match_regex" } ], - "transformers": [] + "transformers": [ + "cmdLine" + ] }, { "id": "sqr-000-010", @@ -5441,6 +5925,8 @@ "tags": { "type": "command_injection", "category": "attack_attempt", + "cwe": "78", + "capec": "1000/152/248/88", "confidence": "1" }, "conditions": [ @@ -5461,6 +5947,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(?i)[&|]\\s*timeout\\s+/t\\s+\\d+\\s*[&|]" @@ -5476,6 +5965,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "1" }, "conditions": [ @@ -5493,6 +5984,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "http(s?):\\/\\/([A-Za-z0-9\\.\\-\\_]+|\\[[A-Fa-f0-9\\:]+\\]|):5986\\/wsman", @@ -5511,6 +6005,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "0" }, "conditions": [ @@ -5528,6 +6024,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^(jar:)?(http|https):\\/\\/([0-9oq]{1,5}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|[0-9]{1,10})(:[0-9]{1,5})?(\\/[^:@]*)?$" @@ -5545,6 +6044,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "0" }, "conditions": [ @@ -5562,6 +6063,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^(jar:)?(http|https):\\/\\/((\\[)?[:0-9a-f\\.x]{2,}(\\])?)(:[0-9]{1,5})?(\\/[^:@]*)?$" @@ -5579,6 +6083,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "1" }, "conditions": [ @@ -5599,6 +6105,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "(http|https):\\/\\/(?:.*\\.)?(?:burpcollaborator\\.net|localtest\\.me|mail\\.ebc\\.apple\\.com|bugbounty\\.dod\\.network|.*\\.[nx]ip\\.io|oastify\\.com|oast\\.(?:pro|live|site|online|fun|me)|sslip\\.io|requestbin\\.com|requestbin\\.net|hookbin\\.com|webhook\\.site|canarytokens\\.com|interact\\.sh|ngrok\\.io|bugbounty\\.click|prbly\\.win|qualysperiscope\\.com|vii.one|act1on3.ru)" @@ -5614,6 +6123,8 @@ "tags": { "type": "ssrf", "category": "attack_attempt", + "cwe": "918", + "capec": "1000/225/115/664", "confidence": "0" }, "conditions": [ @@ -5634,6 +6145,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "^(jar:)?((file|netdoc):\\/\\/[\\\\\\/]+|(dict|gopher|ldap|sftp|tftp):\\/\\/.*:[0-9]{1,5})" @@ -5651,6 +6165,8 @@ "tags": { "type": "exploit_detection", "category": "attack_attempt", + "cwe": "94", + "capec": "1000/152/242", "confidence": "1" }, "conditions": [ @@ -5674,6 +6190,9 @@ }, { "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" } ], "regex": "\\${[^j]*j[^n]*n[^d]*d[^i]*i[^:]*:[^}]*}" @@ -5691,6 +6210,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Joomla exploitation tool", "confidence": "1" }, @@ -5718,6 +6239,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nessus", "confidence": "1" }, @@ -5745,6 +6268,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Arachni", "confidence": "1" }, @@ -5772,6 +6297,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Jorgee", "confidence": "1" }, @@ -5799,6 +6326,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Probely", "confidence": "0" }, @@ -5826,6 +6355,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Metis", "confidence": "1" }, @@ -5853,6 +6384,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "SQLPowerInjector", "confidence": "1" }, @@ -5880,6 +6413,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "N-Stealth", "confidence": "1" }, @@ -5907,6 +6442,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Brutus", "confidence": "1" }, @@ -5934,6 +6471,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -5960,6 +6499,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Netsparker", "confidence": "0" }, @@ -5987,6 +6528,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "JAASCois", "confidence": "1" }, @@ -6014,6 +6557,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nsauditor", "confidence": "1" }, @@ -6041,6 +6586,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Paros", "confidence": "1" }, @@ -6068,6 +6615,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "DirBuster", "confidence": "1" }, @@ -6095,6 +6644,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Pangolin", "confidence": "1" }, @@ -6122,6 +6673,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Qualys", "confidence": "0" }, @@ -6149,6 +6702,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "SQLNinja", "confidence": "1" }, @@ -6176,6 +6731,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nikto", "confidence": "1" }, @@ -6203,6 +6760,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "BlackWidow", "confidence": "1" }, @@ -6230,6 +6789,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Grendel-Scan", "confidence": "1" }, @@ -6257,6 +6818,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Havij", "confidence": "1" }, @@ -6284,6 +6847,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "w3af", "confidence": "1" }, @@ -6311,6 +6876,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nmap", "confidence": "1" }, @@ -6338,6 +6905,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nessus", "confidence": "1" }, @@ -6365,6 +6934,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "EvilScanner", "confidence": "1" }, @@ -6392,6 +6963,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "WebFuck", "confidence": "1" }, @@ -6419,6 +6992,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "OpenVAS", "confidence": "1" }, @@ -6446,6 +7021,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Spider-Pig", "confidence": "1" }, @@ -6473,6 +7050,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Zgrab", "confidence": "1" }, @@ -6500,6 +7079,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Zmeu", "confidence": "1" }, @@ -6527,6 +7108,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "GoogleSecurityScanner", "confidence": "0" }, @@ -6554,6 +7137,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Commix", "confidence": "1" }, @@ -6581,6 +7166,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Gobuster", "confidence": "1" }, @@ -6608,6 +7195,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "CGIchk", "confidence": "1" }, @@ -6635,6 +7224,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "FFUF", "confidence": "1" }, @@ -6662,6 +7253,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nuclei", "confidence": "1" }, @@ -6689,6 +7282,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Tsunami", "confidence": "1" }, @@ -6716,6 +7311,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Nimbostratus", "confidence": "1" }, @@ -6743,6 +7340,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Datadog Canary Test", "confidence": "1" }, @@ -6776,6 +7375,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Datadog Canary Test", "confidence": "1" }, @@ -6812,6 +7413,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "AlertLogic", "confidence": "0" }, @@ -6839,6 +7442,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "wfuzz", "confidence": "1" }, @@ -6866,6 +7471,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Detectify", "confidence": "0" }, @@ -6893,6 +7500,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "BSQLBF", "confidence": "1" }, @@ -6920,6 +7529,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "masscan", "confidence": "1" }, @@ -6947,6 +7558,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "WPScan", "confidence": "1" }, @@ -6974,6 +7587,8 @@ "tags": { "type": "commercial_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Aon", "confidence": "0" }, @@ -7001,6 +7616,8 @@ "tags": { "type": "security_scanner", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "confidence": "1" }, "conditions": [ @@ -7014,7 +7631,10 @@ ] } ], - "regex": "mozilla/4\\.0 \\(compatible(; msie 6\\.0; win32)?\\)" + "regex": "mozilla/4\\.0 \\(compatible(; msie (?:6\\.0; win32|4\\.0; Windows NT))?\\)", + "options": { + "case_sensitive": false + } }, "operator": "match_regex" } @@ -7027,6 +7647,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "SQLmap", "confidence": "1" }, @@ -7054,6 +7676,8 @@ "tags": { "type": "attack_tool", "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", "tool_name": "Skipfish", "confidence": "1" }, diff --git a/internal/appsec/rules_manager.go b/internal/appsec/rules_manager.go index 8bf12b1821..769dc1f0f6 100644 --- a/internal/appsec/rules_manager.go +++ b/internal/appsec/rules_manager.go @@ -9,7 +9,7 @@ import ( "encoding/json" "fmt" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" rc "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" ) diff --git a/internal/appsec/waf.go b/internal/appsec/waf.go index fa1fb50758..b6cfa2a828 100644 --- a/internal/appsec/waf.go +++ b/internal/appsec/waf.go @@ -16,13 +16,13 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/grpcsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/httpsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation/sharedsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/samplernames" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/grpcsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/httpsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation/sharedsec" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/samplernames" waf "github.com/DataDog/go-libddwaf" "go.uber.org/atomic" diff --git a/internal/appsec/waf_test.go b/internal/appsec/waf_test.go index 593e43378f..39bb987cb8 100644 --- a/internal/appsec/waf_test.go +++ b/internal/appsec/waf_test.go @@ -16,10 +16,10 @@ import ( "strings" "testing" - pAppsec "gopkg.in/DataDog/dd-trace-go.v1/appsec" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + pAppsec "github.com/DataDog/dd-trace-go/v2/appsec" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/net/http" + "github.com/DataDog/dd-trace-go/v2/ddtrace/mocktracer" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" "github.com/stretchr/testify/require" ) diff --git a/internal/appsec/waf_unit_test.go b/internal/appsec/waf_unit_test.go index f7f041226c..041a3eb1ef 100644 --- a/internal/appsec/waf_unit_test.go +++ b/internal/appsec/waf_unit_test.go @@ -11,7 +11,7 @@ package appsec import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/dyngo/instrumentation" + "github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo/instrumentation" waf "github.com/DataDog/go-libddwaf" "github.com/stretchr/testify/require" diff --git a/internal/datastreams/processor.go b/internal/datastreams/processor.go index 1114f10564..2f57e74b83 100644 --- a/internal/datastreams/processor.go +++ b/internal/datastreams/processor.go @@ -15,10 +15,10 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/datastreams/options" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/datastreams/options" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/DataDog/sketches-go/ddsketch" "github.com/DataDog/sketches-go/ddsketch/mapping" diff --git a/internal/datastreams/processor_test.go b/internal/datastreams/processor_test.go index d7d9798ebd..e04dea9411 100644 --- a/internal/datastreams/processor_test.go +++ b/internal/datastreams/processor_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/DataDog/sketches-go/ddsketch" "github.com/DataDog/sketches-go/ddsketch/store" diff --git a/internal/datastreams/transport.go b/internal/datastreams/transport.go index 62433c7557..c1bc652056 100644 --- a/internal/datastreams/transport.go +++ b/internal/datastreams/transport.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/tinylib/msgp/msgp" ) diff --git a/internal/env.go b/internal/env.go index 7c4ed6c0cd..bbf2864a76 100644 --- a/internal/env.go +++ b/internal/env.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // BoolEnv returns the parsed boolean value of an environment variable, or diff --git a/internal/gitmetadata.go b/internal/gitmetadata.go index 5e6566a6f1..f7eb9b78c3 100644 --- a/internal/gitmetadata.go +++ b/internal/gitmetadata.go @@ -6,6 +6,7 @@ package internal import ( + "net/url" "os" "sync" ) @@ -56,7 +57,7 @@ func updateAllTags(tags map[string]string, newtags map[string]string) { // Get git metadata from environment variables func getTagsFromEnv() map[string]string { return map[string]string{ - TagRepositoryURL: os.Getenv(EnvGitRepositoryURL), + TagRepositoryURL: removeCredentials(os.Getenv(EnvGitRepositoryURL)), TagCommitSha: os.Getenv(EnvGitCommitSha), } } @@ -66,7 +67,7 @@ func getTagsFromDDTags() map[string]string { etags := ParseTagString(os.Getenv(EnvDDTags)) return map[string]string{ - TagRepositoryURL: etags[TagRepositoryURL], + TagRepositoryURL: removeCredentials(etags[TagRepositoryURL]), TagCommitSha: etags[TagCommitSha], TagGoPath: etags[TagGoPath], } @@ -121,3 +122,22 @@ func GetTracerGitMetadataTags() map[string]string { return res } + +// removeCredentials returns the passed url with potential credentials removed. +// If the input string is not a valid URL, the string is returned as is. +func removeCredentials(urlStr string) string { + if urlStr == "" { + return urlStr + } + u, err := url.Parse(urlStr) + if err != nil { + // not an url, nothing to remove + return urlStr + } + if u.User == nil { + // nothing to remove + return urlStr + } + u.User = nil + return u.String() +} diff --git a/internal/gitmetadata_test.go b/internal/gitmetadata_test.go new file mode 100644 index 0000000000..4577674c63 --- /dev/null +++ b/internal/gitmetadata_test.go @@ -0,0 +1,56 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2023 Datadog, Inc. + +package internal + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestRemoveCredentials(t *testing.T) { + testCases := []struct { + name string + in string + expected string + }{ + { + name: "empty url", + in: "", + expected: "", + }, + { + name: "https url without credential", + in: "https://github.com/DataDog/dd-trace-go", + expected: "https://github.com/DataDog/dd-trace-go", + }, + { + name: "ssh url without credential", + in: "git@github.com:DataDog/dd-trace-go.git", + expected: "git@github.com:DataDog/dd-trace-go.git", + }, + { + name: "https url with user", + in: "https://token@github.com/DataDog/dd-trace-go", + expected: "https://github.com/DataDog/dd-trace-go", + }, + { + name: "https url with user and password", + in: "https://user:password@github.com/DataDog/dd-trace-go", + expected: "https://github.com/DataDog/dd-trace-go", + }, + { + name: "invalid url without scheme", + in: "github.com/DataDog/dd-trace-go", + expected: "github.com/DataDog/dd-trace-go", + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.expected, removeCredentials(tc.in)) + }) + } +} diff --git a/internal/gitmetadatabinary.go b/internal/gitmetadatabinary.go index 84ded5eda2..ace38151a3 100644 --- a/internal/gitmetadatabinary.go +++ b/internal/gitmetadatabinary.go @@ -11,7 +11,7 @@ package internal import ( "runtime/debug" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // getTagsFromBinary extracts git metadata from binary metadata diff --git a/internal/gitmetadatabinary_legacy.go b/internal/gitmetadatabinary_legacy.go index 85bcb43cc6..a2fda823ac 100644 --- a/internal/gitmetadatabinary_legacy.go +++ b/internal/gitmetadatabinary_legacy.go @@ -9,7 +9,7 @@ package internal import ( - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // getTagsFromBinary extracts git metadata from binary metadata diff --git a/internal/globalconfig/globalconfig.go b/internal/globalconfig/globalconfig.go index e715954acf..42d01104f1 100644 --- a/internal/globalconfig/globalconfig.go +++ b/internal/globalconfig/globalconfig.go @@ -11,7 +11,7 @@ import ( "math" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/internal" + "github.com/DataDog/dd-trace-go/v2/internal" "github.com/google/uuid" ) diff --git a/internal/hostname/azure/azure.go b/internal/hostname/azure/azure.go index cb07c256a4..185d5f3788 100644 --- a/internal/hostname/azure/azure.go +++ b/internal/hostname/azure/azure.go @@ -11,9 +11,9 @@ import ( "fmt" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/cachedfetch" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/httputils" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/validate" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/cachedfetch" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/httputils" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/validate" ) // declare these as vars not const to ease testing diff --git a/internal/hostname/cachedfetch/fetcher.go b/internal/hostname/cachedfetch/fetcher.go index 17d1a3837c..2cff43caaa 100644 --- a/internal/hostname/cachedfetch/fetcher.go +++ b/internal/hostname/cachedfetch/fetcher.go @@ -12,7 +12,7 @@ import ( "context" "sync" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // Fetcher supports fetching a value, such as from a cloud service API. An diff --git a/internal/hostname/ec2/ec2.go b/internal/hostname/ec2/ec2.go index 42c76ba96d..a1087cab4a 100644 --- a/internal/hostname/ec2/ec2.go +++ b/internal/hostname/ec2/ec2.go @@ -11,8 +11,8 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/cachedfetch" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/httputils" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/cachedfetch" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/httputils" ) // declare these as vars not const to ease testing diff --git a/internal/hostname/ecs/aws.go b/internal/hostname/ecs/aws.go index 2623774b8b..497a5dac3c 100644 --- a/internal/hostname/ecs/aws.go +++ b/internal/hostname/ecs/aws.go @@ -12,8 +12,8 @@ import ( "os" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/cachedfetch" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/httputils" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/cachedfetch" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/httputils" ) // declare these as vars not const to ease testing diff --git a/internal/hostname/gce/gce.go b/internal/hostname/gce/gce.go index e6965d5569..fc015e3b94 100644 --- a/internal/hostname/gce/gce.go +++ b/internal/hostname/gce/gce.go @@ -11,8 +11,8 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/cachedfetch" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/httputils" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/cachedfetch" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/httputils" ) // declare these as vars not const to ease testing diff --git a/internal/hostname/providers.go b/internal/hostname/providers.go index 85c685df2d..d112dac404 100644 --- a/internal/hostname/providers.go +++ b/internal/hostname/providers.go @@ -13,12 +13,12 @@ import ( "sync/atomic" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/azure" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/ec2" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/ecs" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/gce" - "gopkg.in/DataDog/dd-trace-go.v1/internal/hostname/validate" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/azure" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/ec2" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/ecs" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/gce" + "github.com/DataDog/dd-trace-go/v2/internal/hostname/validate" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // For testing purposes diff --git a/internal/hostname/validate/validate.go b/internal/hostname/validate/validate.go index fa97b1c998..67527a0854 100644 --- a/internal/hostname/validate/validate.go +++ b/internal/hostname/validate/validate.go @@ -13,7 +13,7 @@ import ( "regexp" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) const maxLength = 255 diff --git a/internal/httpmem/httpmem_test.go b/internal/httpmem/httpmem_test.go index 9150f6ba7b..1a5b9bb534 100644 --- a/internal/httpmem/httpmem_test.go +++ b/internal/httpmem/httpmem_test.go @@ -9,7 +9,7 @@ import ( "net/http" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/httpmem" + "github.com/DataDog/dd-trace-go/v2/internal/httpmem" ) func TestServerAndClient(t *testing.T) { diff --git a/internal/log/log.go b/internal/log/log.go index b6f732913e..a9a96dbfb9 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -15,7 +15,7 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal/version" ) // Level specifies the logging level that the log package prints at. @@ -100,9 +100,18 @@ var ( func init() { if v := os.Getenv("DD_LOGGING_RATE"); v != "" { - if sec, err := strconv.ParseUint(v, 10, 64); err != nil { - Warn("Invalid value for DD_LOGGING_RATE: %v", err) + setLoggingRate(v) + } +} + +func setLoggingRate(v string) { + if sec, err := strconv.ParseInt(v, 10, 64); err != nil { + Warn("Invalid value for DD_LOGGING_RATE: %v", err) + } else { + if sec < 0 { + Warn("Invalid value for DD_LOGGING_RATE: negative value") } else { + // DD_LOGGING_RATE = 0 allows to log errors immediately. errrate = time.Duration(sec) * time.Second } } diff --git a/internal/log/log_test.go b/internal/log/log_test.go index ce7b84036e..3840d5151b 100644 --- a/internal/log/log_test.go +++ b/internal/log/log_test.go @@ -140,6 +140,42 @@ func TestRecordLoggerIgnore(t *testing.T) { assert.Contains(t, tp.Logs()[0], "appsec") } +func TestSetLoggingRate(t *testing.T) { + testCases := []struct { + input string + result time.Duration + }{ + { + input: "", + result: time.Minute, + }, + { + input: "0", + result: 0 * time.Second, + }, + { + input: "10", + result: 10 * time.Second, + }, + { + input: "-1", + result: time.Minute, + }, + { + input: "this is not a number", + result: time.Minute, + }, + } + for _, tC := range testCases { + tC := tC + errrate = time.Minute // reset global variable + t.Run(tC.input, func(t *testing.T) { + setLoggingRate(tC.input) + assert.Equal(t, tC.result, errrate) + }) + } +} + func BenchmarkError(b *testing.B) { Error("k %s", "a") // warm up cache for i := 0; i < b.N; i++ { diff --git a/internal/namingschema/op_test.go b/internal/namingschema/op_test.go index 865d3a36ad..2829dc57a0 100644 --- a/internal/namingschema/op_test.go +++ b/internal/namingschema/op_test.go @@ -8,7 +8,7 @@ package namingschema_test import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/stretchr/testify/assert" ) diff --git a/internal/namingschema/service_name.go b/internal/namingschema/service_name.go index 6568491791..2136f4b349 100644 --- a/internal/namingschema/service_name.go +++ b/internal/namingschema/service_name.go @@ -5,7 +5,7 @@ package namingschema -import "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" +import "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" // NewDefaultServiceName returns a Schema with the standard logic to be used for contrib span service names // (in-code override > DD_SERVICE environment variable > integration default name). diff --git a/internal/namingschema/service_name_test.go b/internal/namingschema/service_name_test.go index 6f16ade207..91041519dc 100644 --- a/internal/namingschema/service_name_test.go +++ b/internal/namingschema/service_name_test.go @@ -8,8 +8,8 @@ package namingschema_test import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/namingschema" "github.com/stretchr/testify/assert" ) diff --git a/internal/normalizer/normalizer.go b/internal/normalizer/normalizer.go index 80b17cf5d0..542b3d7e1f 100644 --- a/internal/normalizer/normalizer.go +++ b/internal/normalizer/normalizer.go @@ -11,7 +11,7 @@ import ( "regexp" "strings" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" ) // headerTagRegexp is used to replace all invalid characters in the config. Only alphanumerics, whitespaces and dashes allowed. diff --git a/internal/normalizer/normalizer_test.go b/internal/normalizer/normalizer_test.go index 07b45c49f9..2200a44448 100644 --- a/internal/normalizer/normalizer_test.go +++ b/internal/normalizer/normalizer_test.go @@ -8,7 +8,7 @@ package normalizer import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" + "github.com/DataDog/dd-trace-go/v2/ddtrace/ext" "github.com/stretchr/testify/assert" ) diff --git a/internal/remoteconfig/config.go b/internal/remoteconfig/config.go index a80c57b067..f808b6931e 100644 --- a/internal/remoteconfig/config.go +++ b/internal/remoteconfig/config.go @@ -10,10 +10,10 @@ import ( "os" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/version" ) const ( @@ -30,8 +30,6 @@ type ClientConfig struct { Env string // The time interval between two client polls to the agent for updates PollInterval time.Duration - // The products this client is interested in - Products map[string]struct{} // The tracer's runtime id RuntimeID string // The name of the user's application @@ -40,8 +38,6 @@ type ClientConfig struct { TracerVersion string // The base TUF root metadata file TUFRoot string - // The capabilities of the client - Capabilities map[Capability]struct{} // HTTP is the HTTP client used to receive config updates HTTP *http.Client } @@ -49,8 +45,6 @@ type ClientConfig struct { // DefaultClientConfig returns the default remote config client configuration func DefaultClientConfig() ClientConfig { return ClientConfig{ - Capabilities: map[Capability]struct{}{}, - Products: map[string]struct{}{}, Env: os.Getenv("DD_ENV"), HTTP: &http.Client{Timeout: 10 * time.Second}, PollInterval: pollIntervalFromEnv(), diff --git a/internal/remoteconfig/remoteconfig.go b/internal/remoteconfig/remoteconfig.go index 8998c50e93..2400615ead 100644 --- a/internal/remoteconfig/remoteconfig.go +++ b/internal/remoteconfig/remoteconfig.go @@ -10,15 +10,17 @@ import ( "crypto/rand" "encoding/hex" "encoding/json" + "errors" "fmt" "io" "math/big" "net/http" "reflect" "strings" + "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" rc "github.com/DataDog/datadog-agent/pkg/remoteconfig/state" ) @@ -55,6 +57,9 @@ const ( ASMCustomBlockingResponse ) +// ErrClientNotStarted is returned when the remote config client is not started. +var ErrClientNotStarted = errors.New("remote config client not started") + // ProductUpdate represents an update for a specific product. // It is a map of file path to raw file content type ProductUpdate map[string][]byte @@ -62,6 +67,7 @@ type ProductUpdate map[string][]byte // A Client interacts with an Agent to update and track the state of remote // configuration type Client struct { + sync.RWMutex ClientConfig clientID string @@ -69,13 +75,24 @@ type Client struct { repository *rc.Repository stop chan struct{} - callbacks []Callback + callbacks []Callback + products map[string]struct{} + capabilities map[Capability]struct{} lastError error } -// NewClient creates a new remoteconfig Client -func NewClient(config ClientConfig) (*Client, error) { +// client is a RC client singleton that can be accessed by multiple products (tracing, ASM, profiling etc.). +// Using a single RC client instance in the tracer is a requirement for remote configuration. +var client *Client + +var ( + startOnce sync.Once + stopOnce sync.Once +) + +// newClient creates a new remoteconfig Client +func newClient(config ClientConfig) (*Client, error) { repo, err := rc.NewUnverifiedRepository() if err != nil { return nil, err @@ -92,37 +109,63 @@ func NewClient(config ClientConfig) (*Client, error) { stop: make(chan struct{}), lastError: nil, callbacks: []Callback{}, + capabilities: map[Capability]struct{}{}, + products: map[string]struct{}{}, }, nil } -// Start starts the client's update poll loop in a fresh goroutine -func (c *Client) Start() { - go func() { - ticker := time.NewTicker(c.PollInterval) - defer ticker.Stop() - - for { - select { - case <-c.stop: - close(c.stop) - return - case <-ticker.C: - c.updateState() +// Start starts the client's update poll loop in a fresh goroutine. +// Noop if the client has already started. +func Start(config ClientConfig) error { + var err error + startOnce.Do(func() { + client, err = newClient(config) + if err != nil { + return + } + go func() { + ticker := time.NewTicker(client.PollInterval) + defer ticker.Stop() + + for { + select { + case <-client.stop: + close(client.stop) + return + case <-ticker.C: + client.Lock() + client.updateState() + client.Unlock() + } } + }() + }) + return err +} + +// Stop stops the client's update poll loop. +// Noop if the client has already been stopped. +// The remote config client is supposed to have the same lifecycle as the tracer. +// It can't be restarted after a call to Stop() unless explicitly calling Reset(). +func Stop() { + stopOnce.Do(func() { + log.Debug("remoteconfig: gracefully stopping the client") + client.stop <- struct{}{} + select { + case <-client.stop: + log.Debug("remoteconfig: client stopped successfully") + case <-time.After(time.Second): + log.Debug("remoteconfig: client stopping timeout") } - }() + }) } -// Stop stops the client's update poll loop -func (c *Client) Stop() { - log.Debug("remoteconfig: gracefully stopping the client") - c.stop <- struct{}{} - select { - case <-c.stop: - log.Debug("remoteconfig: client stopped successfully") - case <-time.After(time.Second): - log.Debug("remoteconfig: client stopping timeout") - } +// Reset destroys the client instance. +// To be used only in tests to reset the state of the client. +func Reset() { + client = nil + startOnce = sync.Once{} + stopOnce = sync.Once{} } func (c *Client) updateState() { @@ -176,52 +219,110 @@ func (c *Client) updateState() { // RegisterCallback allows registering a callback that will be invoked when the client // receives configuration updates. It is up to that callback to then decide what to do // depending on the product related to the configuration update. -func (c *Client) RegisterCallback(f Callback) { - c.callbacks = append(c.callbacks, f) +func RegisterCallback(f Callback) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() + client.callbacks = append(client.callbacks, f) + return nil } // UnregisterCallback removes a previously registered callback from the active callbacks list // This remove operation preserves ordering -func (c *Client) UnregisterCallback(f Callback) { +func UnregisterCallback(f Callback) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() fValue := reflect.ValueOf(f) - for i, callback := range c.callbacks { + for i, callback := range client.callbacks { if reflect.ValueOf(callback) == fValue { - c.callbacks = append(c.callbacks[:i], c.callbacks[i+1:]...) + client.callbacks = append(client.callbacks[:i], client.callbacks[i+1:]...) } } + return nil } // RegisterProduct adds a product to the list of products listened by the client -func (c *Client) RegisterProduct(p string) { - c.Products[p] = struct{}{} +func RegisterProduct(p string) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() + client.products[p] = struct{}{} + return nil } // UnregisterProduct removes a product from the list of products listened by the client -func (c *Client) UnregisterProduct(p string) { - delete(c.Products, p) +func UnregisterProduct(p string) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() + delete(client.products, p) + return nil +} + +// HasProduct returns whether a given product was registered +func HasProduct(p string) (bool, error) { + if client == nil { + return false, ErrClientNotStarted + } + client.RLock() + defer client.RUnlock() + _, found := client.products[p] + return found, nil } // RegisterCapability adds a capability to the list of capabilities exposed by the client when requesting // configuration updates -func (c *Client) RegisterCapability(cap Capability) { - c.Capabilities[cap] = struct{}{} +func RegisterCapability(cap Capability) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() + client.capabilities[cap] = struct{}{} + return nil } // UnregisterCapability removes a capability from the list of capabilities exposed by the client when requesting // configuration updates -func (c *Client) UnregisterCapability(cap Capability) { - delete(c.Capabilities, cap) +func UnregisterCapability(cap Capability) error { + if client == nil { + return ErrClientNotStarted + } + client.Lock() + defer client.Unlock() + delete(client.capabilities, cap) + return nil +} + +// HasCapability returns whether a given capability was registered +func HasCapability(cap Capability) (bool, error) { + if client == nil { + return false, ErrClientNotStarted + } + client.RLock() + defer client.RUnlock() + _, found := client.capabilities[cap] + return found, nil } func (c *Client) applyUpdate(pbUpdate *clientGetConfigsResponse) error { fileMap := make(map[string][]byte, len(pbUpdate.TargetFiles)) - productUpdates := make(map[string]ProductUpdate, len(c.Products)) - for p := range c.Products { + productUpdates := make(map[string]ProductUpdate, len(c.products)) + for p := range c.products { productUpdates[p] = make(ProductUpdate) } for _, f := range pbUpdate.TargetFiles { fileMap[f.Path] = f.Raw - for p := range c.Products { + for p := range c.products { // Check the config file path to make sure it belongs to the right product if strings.Contains(f.Path, "/"+p+"/") { productUpdates[p][f.Path] = f.Raw @@ -353,11 +454,11 @@ func (c *Client) newUpdateRequest() (bytes.Buffer, error) { } capa := big.NewInt(0) - for i := range c.Capabilities { + for i := range c.capabilities { capa.SetBit(capa, int(i), 1) } - products := make([]string, 0, len(c.Products)) - for p := range c.Products { + products := make([]string, 0, len(c.products)) + for p := range c.products { products = append(products, p) } req := clientGetConfigsRequest{ diff --git a/internal/remoteconfig/remoteconfig_test.go b/internal/remoteconfig/remoteconfig_test.go index 80769ae5cf..b46d40733f 100644 --- a/internal/remoteconfig/remoteconfig_test.go +++ b/internal/remoteconfig/remoteconfig_test.go @@ -28,7 +28,8 @@ import ( func TestRCClient(t *testing.T) { cfg := DefaultClientConfig() cfg.ServiceName = "test" - client, err := NewClient(cfg) + var err error + client, err = newClient(cfg) require.NoError(t, err) t.Run("registerCallback", func(t *testing.T) { @@ -36,18 +37,21 @@ func TestRCClient(t *testing.T) { nilCallback := func(map[string]ProductUpdate) map[string]rc.ApplyStatus { return nil } defer func() { client.callbacks = []Callback{} }() require.Equal(t, 0, len(client.callbacks)) - client.RegisterCallback(nilCallback) + err = RegisterCallback(nilCallback) + require.NoError(t, err) require.Equal(t, 1, len(client.callbacks)) require.Equal(t, 1, len(client.callbacks)) - client.RegisterCallback(nilCallback) + err = RegisterCallback(nilCallback) + require.NoError(t, err) require.Equal(t, 2, len(client.callbacks)) }) t.Run("apply-update", func(t *testing.T) { client.callbacks = []Callback{} cfgPath := "datadog/2/ASM_FEATURES/asm_features_activation/config" - client.RegisterProduct(rc.ProductASMFeatures) - client.RegisterCallback(func(updates map[string]ProductUpdate) map[string]rc.ApplyStatus { + err = RegisterProduct(rc.ProductASMFeatures) + require.NoError(t, err) + err = RegisterCallback(func(updates map[string]ProductUpdate) map[string]rc.ApplyStatus { statuses := map[string]rc.ApplyStatus{} for p, u := range updates { if p == rc.ProductASMFeatures { @@ -59,6 +63,7 @@ func TestRCClient(t *testing.T) { } return statuses }) + require.NoError(t, err) resp := genUpdateResponse([]byte("test"), cfgPath) err := client.applyUpdate(resp) @@ -248,27 +253,36 @@ func dummyCallback4(map[string]ProductUpdate) map[string]rc.ApplyStatus { func TestRegistration(t *testing.T) { t.Run("callbacks", func(t *testing.T) { - client, err := NewClient(DefaultClientConfig()) + var err error + client, err = newClient(DefaultClientConfig()) require.NoError(t, err) - client.RegisterCallback(dummyCallback1) + err = RegisterCallback(dummyCallback1) + require.NoError(t, err) require.Len(t, client.callbacks, 1) - client.UnregisterCallback(dummyCallback1) + err = UnregisterCallback(dummyCallback1) + require.NoError(t, err) require.Empty(t, client.callbacks) - client.RegisterCallback(dummyCallback2) - client.RegisterCallback(dummyCallback3) - client.RegisterCallback(dummyCallback1) - client.RegisterCallback(dummyCallback4) + err = RegisterCallback(dummyCallback2) + require.NoError(t, err) + err = RegisterCallback(dummyCallback3) + require.NoError(t, err) + err = RegisterCallback(dummyCallback1) + require.NoError(t, err) + err = RegisterCallback(dummyCallback4) + require.NoError(t, err) require.Len(t, client.callbacks, 4) - client.UnregisterCallback(dummyCallback1) + err = UnregisterCallback(dummyCallback1) + require.NoError(t, err) require.Len(t, client.callbacks, 3) for _, c := range client.callbacks { require.NotEqual(t, reflect.ValueOf(dummyCallback1), reflect.ValueOf(c)) } - client.UnregisterCallback(dummyCallback3) + err = UnregisterCallback(dummyCallback3) + require.NoError(t, err) require.Len(t, client.callbacks, 2) for _, c := range client.callbacks { require.NotEqual(t, reflect.ValueOf(dummyCallback3), reflect.ValueOf(c)) diff --git a/internal/telemetry/client.go b/internal/telemetry/client.go index 6baa12c4b5..2f449eef2c 100644 --- a/internal/telemetry/client.go +++ b/internal/telemetry/client.go @@ -20,12 +20,12 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - logger "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/osinfo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + logger "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/osinfo" + "github.com/DataDog/dd-trace-go/v2/internal/version" ) // Client buffers and sends telemetry messages to Datadog (possibly through an diff --git a/internal/telemetry/option.go b/internal/telemetry/option.go index 3a0c9ee027..dc826f7184 100644 --- a/internal/telemetry/option.go +++ b/internal/telemetry/option.go @@ -12,7 +12,7 @@ import ( "os" "path/filepath" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" ) // An Option is used to configure the telemetry client's settings diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.go index 29abac4101..ebbf0657ab 100644 --- a/internal/telemetry/telemetry.go +++ b/internal/telemetry/telemetry.go @@ -10,7 +10,7 @@ package telemetry import ( "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec" + "github.com/DataDog/dd-trace-go/v2/internal/appsec" ) // ProductStart signals that the product has started with some configuration diff --git a/internal/telemetry/telemetrytest/telemetrytest.go b/internal/telemetry/telemetrytest/telemetrytest.go index ca31b00254..6381f85dfc 100644 --- a/internal/telemetry/telemetrytest/telemetrytest.go +++ b/internal/telemetry/telemetrytest/telemetrytest.go @@ -9,7 +9,7 @@ package telemetrytest import ( "sync" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" "github.com/stretchr/testify/mock" ) diff --git a/internal/traceprof/testapp/test_app.proto b/internal/traceprof/testapp/test_app.proto index 763136be32..f6169ab05c 100644 --- a/internal/traceprof/testapp/test_app.proto +++ b/internal/traceprof/testapp/test_app.proto @@ -6,7 +6,7 @@ protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=p syntax = "proto3"; -option go_package = "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/testapp"; +option go_package = "github.com/DataDog/dd-trace-go/v2/internal/traceprof/testapp"; package testapp; service TestApp { diff --git a/internal/traceprof/traceproftest/app.go b/internal/traceprof/traceproftest/app.go index e8dbb6ce40..5d29e553d7 100644 --- a/internal/traceprof/traceproftest/app.go +++ b/internal/traceprof/traceproftest/app.go @@ -18,13 +18,13 @@ import ( "testing" "time" - grpctrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc" - httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/julienschmidt/httprouter" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - pb "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/testapp" + grpctrace "github.com/DataDog/dd-trace-go/v2/contrib/google.golang.org/grpc" + httptrace "github.com/DataDog/dd-trace-go/v2/contrib/julienschmidt/httprouter" + "github.com/DataDog/dd-trace-go/v2/ddtrace" + "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/internal/log" + pb "github.com/DataDog/dd-trace-go/v2/internal/traceprof/testapp" "github.com/julienschmidt/httprouter" "github.com/stretchr/testify/require" diff --git a/internal/traceprof/traceproftest/baseline.txt b/internal/traceprof/traceproftest/baseline.txt index 5e0f2ba727..ba9f118bf6 100644 --- a/internal/traceprof/traceproftest/baseline.txt +++ b/internal/traceprof/traceproftest/baseline.txt @@ -1,6 +1,6 @@ goos: linux goarch: amd64 -pkg: gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/traceproftest +pkg: github.com/DataDog/dd-trace-go/v2/internal/traceprof/traceproftest cpu: Intel(R) Xeon(R) Platinum 8275CL CPU @ 3.00GHz BenchmarkEndpointsAndHotspots/direct/hello-world-4 4921081 15785 ns/op 15211 cpu-ns/op 0.01048 pprof-B/op 0.0008820 pprof-samples/op BenchmarkEndpointsAndHotspots/direct/hello-world-4 4892020 15767 ns/op 15132 cpu-ns/op 0.01063 pprof-B/op 0.0008847 pprof-samples/op @@ -48,4 +48,4 @@ BenchmarkEndpointsAndHotspots/grpc/io-bound-4 660 BenchmarkEndpointsAndHotspots/grpc/io-bound-4 656 108724289 ns/op 18297399 cpu-ns/op 13.97 pprof-B/op 1.427 pprof-samples/op BenchmarkEndpointsAndHotspots/grpc/io-bound-4 660 108614401 ns/op 18179128 cpu-ns/op 15.08 pprof-B/op 1.428 pprof-samples/op PASS -ok gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/traceproftest 3690.445s +ok github.com/DataDog/dd-trace-go/v2/internal/traceprof/traceproftest 3690.445s diff --git a/internal/traceprof/traceproftest/endpoints-and-hotspots.txt b/internal/traceprof/traceproftest/endpoints-and-hotspots.txt index 3eaf97a323..482657e936 100644 --- a/internal/traceprof/traceproftest/endpoints-and-hotspots.txt +++ b/internal/traceprof/traceproftest/endpoints-and-hotspots.txt @@ -1,6 +1,6 @@ goos: linux goarch: amd64 -pkg: gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/traceproftest +pkg: github.com/DataDog/dd-trace-go/v2/internal/traceprof/traceproftest cpu: Intel(R) Xeon(R) Platinum 8275CL CPU @ 3.00GHz BenchmarkEndpointsAndHotspots/direct/hello-world-4 3739210 20677 ns/op 20019 cpu-ns/op 0.03021 pprof-B/op 0.001218 pprof-samples/op BenchmarkEndpointsAndHotspots/direct/hello-world-4 3623416 20979 ns/op 20130 cpu-ns/op 0.02966 pprof-B/op 0.001207 pprof-samples/op @@ -48,4 +48,4 @@ BenchmarkEndpointsAndHotspots/grpc/io-bound-4 662 BenchmarkEndpointsAndHotspots/grpc/io-bound-4 662 109110671 ns/op 18681041 cpu-ns/op 41.90 pprof-B/op 1.435 pprof-samples/op BenchmarkEndpointsAndHotspots/grpc/io-bound-4 658 108596149 ns/op 18191310 cpu-ns/op 41.77 pprof-B/op 1.416 pprof-samples/op PASS -ok gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/traceproftest 3712.759s +ok github.com/DataDog/dd-trace-go/v2/internal/traceprof/traceproftest 3712.759s diff --git a/internal/traceprof/traceproftest/traceprof_test.go b/internal/traceprof/traceproftest/traceprof_test.go index 7c7fec4780..97216e714f 100644 --- a/internal/traceprof/traceproftest/traceprof_test.go +++ b/internal/traceprof/traceproftest/traceprof_test.go @@ -17,10 +17,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" - pb "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof/testapp" + "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/internal/traceprof" + pb "github.com/DataDog/dd-trace-go/v2/internal/traceprof/testapp" "github.com/stretchr/testify/require" ) diff --git a/internal/version/version.go b/internal/version/version.go index 8de0d2f97b..5f26ef50f4 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -13,7 +13,7 @@ import ( // Tag specifies the current release tag. It needs to be manually // updated. A test checks that the value of Tag never points to a // git tag that is older than HEAD. -const Tag = "v1.57.0-dev" +const Tag = "v2.0.0-dev" // Dissected version number. Filled during init() var ( diff --git a/profiler/doc.go b/profiler/doc.go index 95f9f50536..ad097e3741 100644 --- a/profiler/doc.go +++ b/profiler/doc.go @@ -5,7 +5,7 @@ // Package profiler periodically collects and sends profiles to the Datadog API. // Use Start to start the profiler. -package profiler // import "gopkg.in/DataDog/dd-trace-go.v1/profiler" +package profiler // import "github.com/DataDog/dd-trace-go/v2/profiler" /* Developer documentation: diff --git a/profiler/example_test.go b/profiler/example_test.go index 1ab451d385..d2bbde8720 100644 --- a/profiler/example_test.go +++ b/profiler/example_test.go @@ -8,7 +8,7 @@ package profiler_test import ( "log" - "gopkg.in/DataDog/dd-trace-go.v1/profiler" + "github.com/DataDog/dd-trace-go/v2/profiler" ) // This example illustrates how to run (and later stop) the Datadog Profiler. diff --git a/profiler/internal/fastdelta/delta_map.go b/profiler/internal/fastdelta/delta_map.go index a5c02c6882..c0cc6304a7 100644 --- a/profiler/internal/fastdelta/delta_map.go +++ b/profiler/internal/fastdelta/delta_map.go @@ -8,7 +8,7 @@ package fastdelta import ( "fmt" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pproflite" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pproflite" "github.com/spaolacci/murmur3" ) diff --git a/profiler/internal/fastdelta/fd.go b/profiler/internal/fastdelta/fd.go index 43d1dd3ec4..0829b36a46 100644 --- a/profiler/internal/fastdelta/fd.go +++ b/profiler/internal/fastdelta/fd.go @@ -65,8 +65,8 @@ import ( "fmt" "io" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pproflite" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pprofutils" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pproflite" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pprofutils" "github.com/spaolacci/murmur3" ) diff --git a/profiler/internal/fastdelta/fd_test.go b/profiler/internal/fastdelta/fd_test.go index 71d4492d8e..93e7114a2c 100644 --- a/profiler/internal/fastdelta/fd_test.go +++ b/profiler/internal/fastdelta/fd_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pprofutils" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pprofutils" "github.com/google/pprof/profile" "github.com/richardartoul/molecule" diff --git a/profiler/internal/fastdelta/fuzz_test.go b/profiler/internal/fastdelta/fuzz_test.go index 01843f4449..10ea730706 100644 --- a/profiler/internal/fastdelta/fuzz_test.go +++ b/profiler/internal/fastdelta/fuzz_test.go @@ -15,7 +15,7 @@ import ( "io" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/fastdelta" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/fastdelta" ) // FuzzDelta looks for inputs to delta which cause crashes. This is to account diff --git a/profiler/internal/fastdelta/hasher.go b/profiler/internal/fastdelta/hasher.go index f882623b5d..0455911949 100644 --- a/profiler/internal/fastdelta/hasher.go +++ b/profiler/internal/fastdelta/hasher.go @@ -11,7 +11,7 @@ import ( "fmt" "sort" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pproflite" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pproflite" "github.com/spaolacci/murmur3" ) diff --git a/profiler/internal/immutable/stringslice_test.go b/profiler/internal/immutable/stringslice_test.go index c8da32ad60..9c52378b9d 100644 --- a/profiler/internal/immutable/stringslice_test.go +++ b/profiler/internal/immutable/stringslice_test.go @@ -8,7 +8,7 @@ package immutable_test import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/immutable" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/immutable" "github.com/stretchr/testify/assert" ) diff --git a/profiler/internal/pproflite/pproflite_test.go b/profiler/internal/pproflite/pproflite_test.go index 128aca0933..96af45029c 100644 --- a/profiler/internal/pproflite/pproflite_test.go +++ b/profiler/internal/pproflite/pproflite_test.go @@ -11,7 +11,7 @@ import ( "path/filepath" "testing" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pproflite" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pproflite" "github.com/google/pprof/profile" "github.com/stretchr/testify/require" diff --git a/profiler/options.go b/profiler/options.go index 9919fef0cc..c7918b2d1a 100644 --- a/profiler/options.go +++ b/profiler/options.go @@ -20,13 +20,13 @@ import ( "time" "unicode" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/osinfo" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/immutable" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/osinfo" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/internal/version" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/immutable" "github.com/DataDog/datadog-go/v5/statsd" ) @@ -113,60 +113,36 @@ type config struct { // logStartup records the configuration to the configured logger in JSON format func logStartup(c *config) { - info := struct { - Date string `json:"date"` // ISO 8601 date and time of start - OSName string `json:"os_name"` // Windows, Darwin, Debian, etc. - OSVersion string `json:"os_version"` // Version of the OS - Version string `json:"version"` // Profiler version - Lang string `json:"lang"` // "Go" - LangVersion string `json:"lang_version"` // Go version, e.g. go1.18 - Hostname string `json:"hostname"` - DeltaProfiles bool `json:"delta_profiles"` - Service string `json:"service"` - Env string `json:"env"` - TargetURL string `json:"target_url"` - Agentless bool `json:"agentless"` - Tags []string `json:"tags"` - ProfilePeriod string `json:"profile_period"` - EnabledProfiles []string `json:"enabled_profiles"` - CPUDuration string `json:"cpu_duration"` - CPUProfileRate int `json:"cpu_profile_rate"` - BlockProfileRate int `json:"block_profile_rate"` - MutexProfileFraction int `json:"mutex_profile_fraction"` - MaxGoroutinesWait int `json:"max_goroutines_wait"` - UploadTimeout string `json:"upload_timeout"` - TraceEnabled bool `json:"execution_trace_enabled"` - TracePeriod string `json:"execution_trace_period"` - TraceSizeLimit int `json:"execution_trace_size_limit"` - EndpointCountEnabled bool `json:"endpoint_count_enabled"` - }{ - Date: time.Now().Format(time.RFC3339), - OSName: osinfo.OSName(), - OSVersion: osinfo.OSVersion(), - Version: version.Tag, - Lang: "Go", - LangVersion: runtime.Version(), - Hostname: c.hostname, - DeltaProfiles: c.deltaProfiles, - Service: c.service, - Env: c.env, - TargetURL: c.targetURL, - Agentless: c.agentless, - Tags: c.tags.Slice(), - ProfilePeriod: c.period.String(), - CPUDuration: c.cpuDuration.String(), - CPUProfileRate: c.cpuProfileRate, - BlockProfileRate: c.blockRate, - MutexProfileFraction: c.mutexFraction, - MaxGoroutinesWait: c.maxGoroutinesWait, - UploadTimeout: c.uploadTimeout.String(), - TraceEnabled: c.traceConfig.Enabled, - TracePeriod: c.traceConfig.Period.String(), - TraceSizeLimit: c.traceConfig.Limit, - EndpointCountEnabled: c.endpointCountEnabled, - } + var enabledProfiles []string for t := range c.types { - info.EnabledProfiles = append(info.EnabledProfiles, t.String()) + enabledProfiles = append(enabledProfiles, t.String()) + } + info := map[string]any{ + "date": time.Now().Format(time.RFC3339), + "os_name": osinfo.OSName(), + "os_version": osinfo.OSVersion(), + "version": version.Tag, + "lang": "Go", + "lang_version": runtime.Version(), + "hostname": c.hostname, + "delta_profiles": c.deltaProfiles, + "service": c.service, + "env": c.env, + "target_url": c.targetURL, + "agentless": c.agentless, + "tags": c.tags.Slice(), + "profile_period": c.period.String(), + "enabled_profiles": enabledProfiles, + "cpu_duration": c.cpuDuration.String(), + "cpu_profile_rate": c.cpuProfileRate, + "block_profile_rate": c.blockRate, + "mutex_profile_fraction": c.mutexFraction, + "max_goroutines_wait": c.maxGoroutinesWait, + "upload_timeout": c.uploadTimeout.String(), + "execution_trace_enabled": c.traceConfig.Enabled, + "execution_trace_period": c.traceConfig.Period.String(), + "execution_trace_size_limit": c.traceConfig.Limit, + "endpoint_count_enabled": c.endpointCountEnabled, } b, err := json.Marshal(info) if err != nil { diff --git a/profiler/options_test.go b/profiler/options_test.go index 26fe306d16..3e7f3fc319 100644 --- a/profiler/options_test.go +++ b/profiler/options_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" "github.com/DataDog/datadog-go/v5/statsd" "github.com/stretchr/testify/assert" diff --git a/profiler/profile.go b/profiler/profile.go index 783b58c6fd..22d43a9c6b 100644 --- a/profiler/profile.go +++ b/profiler/profile.go @@ -8,6 +8,7 @@ package profiler import ( "bytes" "compress/gzip" + "context" "errors" "fmt" "io" @@ -15,8 +16,8 @@ import ( "runtime/trace" "time" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/fastdelta" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pprofutils" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/fastdelta" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pprofutils" "github.com/DataDog/gostackparse" pprofile "github.com/google/pprof/profile" @@ -194,6 +195,7 @@ var profileTypes = map[ProfileType]profileType{ if err := trace.Start(lt); err != nil { return nil, err } + traceLogCPUProfileRate(p.cfg.cpuProfileRate) select { case <-p.exit: // Profiling was stopped case <-time.After(p.cfg.period): // The profiling cycle has ended @@ -205,6 +207,19 @@ var profileTypes = map[ProfileType]profileType{ }, } +// traceLogCPUProfileRate logs the cpuProfileRate to the execution tracer if +// its not 0. This gives us a better chance to correctly guess the CPU duration +// of traceEvCPUSample events. It will not work correctly if the user is +// calling runtime.SetCPUProfileRate() themselves, and there is no way to +// handle this scenario given the current APIs. See +// https://github.com/golang/go/issues/60701 for a proposal to improve the +// situation. +func traceLogCPUProfileRate(cpuProfileRate int) { + if cpuProfileRate != 0 { + trace.Log(context.Background(), "cpuProfileRate", fmt.Sprintf("%d", cpuProfileRate)) + } +} + // defaultExecutionTraceSizeLimit is the default upper bound, in bytes, // of an executiont trace. // diff --git a/profiler/profile_test.go b/profiler/profile_test.go index 0cde6e5bec..e26a2c73c8 100644 --- a/profiler/profile_test.go +++ b/profiler/profile_test.go @@ -14,7 +14,7 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/profiler/internal/pprofutils" + "github.com/DataDog/dd-trace-go/v2/profiler/internal/pprofutils" pprofile "github.com/google/pprof/profile" "github.com/stretchr/testify/assert" diff --git a/profiler/profiler.go b/profiler/profiler.go index a48ed9d979..4cb752e18f 100644 --- a/profiler/profiler.go +++ b/profiler/profiler.go @@ -16,9 +16,9 @@ import ( "sync" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" ) // outChannelSize specifies the size of the profile output channel. diff --git a/profiler/profiler_test.go b/profiler/profiler_test.go index f9200c2c43..64da681dfa 100644 --- a/profiler/profiler_test.go +++ b/profiler/profiler_test.go @@ -6,10 +6,12 @@ package profiler import ( + "bytes" "context" "encoding/json" "fmt" "io" + "math/rand" "net" "net/http" "net/http/httptest" @@ -20,10 +22,10 @@ import ( "testing" "time" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/httpmem" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - "gopkg.in/DataDog/dd-trace-go.v1/internal/traceprof" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/httpmem" + "github.com/DataDog/dd-trace-go/v2/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/traceprof" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -480,12 +482,22 @@ func TestExecutionTrace(t *testing.T) { server := httptest.NewServer(&mockBackend{t: t, profiles: got}) defer server.Close() + // cpuProfileRate is picked randomly so we can check for it in the trace + // data to reduce the chance that it occurs in the trace data for some other + // reduce. In theory we could use the entire int64 space, but when we do + // this the runtime can crash with the error shown below. + // + // runtime: kevent on fd 3 failed with 60 + // fatal error: runtime: netpoll failed + cpuProfileRate := int(9999 + rand.Int63n(9999)) + t.Setenv("DD_PROFILING_EXECUTION_TRACE_ENABLED", "true") t.Setenv("DD_PROFILING_EXECUTION_TRACE_PERIOD", "3s") err := Start( WithAgentAddr(server.Listener.Addr().String()), WithProfileTypes(CPUProfile), WithPeriod(1*time.Second), + CPUProfileRate(int(cpuProfileRate)), ) require.NoError(t, err) defer Stop() @@ -504,6 +516,7 @@ func TestExecutionTrace(t *testing.T) { t.Log(m.event.Attachments, m.tags) if contains(m.event.Attachments, "go.trace") && contains(m.tags, "go_execution_traced:yes") { seenTraces++ + assertContainsCPUProfileRateLog(t, m.attachments["go.trace"], cpuProfileRate) } } // With a trace frequency of 3 seconds and a profiling period of 1 @@ -514,6 +527,13 @@ func TestExecutionTrace(t *testing.T) { } } +// assertContainsCPUProfileRateLog checks for the presence of the log written by +// traceLogCPUProfileRate. It's a bit hacky, but probably good enough for now :). +func assertContainsCPUProfileRateLog(t *testing.T, traceData []byte, cpuProfileRate int) { + assert.True(t, bytes.Contains(traceData, []byte("cpuProfileRate"))) + assert.True(t, bytes.Contains(traceData, []byte(fmt.Sprintf("%d", cpuProfileRate)))) +} + // TestEndpointCounts verfies that the unit of work feature works end to end. func TestEndpointCounts(t *testing.T) { for _, enabled := range []bool{true, false} { diff --git a/profiler/telemetry.go b/profiler/telemetry.go index 7ed6ca82ea..af51eae8f3 100644 --- a/profiler/telemetry.go +++ b/profiler/telemetry.go @@ -6,7 +6,7 @@ package profiler import ( - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" ) // startTelemetry starts the global instrumentation telemetry client with profiler data diff --git a/profiler/telemetry_test.go b/profiler/telemetry_test.go index 155b16d33c..b5ad5bc683 100644 --- a/profiler/telemetry_test.go +++ b/profiler/telemetry_test.go @@ -8,9 +8,9 @@ package profiler import ( "testing" - "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry" - "gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry/telemetrytest" + "github.com/DataDog/dd-trace-go/v2/ddtrace/tracer" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry" + "github.com/DataDog/dd-trace-go/v2/internal/telemetry/telemetrytest" "github.com/stretchr/testify/assert" ) diff --git a/profiler/upload.go b/profiler/upload.go index 7fc221d69a..6a9386ca7e 100644 --- a/profiler/upload.go +++ b/profiler/upload.go @@ -19,7 +19,7 @@ import ( "strings" "time" - "gopkg.in/DataDog/dd-trace-go.v1/internal/log" + "github.com/DataDog/dd-trace-go/v2/internal/log" ) // maxRetries specifies the maximum number of retries to have when an error occurs. diff --git a/profiler/upload_test.go b/profiler/upload_test.go index 13070d68b0..4ca668779c 100644 --- a/profiler/upload_test.go +++ b/profiler/upload_test.go @@ -17,9 +17,9 @@ import ( "testing" "time" - maininternal "gopkg.in/DataDog/dd-trace-go.v1/internal" - "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" - "gopkg.in/DataDog/dd-trace-go.v1/internal/version" + maininternal "github.com/DataDog/dd-trace-go/v2/internal" + "github.com/DataDog/dd-trace-go/v2/internal/globalconfig" + "github.com/DataDog/dd-trace-go/v2/internal/version" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -230,6 +230,26 @@ func TestGitMetadata(t *testing.T) { assert.Contains(profile.tags, "git.repository_url:github.com/user/repo") assert.Contains(profile.tags, "go_path:somepath") }) + t.Run("git-metadata-from-dd-tags-with-credentials", func(t *testing.T) { + maininternal.ResetGitMetadataTags() + t.Setenv(maininternal.EnvDDTags, "git.commit.sha:123456789ABCD git.repository_url:http://u@github.com/user/repo go_path:somepath") + + profiles := make(chan profileMeta, 1) + server := httptest.NewServer(&mockBackend{t: t, profiles: profiles}) + defer server.Close() + p, err := unstartedProfiler( + WithAgentAddr(server.Listener.Addr().String()), + ) + require.NoError(t, err) + err = p.doRequest(testBatch) + require.NoError(t, err) + profile := <-profiles + + assert := assert.New(t) + assert.Contains(profile.tags, "git.commit.sha:123456789ABCD") + assert.Contains(profile.tags, "git.repository_url:http://github.com/user/repo") + assert.Contains(profile.tags, "go_path:somepath") + }) t.Run("git-metadata-from-env", func(t *testing.T) { maininternal.ResetGitMetadataTags() t.Setenv(maininternal.EnvDDTags, "git.commit.sha:123456789ABCD git.repository_url:github.com/user/repo") @@ -253,6 +273,26 @@ func TestGitMetadata(t *testing.T) { assert.Contains(profile.tags, "git.commit.sha:123456789ABCDE") assert.Contains(profile.tags, "git.repository_url:github.com/user/repo_new") }) + t.Run("git-metadata-from-env-with-credentials", func(t *testing.T) { + maininternal.ResetGitMetadataTags() + t.Setenv(maininternal.EnvGitRepositoryURL, "https://u@github.com/user/repo_new") + t.Setenv(maininternal.EnvGitCommitSha, "123456789ABCDE") + + profiles := make(chan profileMeta, 1) + server := httptest.NewServer(&mockBackend{t: t, profiles: profiles}) + defer server.Close() + p, err := unstartedProfiler( + WithAgentAddr(server.Listener.Addr().String()), + ) + require.NoError(t, err) + err = p.doRequest(testBatch) + require.NoError(t, err) + profile := <-profiles + + assert := assert.New(t) + assert.Contains(profile.tags, "git.commit.sha:123456789ABCDE") + assert.Contains(profile.tags, "git.repository_url:https://github.com/user/repo_new") + }) t.Run("git-metadata-disabled", func(t *testing.T) { maininternal.ResetGitMetadataTags() diff --git a/test.sh b/test.sh index a968390fd6..5f34e95c8e 100755 --- a/test.sh +++ b/test.sh @@ -75,7 +75,7 @@ fi if [[ ! -z "$lint" ]]; then echo "Running Linter" - goimports -e -l -local gopkg.in/DataDog/dd-trace-go.v1 . + goimports -e -l -local github.com/DataDog/dd-trace-go/v2 . fi if [[ "$INTEGRATION" != "" ]]; then