Skip to content

Commit

Permalink
Merge pull request #7 from Shopify/remove-query-string-from-query-ext…
Browse files Browse the repository at this point in the history
…racted

Remove query_string from query_extracted
  • Loading branch information
swalkinshaw committed Dec 10, 2018
2 parents b580a42 + 0fe6310 commit c823541
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
1 change: 0 additions & 1 deletion lib/graphql_metrics/extractor.rb
Expand Up @@ -97,7 +97,6 @@ def extract_query

query_extracted_method.call(
{
query_string: query.document.to_query_string,
operation_type: query.selected_operation.operation_type,
operation_name: query.selected_operation_name,
duration: duration
Expand Down
1 change: 0 additions & 1 deletion test/redis_instrumentation.rb
Expand Up @@ -10,7 +10,6 @@ def query_extracted(metrics, _metadata)
@redis.lpush(
'query_extracted',
{
query_string: metrics[:query_string],
operation_type: metrics[:operation_type],
operation_name: metrics[:operation_name],
duration: metrics[:duration],
Expand Down
14 changes: 0 additions & 14 deletions test/unit/instrumentation_test.rb
Expand Up @@ -89,12 +89,9 @@ def self.resolve_type(_type, obj, _ctx)
batch_loaded_fields: extract_from_redis('batch_loaded_field_extracted'),
}

normalize_query_string_in_actual(actual)

expected = {
queries: [
{
query_string: normalize_query_string(query_string),
operation_type: "query",
operation_name: "MyQuery",
duration: 0
Expand Down Expand Up @@ -205,12 +202,9 @@ def self.resolve_type(_type, obj, _ctx)
batch_loaded_fields: extract_from_redis('batch_loaded_field_extracted'),
}

normalize_query_string_in_actual(actual)

expected = {
queries: [
{
query_string: normalize_query_string(query_string),
operation_type: "mutation",
operation_name: "MyMutation",
duration: 0
Expand Down Expand Up @@ -462,12 +456,4 @@ def minimal_query
def extract_from_redis(key)
@redis.lrange(key, 0, -1).map { |v| eval v }.reverse
end

def normalize_query_string_in_actual(actual)
actual[:queries].first[:query_string] = normalize_query_string(actual[:queries].first[:query_string])
end

def normalize_query_string(query_string)
query_string.gsub(/\n/, ' ').squish
end
end

0 comments on commit c823541

Please sign in to comment.