Skip to content

Commit 882c709

Browse files
authored
Merge pull request rmosolgo#4460 from zvkemp/fix-active-support-notifications-multiplex
add `execute_multiplex.graphql` to NotificationsTrace
2 parents 27762aa + 30dbea6 commit 882c709

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/graphql/tracing.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
require "graphql/tracing/prometheus_tracing"
1515

1616
# New Tracing:
17+
require "graphql/tracing/active_support_notifications_trace"
1718
require "graphql/tracing/platform_trace"
1819
require "graphql/tracing/appoptics_trace"
1920
require "graphql/tracing/appsignal_trace"

lib/graphql/tracing/notifications_trace.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require "graphql/tracing/platform_trace"
4+
35
module GraphQL
46
module Tracing
57
# This implementation forwards events to a notification handler (i.e.
@@ -20,6 +22,7 @@ def initialize(engine:, **rest)
2022
"validate" => "validate.graphql",
2123
"analyze_multiplex" => "analyze_multiplex.graphql",
2224
"analyze_query" => "analyze_query.graphql",
25+
"execute_multiplex" => "execute_multiplex.graphql",
2326
"execute_query" => "execute_query.graphql",
2427
"execute_query_lazy" => "execute_query_lazy.graphql",
2528
"execute_field" => "execute_field.graphql",

spec/graphql/tracing/notifications_trace_spec.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,25 @@ class Schema < GraphQL::Schema
1919

2020
describe "Observing" do
2121
it "dispatchs the event to the notifications engine with suffixed key" do
22-
dispatched_events = trigger_fake_notifications_tracer(NotificationsTraceTest::Schema)
22+
dispatched_events = trigger_fake_notifications_tracer(NotificationsTraceTest::Schema).to_h
2323

2424
assert dispatched_events.length > 0
2525

26+
expected_event_keys = [
27+
'execute_multiplex.graphql',
28+
'analyze_multiplex.graphql',
29+
'lex.graphql',
30+
'parse.graphql',
31+
'validate.graphql',
32+
'analyze_query.graphql',
33+
'execute_query.graphql',
34+
'authorized.graphql',
35+
'execute_field.graphql',
36+
'execute_query_lazy.graphql'
37+
]
38+
39+
assert_equal expected_event_keys, dispatched_events.keys
40+
2641
dispatched_events.each do |event, payload|
2742
assert event.end_with?(".graphql")
2843
assert payload.is_a?(Hash)

0 commit comments

Comments
 (0)