From 1f37aed1c917260eefda63a18d3a9af91c4a1abb Mon Sep 17 00:00:00 2001 From: charlieablett Date: Tue, 30 Apr 2019 20:30:15 +1200 Subject: New logfile for graphql queries Specify dedicated logfile and logger class for GraphQL queries. Move complexity analyzer to a dedicated class. --- lib/gitlab/graphql_logger.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/gitlab/graphql_logger.rb (limited to 'lib/gitlab/graphql_logger.rb') diff --git a/lib/gitlab/graphql_logger.rb b/lib/gitlab/graphql_logger.rb new file mode 100644 index 00000000000..aff3ff5f48d --- /dev/null +++ b/lib/gitlab/graphql_logger.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Gitlab + class GraphqlLogger < Gitlab::Logger + def self.file_name_noext + 'graphql_json' + end + + # duration + # complexity + # depth + # sanitized variables (?) + # a structured representation of the query (?) + + def format_message(severity, timestamp, progname, msg) + "#{timestamp.to_s(:long)}: #{msg}\n" + end + end +end -- cgit v1.2.1 From 2c011cb5b452409db7fe1c810f1ad7440a6cedce Mon Sep 17 00:00:00 2001 From: charlieablett Date: Thu, 2 May 2019 12:16:49 +1200 Subject: Implement logger analyzer - Modify GraphqlLogger to subclass JsonLogger - Replace the single-line analyser with one that can log all the GraphQL query related information in one place. - Implement analyzer behavior with spec --- lib/gitlab/graphql_logger.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'lib/gitlab/graphql_logger.rb') diff --git a/lib/gitlab/graphql_logger.rb b/lib/gitlab/graphql_logger.rb index aff3ff5f48d..43d917908b6 100644 --- a/lib/gitlab/graphql_logger.rb +++ b/lib/gitlab/graphql_logger.rb @@ -1,19 +1,9 @@ # frozen_string_literal: true module Gitlab - class GraphqlLogger < Gitlab::Logger + class GraphqlLogger < Gitlab::JsonLogger def self.file_name_noext 'graphql_json' end - - # duration - # complexity - # depth - # sanitized variables (?) - # a structured representation of the query (?) - - def format_message(severity, timestamp, progname, msg) - "#{timestamp.to_s(:long)}: #{msg}\n" - end end end -- cgit v1.2.1