You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/appsec.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,7 @@ jobs:
149
149
echo "Skipped: env CGO_ENABLED=$cgo $appsec_enabled_env $cgocheck_env go test -v . (submodule: $submodule, reason: gin-gonic/gin depends on leodido/go-urn that causes an internal compiler when GOEXPERIMENT=cgocheck2)"
150
150
continue
151
151
fi
152
+
152
153
cd $submodule
153
154
if ! env CGO_ENABLED=$cgo $appsec_enabled_env $cgocheck_env go test -v .; then
154
155
echo "Failed: env CGO_ENABLED=$cgo $appsec_enabled_env $cgocheck_env go test -v . (submodule: $submodule)"
Copy file name to clipboardExpand all lines: MIGRATING.md
+65-11Lines changed: 65 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Migration Guide
1
+
# Migration guide
2
2
3
3
This document outlines migrating from an older version of the Datadog tracer (v1.x.x) to v2.
4
4
@@ -10,7 +10,7 @@ We have also provided a new migration tool to help with the most essential chang
10
10
11
11
Our [godoc page](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/ddtrace) should be helpful during this process. We also have the [official documentation](https://docs.datadoghq.com/tracing/setup/go/), which contains a couple of examples.
12
12
13
-
This document will further outline some _before_ and _after_ examples.
13
+
Please follow this guide for migrating from v1 to v2 and creating new services using v2 directly. This document will further outline some _before_ and _after_ examples.
It is important to note that when using our contrib libraries, import URLs may be impacted differently. This will be covered in the next section:
29
+
It is important to run `go mod tidy` after changing any import.
30
30
31
-
### Independent Contrib Packages
31
+
It is also important to note that when using our contrib libraries, import URLs may be impacted differently. This will be covered in the section below [Independent contrib packages](#independent-contrib-packages).
32
+
33
+
### Gradual code repair
34
+
35
+
For customers that have large codebases and that are unable to immediately upgrade services to the v2 tracer, we are offering a special transitional version of the v1 tracer, the [v1 transitional version](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1@v1.74.0) which is essentially a wrapper that preserves the API from v1 but uses v2 under the hood.
36
+
37
+
It’s safe for different services within your organization to use different tracer versions during the transition, some can use v1 while others adopt v2. Staggering the upgrade per service can minimize downtime and help ensure stability throughout your transition.
38
+
39
+
The transitional version is the only v1 version that allows both v1 and v2 to be imported in the same service, which enables you to migrate a service gradually. Using this v1 transitional version doesn’t require any code changes, but it also won’t support any new features introduced in v2.
40
+
41
+
When using the v1 transitional version, it is possible to gradually migrate a codebase to v2 by replacing imports and adapting the instrumentation to the new API file by file.
42
+
43
+
### Independent contrib packages
32
44
33
45
This version upgrade comes with a large overhaul of what was previously one single package that held all of our integrations. In v2, we introduce independent packages for each of our contribs, which will prevent false-positives in security scanners that were caused by indirect dependencies. As a result, importing contribs will also change. Before:
34
46
@@ -59,7 +71,7 @@ var sp *tracer.Span = tracer.StartSpan("opname")
59
71
varctx *tracer.SpanContext = sp.Context()
60
72
```
61
73
62
-
### Deprecated ddtrace interfaces
74
+
### Deprecated `ddtrace` interfaces
63
75
64
76
All the interfaces in `ddtrace` have been removed in favor of struct types, except for `SpanContext`. The new types have moved into `ddtrace/tracer`.
65
77
@@ -126,7 +138,7 @@ fmt.Printf("traceID: %d\n", sp.Context().TraceIDLower()) // for maintaining old
126
138
127
139
## WithService
128
140
129
-
The previously deprecated `tracer.WithServiceName()` has been fully removed and replaced with the method `tracer.WithService()`. If you would like to specify a service name upon starting the tracer, you would have before:
141
+
The previously deprecated `tracer.WithServiceName` has been fully removed and replaced with the method `tracer.WithService`. If you would like to specify a service name upon starting the tracer, you would have before:
`tracer.WithDogstatsdAddr` has been renamed as `tracer.WithDogstatsdAddress`. If you would like to specify a different DogStatsD address upon starting the tracer, you would have before:
`tracer.WithAgentURL` sets the address by URL where the agent is located, in addition to the existing `WithAgentAddr` option. It is useful for setups where the agent is listening to a Unix Domain Socket:
These functional options for `ddtrace/tracer.Tracer.StartSpan` and `ddtrace/tracer.Span.Finish` reduces the number of calls (in functional option form) in hot loops by giving the freedom to prepare a common span configuration in hot paths.
@@ -197,7 +231,7 @@ Also, `ext.SamplingPriority` tag is deprecated. Use `ext.ManualKeep` and `ext.Ma
197
231
198
232
A support package to create contribs without depending on internal packages is available in `instrumentation`. Please refer to [`instrumentation` godoc page](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/instrumentation) and existing contribs for more detail.
199
233
200
-
## Updated User Monitoring SDK for Appsec
234
+
## Updated User Monitoring SDK for `appsec`
201
235
202
236
`appsec` package offers a new API for user monitoring; essentially deprecating login success & failure event functions, replacing them with versions that accept a `login` field, which is to be used by user monitoring rules (ATO monitoring & protection). Before:
203
237
@@ -221,6 +255,26 @@ The API Security sampler now takes decisions specific to a given endpoint (metho
221
255
222
256
`opentracer` is in "Maintenance" mode and limited support was offered in `v1`. We recommend to use OpenTelemetry or ddtrace/tracer directly. For additional details, please see our [Support Policy](https://github.com/DataDog/dd-trace-go?tab=readme-ov-file#go-support-policy).
223
257
258
+
## SQLCommentInjectionMode deprecation for DBM
259
+
260
+
`SQLCommentInjectionMode` values have been replaced by `DBMPropagationMode` values. Before:
261
+
262
+
```go
263
+
SQLInjectionUndefined // SQLInjectionUndefined represents the comment injection mode is not set. This is the same as SQLInjectionDisabled.
264
+
SQLInjectionDisabled // SQLInjectionDisabled represents the comment injection mode where all injection is disabled.
265
+
SQLInjectionModeService // SQLInjectionModeService represents the comment injection mode where only service tags (name, env, version) are injected.
266
+
SQLInjectionModeFull // SQLInjectionModeFull represents the comment injection mode where both service tags and tracing tags. Tracing tags include span id, trace id and sampling priority.
267
+
```
268
+
269
+
After:
270
+
271
+
```go
272
+
DBMPropagationModeUndefined // DBMPropagationModeUndefined represents the dbm propagation mode not being set. This is the same as DBMPropagationModeDisabled.
273
+
DBMPropagationModeDisabled // DBMPropagationModeDisabled represents the dbm propagation mode where all propagation is disabled.
274
+
DBMPropagationModeService // DBMPropagationModeService represents the dbm propagation mode where only service tags (name, env, version) are propagated to dbm.
275
+
DBMPropagationModeFull // DBMPropagationModeFull represents the dbm propagation mode where both service tags and tracing tags are propagated. Tracing tags include span id, trace id and the sampled flag.
276
+
```
277
+
224
278
## Further reading
225
279
226
280
* package level documentation of the [`tracer` package](https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/ddtrace/tracer) for a better overview.
0 commit comments