Skip to content

Commit b34c6ec

Browse files
authored
Enable queue tracing by default (#903)
1 parent f6f5248 commit b34c6ec

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

config/sentry.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
// Performance monitoring specific configuration
7878
'tracing' => [
7979
// Trace queue jobs as their own transactions (this enables tracing for queue jobs)
80-
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),
80+
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', true),
8181

8282
// Capture queue jobs as spans when executed on the sync driver
8383
'queue_jobs' => env('SENTRY_TRACE_QUEUE_JOBS_ENABLED', true),

test/Sentry/Features/QueueIntegrationTest.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -87,46 +87,46 @@ public function testQueueJobsWithBreadcrumbSetInBetweenKeepsNonJobBreadcrumbsOnC
8787
$this->assertCount(1, $this->getCurrentSentryBreadcrumbs());
8888
}
8989

90-
protected function withoutSampling($app): void
90+
protected function withTracingEnabled($app): void
9191
{
9292
$app['config']->set('sentry.traces_sample_rate', 1.0);
9393
}
9494

9595
/**
96-
* @define-env withoutSampling
96+
* @define-env withTracingEnabled
9797
*/
98-
public function testQueueJobDoesntCreateTransactionByDefault(): void
98+
public function testQueueJobCreatesTransactionByDefault(): void
9999
{
100100
dispatch(new QueueEventsTestJob);
101101

102102
$transaction = $this->getLastSentryEvent();
103103

104-
$this->assertNull($transaction);
104+
$this->assertNotNull($transaction);
105+
106+
$this->assertEquals(EventType::transaction(), $transaction->getType());
107+
$this->assertEquals(QueueEventsTestJob::class, $transaction->getTransaction());
108+
109+
$traceContext = $transaction->getContexts()['trace'];
110+
111+
$this->assertEquals('queue.process', $traceContext['op']);
105112
}
106113

107-
protected function withQueueJobTracingEnabled($app): void
114+
protected function withQueueJobTracingDisabled($app): void
108115
{
109116
$app['config']->set('sentry.traces_sample_rate', 1.0);
110-
$app['config']->set('sentry.tracing.queue_job_transactions', true);
117+
$app['config']->set('sentry.tracing.queue_job_transactions', false);
111118
}
112119

113120
/**
114-
* @define-env withQueueJobTracingEnabled
121+
* @define-env withQueueTracingDisabled
115122
*/
116-
public function testQueueJobCreatesTransactionWhenEnabled(): void
123+
public function testQueueJobDoesntCreateTransaction(): void
117124
{
118125
dispatch(new QueueEventsTestJob);
119126

120127
$transaction = $this->getLastSentryEvent();
121128

122-
$this->assertNotNull($transaction);
123-
124-
$this->assertEquals(EventType::transaction(), $transaction->getType());
125-
$this->assertEquals(QueueEventsTestJob::class, $transaction->getTransaction());
126-
127-
$traceContext = $transaction->getContexts()['trace'];
128-
129-
$this->assertEquals('queue.process', $traceContext['op']);
129+
$this->assertNull($transaction);
130130
}
131131
}
132132

0 commit comments

Comments
 (0)