Module: LogStruct::Integrations::GoodJob

Extended by:
IntegrationInterface, T::Sig
Defined in:
lib/log_struct/integrations/good_job.rb,
lib/log_struct/integrations/good_job/logger.rb,
lib/log_struct/integrations/good_job/log_subscriber.rb

Overview

GoodJob integration for structured logging

GoodJob is a PostgreSQL-based ActiveJob backend that provides reliable, scalable job processing for Rails applications. This integration provides structured logging for all GoodJob operations.

Features:

  • Structured logging for job execution lifecycle
  • Error tracking and retry logging
  • Performance metrics and timing data
  • Database operation logging
  • Thread and process tracking
  • Custom GoodJob logger with LogStruct formatting

Integration Points:

  • Replaces GoodJob.logger with LogStruct-compatible logger
  • Subscribes to GoodJob's ActiveSupport notifications
  • Captures job execution events, errors, and performance metrics
  • Logs database operations and connection information

Configuration:

The integration is automatically enabled when GoodJob is detected and LogStruct configuration allows it. It can be disabled by setting:

config.integrations.enable_goodjob = false

Defined Under Namespace

Classes: LogSubscriber, Logger

Class Method Summary collapse

Methods included from IntegrationInterface

setup

Class Method Details

.setup(config) ⇒ Boolean?

Set up GoodJob structured logging

This method configures GoodJob to use LogStruct's structured logging by replacing the default logger and subscribing to job events.

Parameters:

Returns:

  • (Boolean, nil)

    Returns true if setup was successful, nil if skipped



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/log_struct/integrations/good_job.rb', line 54

def self.setup(config)
  return nil unless defined?(::GoodJob)
  return nil unless config.enabled
  return nil unless config.integrations.enable_goodjob

  # Replace GoodJob's logger with our structured logger
  configure_logger

  # Subscribe to GoodJob's ActiveSupport notifications
  subscribe_to_notifications

  true
end