Skip to content

Commit aea04dc

Browse files
authored
docs(go): Add unreleased SDK options and Scope.SetAttributes (#16789)
1 parent bbc2733 commit aea04dc

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

docs/platforms/go/common/configuration/options.mdx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ When set to `true`, the SDK does not emit metrics. By default, metrics are enabl
142142

143143
</SdkOption>
144144

145+
## Client Reports Options
146+
147+
<SdkOption name="DisableClientReports" type="bool" defaultValue="false">
148+
149+
When set to `true`, the SDK does not send client reports. Client reports track the number of discarded events and their reasons, helping you monitor SDK health. By default, client reports are enabled.
150+
151+
</SdkOption>
152+
145153
## Tracing Options
146154

147155
<SdkOption name="EnableTracing" type="bool" defaultValue="false">
@@ -150,7 +158,7 @@ Enables performance tracing. When enabled, the SDK will create transactions and
150158

151159
</SdkOption>
152160

153-
<SdkOption name="TracesSampleRate" type="float64" defaultValue="0.0" envVar="SENTRY_TRACES_SAMPLE_RATE">
161+
<SdkOption name="TracesSampleRate" type="float64" defaultValue="0.0">
154162

155163
A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. Either this or `TracesSampler` must be defined to enable tracing.
156164

@@ -191,6 +199,18 @@ When set to `true`, the W3C Trace Context HTTP `traceparent` header is propagate
191199

192200
</SdkOption>
193201

202+
<SdkOption name="StrictTraceContinuation" type="bool" defaultValue="false">
203+
204+
When set to `true`, the SDK requires matching organization IDs in the incoming baggage header for continuing a trace. This is useful for preventing trace continuation from 3rd-party services that happen to be instrumented by Sentry but belong to a different organization.
205+
206+
</SdkOption>
207+
208+
<SdkOption name="OrgID" type="uint64">
209+
210+
Configures the organization ID used for trace propagation and features like `StrictTraceContinuation`. In most cases, the organization ID is already parsed from the DSN. This option should be used when non-standard Sentry DSNs are used, such as self-hosted or when using a local Relay.
211+
212+
</SdkOption>
213+
194214
<SdkOption name="TraceIgnoreStatusCodes" type="[][]int">
195215

196216
A list of HTTP status codes that should not be traced. Each element can be either:
@@ -301,6 +321,12 @@ An optional set of SSL certificates to use. See the [Providing SSL Certificates]
301321

302322
</SdkOption>
303323

324+
<SdkOption name="DisableTelemetryBuffer" type="bool" defaultValue="false">
325+
326+
When set to `true`, disables the telemetry buffer layer for prioritizing events and uses the legacy transport layer instead.
327+
328+
</SdkOption>
329+
304330
### Providing SSL Certificates
305331

306332
By default, TLS uses the host's root CA set. If you don't have `ca-certificates` (which should be your go-to way of fixing the issue of the missing certificates) and want to use `gocertifi` instead, you can provide pre-loaded cert files as one of the options to the `sentry.Init` call:

docs/platforms/go/common/enriching-events/scopes/index.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,28 @@ On the other hand, <PlatformIdentifier name="with-scope" /> creates a clone of t
7171
made will stay isolated within the <PlatformIdentifier name="with-scope" /> callback function. This allows you to
7272
more easily isolate pieces of context information to specific locations in your code or
7373
even call <PlatformIdentifier name="clear" /> to briefly remove all context information.
74+
75+
## Setting Attributes
76+
77+
You can set typed attributes on the scope using `SetAttributes`. These attributes are attached to logs and metrics emitted within the scope. Attributes use the `attribute` package for type safety.
78+
79+
```go
80+
import "github.com/getsentry/sentry-go/attribute"
81+
82+
sentry.ConfigureScope(func(scope *sentry.Scope) {
83+
scope.SetAttributes(
84+
attribute.String("user.role", "admin"),
85+
attribute.Int("retry.count", 3),
86+
attribute.Bool("feature.enabled", true),
87+
attribute.Float64("score", 99.5),
88+
)
89+
})
90+
```
91+
92+
To remove an attribute from the scope, use `RemoveAttribute`:
93+
94+
```go
95+
sentry.ConfigureScope(func(scope *sentry.Scope) {
96+
scope.RemoveAttribute("user.role")
97+
})
98+
```

0 commit comments

Comments
 (0)