Skip to content

Commit

Permalink
tracing: default span registry to false
Browse files Browse the repository at this point in the history
This forced real spans to be created across the board, explaining most of the tracing overhead we saw[^1].

[^1]: cockroachdb#133307
  • Loading branch information
tbg committed Nov 18, 2024
1 parent 127172b commit 81ef237
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings-for-tenants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ timeseries.storage.resolution_30m.ttl duration 2160h0m0s the maximum age of time
trace.debug_http_endpoint.enabled (alias: trace.debug.enable) boolean false if set, traces for recent requests can be seen at https://<ui>/debug/requests application
trace.opentelemetry.collector string address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as <host>:<port>. If no port is specified, 4317 will be used. application
trace.snapshot.rate duration 0s if non-zero, interval at which background trace snapshots are captured application
trace.span_registry.enabled boolean true if set, ongoing traces can be seen at https://<ui>/#/debug/tracez application
trace.span_registry.enabled boolean false if set, ongoing traces can be seen at https://<ui>/#/debug/tracez application
trace.zipkin.collector string the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used. application
ui.database_locality_metadata.enabled boolean true if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute application
ui.display_timezone enumeration etc/utc the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1] application
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
<tr><td><div id="setting-trace-debug-enable" class="anchored"><code>trace.debug_http_endpoint.enabled<br />(alias: trace.debug.enable)</code></div></td><td>boolean</td><td><code>false</code></td><td>if set, traces for recent requests can be seen at https://&lt;ui&gt;/debug/requests</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-opentelemetry-collector" class="anchored"><code>trace.opentelemetry.collector</code></div></td><td>string</td><td><code></code></td><td>address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as &lt;host&gt;:&lt;port&gt;. If no port is specified, 4317 will be used.</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-snapshot-rate" class="anchored"><code>trace.snapshot.rate</code></div></td><td>duration</td><td><code>0s</code></td><td>if non-zero, interval at which background trace snapshots are captured</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-span-registry-enabled" class="anchored"><code>trace.span_registry.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if set, ongoing traces can be seen at https://&lt;ui&gt;/#/debug/tracez</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-span-registry-enabled" class="anchored"><code>trace.span_registry.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>if set, ongoing traces can be seen at https://&lt;ui&gt;/#/debug/tracez</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-zipkin-collector" class="anchored"><code>trace.zipkin.collector</code></div></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as &lt;host&gt;:&lt;port&gt;. If no port is specified, 9411 will be used.</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-ui-database-locality-metadata-enabled" class="anchored"><code>ui.database_locality_metadata.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1]</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/tests/autocommit_extended_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ func TestErrorDuringExtendedProtocolCommit(t *testing.T) {

s, db, _ := serverutils.StartServer(t, params)
defer s.Stopper().Stop(ctx)
// This forces a trace span to have been set up in the BeforeExecute
// interceptor above.
s.Tracer().SetActiveSpansRegistryEnabled(true)

conn, err := db.Conn(ctx)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/tracing/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ var EnableActiveSpansRegistry = settings.RegisterBoolSetting(
settings.ApplicationLevel,
"trace.span_registry.enabled",
"if set, ongoing traces can be seen at https://<ui>/#/debug/tracez",
envutil.EnvOrDefaultBool("COCKROACH_REAL_SPANS", true),
envutil.EnvOrDefaultBool("COCKROACH_REAL_SPANS", false),
settings.WithPublic)

var periodicSnapshotInterval = settings.RegisterDurationSetting(
Expand Down Expand Up @@ -667,7 +667,7 @@ func NewTracerWithOpt(ctx context.Context, opts ...TracerOption) *Tracer {
t.spanReusePercent = *o.spanReusePercent
}
t.testing = o.knobs
t.SetActiveSpansRegistryEnabled(o.tracingDefault != TracingModeOnDemand)
t.SetActiveSpansRegistryEnabled(o.tracingDefault == TracingModeActiveSpansRegistry)
if o.sv != nil {
t.configure(ctx, o.sv, o.tracingDefault)
forceVerboseSpanRegexp.SetOnChange(o.sv, func(ctx context.Context) {
Expand Down

0 comments on commit 81ef237

Please sign in to comment.