Skip to content

Commit 9f70c7a

Browse files
authored
fix(active_job): Consumer span op should be queue.process (#3021)
1 parent 3ddf4a9 commit 9f70c7a

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

sentry-rails/lib/sentry/rails/active_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def already_supported_by_sentry_integration?
6767
end
6868

6969
class SentryReporter
70-
OP_NAME = "queue.active_job"
70+
OP_NAME = "queue.process"
7171
SPAN_ORIGIN = "auto.queue.active_job"
7272

7373
EVENT_HANDLERS = {

sentry-rails/spec/active_job/shared_examples/tracing/consumer_transaction.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
expect(transaction.transaction).to eq(successful_job.name)
1515
expect(transaction.transaction_info).to eq(source: :task)
16-
expect(transaction.contexts.dig(:trace, :op)).to eq("queue.active_job")
16+
expect(transaction.contexts.dig(:trace, :op)).to eq("queue.process")
1717
expect(transaction.contexts.dig(:trace, :origin)).to eq("auto.queue.active_job")
1818
expect(transaction.contexts.dig(:trace, :status)).to eq("ok")
1919
end

sentry-rails/spec/active_job/shared_examples/tracing/messaging_span_data.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def perform
5151
retried_job.perform_later
5252
drain
5353

54-
consumer_txns = transactions.select { |t| t.contexts.dig(:trace, :op) == "queue.active_job" }
54+
consumer_txns = transactions.select { |t| t.contexts.dig(:trace, :op) == "queue.process" }
5555
retry_counts = consumer_txns.map { |t| t.contexts.dig(:trace, :data, "messaging.message.retry.count") }
5656
expect(retry_counts).to eq([0, 0, 1])
5757
end

sentry-rails/spec/active_job/support/harness.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def transactions
149149
end
150150

151151
def consumer_transaction
152-
transactions.find { |t| t.contexts.dig(:trace, :op) == "queue.active_job" }
152+
transactions.find { |t| t.contexts.dig(:trace, :op) == "queue.process" }
153153
end
154154

155155
def within_parent_transaction(name: "parent.test", op: "test")

sentry-rails/spec/sentry/rails/active_job_hub_isolation_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def perform
2828
job_event = events.find { |e| e.is_a?(Sentry::ErrorEvent) && e.message == "from-job" }
2929
request_event = events.find { |e| e.is_a?(Sentry::ErrorEvent) && e.message == "from-request-after" }
3030
consumer_transaction = events.find do |e|
31-
e.is_a?(Sentry::TransactionEvent) && e.contexts.dig(:trace, :op) == "queue.active_job"
31+
e.is_a?(Sentry::TransactionEvent) && e.contexts.dig(:trace, :op) == "queue.process"
3232
end
3333

3434
expect(job_event).not_to be_nil

spec/features/active_job_tracing_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# The browser SDK's browserTracing integration propagates sentry-trace +
77
# baggage to the Rails request; the Rails AJ extension emits a
88
# queue.publish span on the http.server transaction at enqueue, and a
9-
# queue.active_job consumer transaction when the :async pool runs the
9+
# queue.process consumer transaction when the :async pool runs the
1010
# job. All three rails-side artifacts must share one trace.
1111
RSpec.describe "ActiveJob distributed tracing", type: :e2e do
1212
it "links the browser fetch, the controller, the producer span, and the consumer transaction into one trace" do
@@ -43,7 +43,7 @@
4343
# Consumer transaction continued the same trace and is parented on
4444
# the publish span.
4545
expect(job_txn.dig("contexts", "trace", "trace_id")).to eq(incoming_trace_id)
46-
expect(job_txn.dig("contexts", "trace", "op")).to eq("queue.active_job")
46+
expect(job_txn.dig("contexts", "trace", "op")).to eq("queue.process")
4747
expect(job_txn.dig("contexts", "trace", "parent_span_id")).to eq(publish_span["span_id"])
4848
expect(job_txn.dig("contexts", "trace", "data", "messaging.message.id"))
4949
.to eq(publish_span.dig("data", "messaging.message.id"))
@@ -71,7 +71,7 @@ def wait_for_trace(timeout: 10)
7171

7272
trace_id = http_txn.dig("contexts", "trace", "trace_id")
7373
job_txn = transactions.find do |t|
74-
t.dig("contexts", "trace", "op") == "queue.active_job" &&
74+
t.dig("contexts", "trace", "op") == "queue.process" &&
7575
t.dig("contexts", "trace", "trace_id") == trace_id
7676
end
7777
return [http_txn, job_txn] if job_txn

0 commit comments

Comments
 (0)