Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To enable GraphQL support, add the included Tracer to your schema:
class MySchema < GraphQL::Schema
# ...

tracer ElasticAPM::GraphQL # <-- include this
trace_with ElasticAPM::GraphQL # <-- include this
end
```

1 change: 0 additions & 1 deletion docs/release-notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,3 @@ All notable changes to this project will be documented here. This project adhere
* AWS S3 spy accepts symbol bucket names [#998](https://github.com/elastic/apm-agent-ruby/pull/998)
* AWS S3 spy passing on blocks [#998](https://github.com/elastic/apm-agent-ruby/pull/998)
* SQL scanner now recognizes CQL style comments [#1004](https://github.com/elastic/apm-agent-ruby/pull/1004)

Comment thread
smith marked this conversation as resolved.
8 changes: 8 additions & 0 deletions lib/elastic_apm/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ module GraphQL
# "authorized" => "graphql.authorized",
}.freeze

KEYS_TO_NAME.each_key do |trace_method|
module_eval <<-RUBY, __FILE__, __LINE__
def #{trace_method}(**data)
::ElasticAPM::GraphQL.trace("#{trace_method}", data) { super }
end
RUBY
end

# rubocop:disable Style/ExplicitBlockArgument
def self.trace(key, data)
return yield unless KEYS_TO_NAME.key?(key)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/graphql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def post(slug:)

class GraphQLTestAppSchema < GraphQL::Schema
query QueryType
tracer ElasticAPM::GraphQL
trace_with ElasticAPM::GraphQL
end
end

Expand Down
Loading