Files
logpile/bible-local/06-parsers.md
T
Mikhail ChusavitinandClaude Sonnet 5 475318fc2b refactor: extract parsers and Redfish replay/analysis to external module
logpile no longer carries its own archive/vendor parsers or Redfish
raw-payload replay/analysis engine. Both now live in
git.mchus.pro/reanimator/parser/v13 (already used by the sibling `core`
project), reached through parser.NewService().AnalyzeArchivePayload /
AnalyzeRedfishRawPayloads. logpile keeps live BMC/Redfish collection,
the DB, exporter, server and UI.

- Deleted internal/parser/ (interface, registry, archive extraction,
  all vendor packages), internal/collector/redfish_replay*.go (replay
  engine, confirmed near-identical to the module's redfish/ package),
  internal/ingest/ (pure duplicate of the module's Service),
  internal/models/ (repointed every import to the module's models
  package instead), and internal/rar5 (only used by the deleted
  archive extractor). Removed the now-unused third_party/pciids
  submodule.
- internal/collector/redfish.go: Collect() now calls
  parser.NewService().AnalyzeRedfishRawPayloads(...) at the one place
  it used to call the local ReplayRedfishFromRawPayloads (an existing
  "unified tunnel" between live collection and raw import). A
  deadcode-driven pass then removed ~150 doc-to-model conversion
  helpers in redfish.go that duplicated the module's redfish/ package
  and were already unreachable before this change; kept the small
  generic dedup/scoring helpers the live crawler still calls.
- internal/collector/redfishprofile/ stays whole: Collect() depends on
  it directly for acquisition-time tuning. Its analysis-only methods
  (ApplyAnalysisProfiles/PostAnalyze) are now dead but left in place
  rather than splitting the package's single Profile interface.
- pciids moved with the module (now a public package there); logpile's
  live collector and exporter import it from there instead of keeping
  a local copy.
- go.mod: new require on git.mchus.pro/reanimator/parser/v13 v13.0.0
  (plain module dependency, not a submodule like reanimator/chart,
  since this module is independently versioned and shared with core).
- bible-local docs rewritten for the new boundary; see ADL-080.

See also the companion change in git.mchus.pro/reanimator/parser
(tagged v13.0.0): new top-level exports
(IsSupportedArchiveFilename/SupportedArchiveExtensions/
ParseInDefaultArchiveLocation/PrivacyScanEnabled) and pciids moved to
a public package, both needed to complete this migration.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 12:59:39 +03:00

3.6 KiB

06 — Parsers

Parsers live in a separate module

All archive/vendor-format parsing and the Redfish raw-payload replay/analysis engine live in git.mchus.pro/reanimator/parser/v13 (a plain Go module dependency, see ADL-2026-10-08). logpile does not implement or register parsers itself anymore.

The vendor coverage matrix, detection rules, per-vendor data-quality notes, and the VendorParser contract are documented in that repository's own bible-local/ (06-parsers.md equivalent, decisions log) — read it there, not here, when working on parsing/interpretation behavior. This file only covers the boundary: what logpile owns, what it hands to the module, and what comes back.

What logpile still owns

  • Live BMC/Redfish collection (internal/collector/redfish.go): crawling, HTTP session handling, prefetch/recovery, telemetry — everything that talks to a real BMC.
  • Acquisition-time tuning (internal/collector/redfishprofile/): CollectSignals, MatchProfiles, BuildAcquisitionPlan, ResolveAcquisitionPlan decide worker counts, which paths to prefetch, and retry/post-probe policy during the crawl. This package also still carries ApplyAnalysisProfiles/PostAnalyze and their supporting types, which are now unreachable in logpile (that half of the package is exercised only inside the parser module's own copy) — left in place rather than split out, since the package's Profile interface bundles both concerns and splitting it would just duplicate work already done once on extraction.
  • The web server, DB layer, exporter, and UI/visualization.
  • A small local dedup/scoring helper set in internal/collector/redfish_dedup.go (dedupeRedfishPaths, redfishHostSystemScore, lastRedfishPathSegment) — generic utilities the live crawler needs directly; also present inside the parser module's own copy of the same logic, intentionally duplicated rather than shared, since the module does not expose internal packages.

What the module owns and how logpile calls it

Two entry points on git.mchus.pro/reanimator/parser/v13's Service:

  • Service.AnalyzeArchivePayload(filename string, payload []byte) (*models.AnalysisResult, string, error) — uploaded archive parsing. Used by internal/server/handlers.go (upload flow) and cmd/logpile-cpu-audit.
  • Service.AnalyzeRedfishRawPayloads(rawPayloads map[string]any, meta RedfishSourceMetadata) (*models.AnalysisResult, string, error) — the single call at the end of RedfishConnector.Collect() (internal/collector/redfish.go): the crawl builds a raw rawPayloads tree (redfish_tree, redfish_profiles, redfish_telemetry, redfish_fetch_errors, redfish_log_entries, redfish_debug_payloads), then hands it to the module for the actual doc-to-model interpretation. This same call point also serves raw Redfish-tree archive imports (live_redfish source in handlers.go), so live collection and offline raw-tree import share one analyzer, one interpretation.

Top-level helpers also used directly: ListParsersInfo(), IsSupportedArchiveFilename(), SupportedArchiveExtensions(), ParseInDefaultArchiveLocation(), PrivacyScanEnabled(), and the pciids package (git.mchus.pro/reanimator/parser/v13/pciids) for PCI vendor/device name lookups in both the live collector and the exporter.

models package

git.mchus.pro/reanimator/parser/v13/models is used directly everywhere in logpile; there is no local internal/models anymore (fully repointed, 2026-10-08). The module's models package is kept strictly additive against what logpile used to define, so this needed no adapter.