Class: Analytics::Glql::LoggingService

Inherits:
Object
  • Object
show all
Defined in:
app/services/analytics/glql/logging_service.rb

Overview

Service for logging GLQL/GraphQL execution metrics and performance data Logs to GraphQL logger for monitoring, optimization, and debugging Used by both REST API::Glql (with GLQL-specific details) and Glql::BaseController (GraphQL only)

Instance Method Summary collapse

Constructor Details

#initialize(current_user:, result:, query_sha:, glql_query: nil, generated_graphql: nil, fields: nil, context: nil) ⇒ LoggingService

Returns a new instance of LoggingService.



9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/analytics/glql/logging_service.rb', line 9

def initialize(
  current_user:, result:, query_sha:, glql_query: nil, generated_graphql: nil, fields: nil,
  context: nil)
  @current_user = current_user
  @result = result
  @query_sha = query_sha
  @glql_query = glql_query
  @generated_graphql = generated_graphql
  @fields = fields
  @context = context
end

Instance Method Details

#executeObject



21
22
23
24
25
# File 'app/services/analytics/glql/logging_service.rb', line 21

def execute
  log_timeout if timeout_occurred?
  log_high_complexity if high_complexity?
  log_slow_query if slow_query?
end