Class: Spree::Diagnostics

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree/diagnostics.rb,
app/services/spree/diagnostics/stack.rb,
app/services/spree/diagnostics/section.rb,
app/services/spree/diagnostics/sections.rb,
app/services/spree/diagnostics/error_log.rb

Overview

An anonymised description of this installation for bug reports: versions, stack, store setup by prefixed ID, providers, changed settings and recent Spree errors. The rake task, the Admin API and the CLI all render this one report, so what a maintainer reads is the same wherever it came from.

report = Spree::Diagnostics.report(store: Spree::Current.store)
puts report.to_markdown

Defined Under Namespace

Modules: Sections, Stack Classes: ErrorLog, Report, Section

Constant Summary collapse

ISSUE_URL =
'https://github.com/spree/spree/issues/new?template=bug_report.yml'.freeze
MAX_ISSUE_URL_LENGTH =

GitHub refuses very long URLs; past this the issue form opens empty and the report is pasted by hand.

6000

Class Method Summary collapse

Class Method Details

.report(store: Spree::Store.default, extra_sections: [], errors: true) ⇒ Spree::Diagnostics::Report

Parameters:

  • store (Spree::Store) (defaults to: Spree::Store.default)
  • extra_sections (Array<Hash>) (defaults to: []) —

    what only the caller can see, as { title:, rows: { label => value } } — the CLI's tooling, the dashboard's browser

  • errors (Boolean) (defaults to: true) —

    false to leave recent errors out, as spree info does: it runs in its own process, which rarely sees the server's error log

Returns:



101
102
103
104
# File 'app/services/spree/diagnostics.rb', line 101

def report(store: Spree::Store.default, extra_sections: [], errors: true)
  Report.new(generated_at: Time.current, errors: (recent_errors if errors),
             sections: sections_for(store) + extra_sections.map { |section| extra_section(section) })
end