Skip to content

Commit

Permalink
feat: log API client (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Nov 11, 2024
1 parent 174637f commit 60c44e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/app/controllers/graphql_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def execute
trace_mode: Analytics.get_trace_mode(request),
request_ip: request.remote_ip,
query_type: headers['dgidb-query-type'],
client_name: headers['dgidb-client-name'],
genes_search_mode: headers['dgidb-genes-search-mode']
}
result = DgidbSchema.execute(query, variables: variables, context:, operation_name: operation_name)
Expand Down
3 changes: 2 additions & 1 deletion server/app/lib/api_analytics_tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ def analyze_query(query: )
params = {
user_ip: query.context[:request_ip],
query: query.query_string.squish,
query_variables: query.provided_variables
query_variables: query.provided_variables,
client_type: query.context[:client_name]
}

API_LOGGER.info(params)
Expand Down

0 comments on commit 60c44e3

Please sign in to comment.