Skip to content

Rename trace-dispatcher → hermod-tracing-{core,api,prometheus} and restructure package split#16

Open
jutaro wants to merge 35 commits into
masterfrom
jutaro/trace-dispatcher-api
Open

Rename trace-dispatcher → hermod-tracing-{core,api,prometheus} and restructure package split#16
jutaro wants to merge 35 commits into
masterfrom
jutaro/trace-dispatcher-api

Conversation

@jutaro

@jutaro jutaro commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts a new thin package from trace-dispatcher, restructures its internal module layout, renames both packages and their module namespaces as part of the hermod-tracing rebranding, extracts Prometheus support into its own optional package, restores trace-dispatcher as a backward-compatible mirror, and updates all consumers accordingly.

Motivation

Previously all tracing types, combinators, and backends lived inside trace-dispatcher. Any package that only needed to instrument its own code — define LogFormatting/MetaTrace instances and call traceWith — was forced to depend on the full backend stack (EKG, Prometheus, CBOR forwarding, async, YAML config parser, …). The split makes the stable API surface available as a lightweight dependency, and keeps the Prometheus TCP server fully opt-in.

Changes

Package split and module restructuring

A new thin package (hermod-tracing-api) was extracted from trace-dispatcher. It contains only what a package needs to define trace types and emit messages, and is itself split into two sublibraries:

  • hermod-tracing-api:internalHermod.Tracing.Types (the Trace carrier, TraceControl GADT, LogFormatting/MetaTrace typeclasses, and the full TraceConfig/BackendConfig dependency chain) and Hermod.Tracing.Trace/Trace.Combinators (structural and annotation combinators).
  • hermod-tracing-api:publicHermod.Tracing.API, a single-import front door that wraps the internal combinators with ergonomic signatures (contramapM/contramapMCond take (a -> m b), filterTrace takes (a -> Bool), foldTraceM/foldCondTraceM take (acc -> a -> m acc)) and hides LoggingContext/TraceControl from callers entirely. Annotation combinators (setSeverity, withPrivacy, withNames, …) stay internal to hermod-tracing-core, since they aren't part of the minimal type-definition surface.

Build-depends for hermod-tracing-api is kept deliberately small: no async, bytestring, cborg-json, time, or YAML.

The two original large files (Types.hs at 568 lines, Trace.hs at 389 lines) were further divided along natural seams into 7 focused modules. The dependency graph is a strict DAG with no cycles.

Package and namespace renames

Old name New name
trace-dispatcher hermod-tracing-{api,core,prometheus}
Cardano.Logging.* Hermod.Tracing.*

trace-dispatcher itself has been restored as a backward-compatible mirror of origin/master's copy (wired back into cabal.project, CODEOWNERS, and the Nix ecosystem), so existing pinned consumers keep building unchanged.

New package: hermod-tracing-prometheus

The Prometheus TCP server backend (Exposition, NetworkRun, TCPServer) has been extracted from hermod-tracing-core into a standalone optional package. Deps exclusive to the Prometheus server (hashable, http-date, time-manager, unix-compat) are removed from hermod-tracing-core and moved here.

Identifier and field renames

Old New
mkCardanoTracer / mkCardanoTracer' mkHermodTracer / mkHermodTracer'
TraceDispatcherMessage HermodTracingMessage
setupTraceDispatcher (recon) setupHermodTracing
TRACE_DISPATCHER_LOGGING_HOSTNAME HERMOD_TRACING_LOGGING_HOSTNAME
PrometheusM constructor LabelSetM
presentPrometheusM (internal, EKG) presentLabelSetM
TraceConfig.tcNodeName tcApplicationName
ConfigRepresentation.traceOptionNodeName (internal) traceOptionApplicationName

CounterM's field type changed from Maybe Int to CounterAction (CounterIncrement / CounterAdd) for clarity of intent. contramap was made strict; contramap' and >!$!< were removed. routingTrace and contramapM' were briefly dropped during the public-API simplification pass and routingTrace was restored, since its signature never leaked LoggingContext/TraceControl and there was no reason to remove it; contramapM' stays removed.

Hermod.Tracing.Types.NodeInfo and Hermod.Tracing.Types.NodeStartupInfo were removed from hermod-tracing-core (cardano-node–specific types with no generic utility), and the contra-tracer version bound was loosened from ^>= 0.2.1 to unconstrained.

Configuration format changes

  • Hermod.Tracing.ConfigurationParser gained ConfigSource (FromFile/FromStrictBytes/FromLazyBytes/FromJSONObject), replacing the bare FilePath parameter of readConfiguration and related functions — configs can now be ingested from a file, a strict/lazy ByteString, or a pre-parsed Aeson.Object.
  • The legacy top-level config format ("TraceOptions"/"TraceOptionForwarder"/"TraceOptionResourceFrequency"/…) has been dropped; only the "HermodTracing"-wrapped and flattened top-level formats are now accepted.
  • TraceConfig's tcResourceFrequency/tcLedgerMetricsFrequency (Maybe Int, milliseconds) are replaced by a single generalized tcPeriodicTracers :: Map Text Word64, mapping an arbitrary periodic-tracer identifier to a cardinal number interpreted in an application-specific (potentially per-identifier) timeunit, parsed from/emitted to a "PeriodicTracers" JSON object.
  • Added a test that parses the example doc/config.json and checks it against the expected TraceConfig.

hermod-recon-framework updated

  • Dependency updated from trace-dispatcher to hermod-tracing-core + hermod-tracing-prometheus.
  • All Cardano.Logging.* imports replaced with Hermod.Tracing.*.
  • Dead CPP backward-compatibility guards (gated on MIN_VERSION_trace_dispatcher) removed.
  • CLI flag renamed: --trace-dispatcher-cfg--hermod-tracing-cfg.

hermod-trace-resources updated

  • Dependency updated from trace-dispatcher to hermod-tracing-core.
  • Cardano.Logging import updated to Hermod.Tracing.

Versioning

hermod-tracing-api, hermod-tracing-core, and hermod-tracing-prometheus are bumped to 1.0.0, with CHANGELOGs reframed as initial releases based on trace-dispatcher-2.13.0.

Docs and config cleaned up

  • UseTraceDispatcher config key removed everywhere (no longer applicable).
  • "Transition Period" section removed from the tracing-core design doc.
  • Stale references to trace-dispatcher, iohk-monitoring, and Cardano.Logging updated throughout READMEs, CHANGELOGs, and doc files.
  • CODEOWNERS updated to reflect all renamed and new packages.

Compatibility

trace-dispatcher continues to exist (restored as a mirror of origin/master's copy) and exports the same surface, so existing consumers keep building unchanged until they migrate to hermod-tracing-*.

@jutaro jutaro force-pushed the jutaro/trace-dispatcher-api branch from e5fd150 to a4d50d8 Compare June 19, 2026 13:32
@Russoul Russoul force-pushed the jutaro/trace-dispatcher-api branch from 3f14c2c to 8e5ad8c Compare June 25, 2026 06:14
@Russoul Russoul changed the title Introduce trace-dispatcher-api and restructure the package split Rename trace-dispatcher → hermod-tracing-{core,api} and restructure package split Jun 25, 2026
@Russoul Russoul changed the title Rename trace-dispatcher → hermod-tracing-{core,api} and restructure package split Rename trace-dispatcher → hermod-tracing-{core,api, prometheus} and restructure package split Jun 29, 2026
@Russoul Russoul changed the title Rename trace-dispatcher → hermod-tracing-{core,api, prometheus} and restructure package split Rename trace-dispatcher → hermod-tracing-{core,api,prometheus} and restructure package split Jun 29, 2026
@Russoul Russoul marked this pull request as ready for review June 29, 2026 06:19
@Russoul Russoul requested a review from a team June 29, 2026 06:19
@Russoul Russoul force-pushed the jutaro/trace-dispatcher-api branch 2 times, most recently from eaf1cd9 to f370299 Compare July 2, 2026 10:09
jutaro and others added 17 commits July 2, 2026 14:31
The trace-dispatcher-api / trace-dispatcher split was too coarse: output types
(FormattedMessage, TraceObject, PreFormatted), the forwarder connection type
(HowToConnect/Host/Port), and several utility/domain modules lived in the API
package despite having no business being there — they pulled in bytestring, async,
cborg-json, and time as transitive API dependencies.

Moved to trace-dispatcher:

FormattedMessage, TraceObject, PreFormatted → Cardano.Logging.Formatter
HowToConnect, Host, Port → Cardano.Logging.Tracer.Forward
Cardano.Logging.Utils, Types.NodeInfo, Types.NodeStartupInfo, Types.TraceMessage
trace-dispatcher-api now exposes exactly two modules (Cardano.Logging.Types,
Cardano.Logging.Trace) covering the Trace newtype, the LogFormatting/MetaTrace
typeclasses, core combinators, and the TraceControl dependency chain. Removed four
no-longer-needed build-depends (async, bytestring, cborg-json, time).

New Cardano.Logging.API is added as the single-import front door for the package,
re-exporting both modules with a module haddock that explains the two-tier role and
guides users toward Cardano.Logging (from trace-dispatcher) when they need the
full backend stack.

Cardano.Logging (the trace-dispatcher mega-module) gains a three-step usage
haddock and no longer re-exports FrequencyLimiter or TraceDispatcherMessage, which
are internal implementation details.
Fold in the follow-up CI fixes: drop stale hermod-trace-resources
references, rename limitFrequency to maxFrequency, and give
Cardano.Logging.API an explicit export list with exactly the approved
functions.
All source modules in trace-dispatcher and trace-dispatcher-api
relocated from Cardano.Logging.* to Hermod.Tracing.*, with matching
directory moves and cabal module lists updated throughout.

CHANGELOG for trace-dispatcher updated; CHANGELOG for
trace-dispatcher-api created and wired into its cabal file.
Directory, cabal file, and package name updated. All references
updated in cabal.project, trace-dispatcher's build-depends, and the
Nix perSystem files (packages.nix, devShells.nix, project.nix).
CHANGELOGs updated accordingly.
Directory, cabal file, package name, test suite name, benchmark name,
and doc file updated throughout. All references updated in:
cabal.project, hermod-tracing-api's cabal/Haddock/CHANGELOG,
perSystem Nix files, root README, and source comments.
Replace trace-dispatcher dependency with hermod-tracing-core in all
three build-depends stanzas (library, hermod-recon, hermod-recon-grep).

Update all Cardano.Logging.* imports to Hermod.Tracing.*:
- Hermod.ReCon.LTL.Formula.Pretty: Cardano.Logging → Hermod.Tracing
- Hermod.ReCon.Trace.Event: Cardano.Logging.Types.TraceMessage → Hermod.Tracing.Types.TraceMessage
- Hermod.ReCon.Trace.Feed: same
- app/Hermod/ReCon.hs: Cardano.Logging → Hermod.Tracing.*; remove
  dead CPP backward-compat guards gated on MIN_VERSION_trace_dispatcher
- app/Hermod/ReCon/TraceMessage.hs: Cardano.Logging → Hermod.Tracing.*
- app/Hermod/ReConGrep.hs: Cardano.Logging.Types.TraceMessage → Hermod.Tracing.Types.TraceMessage
Update parser function, CliOptions field, and help text throughout.
- Update CODEOWNERS: add hermod-tracing-{core,api,recon-framework}, remove trace-dispatcher
- Remove UseTraceDispatcher config key and Transition Period section from doc
- Replace remaining trace-dispatcher/iohk-monitoring/dispatcher wording in READMEs and doc
- Update hermod-recon-framework CHANGELOG and README for CLI flag and import renames
Also add hermod-tracing-api to hermod-tracing-prometheus's build-depends.
- setupTraceDispatcher → setupHermodTracing in hermod-recon
- TRACE_DISPATCHER_LOGGING_HOSTNAME env var → HERMOD_TRACING_LOGGING_HOSTNAME
- trace-dispatcher references in hermod-trace-resources README → hermod-tracing
@Russoul Russoul force-pushed the jutaro/trace-dispatcher-api branch from c2f81df to adbd74a Compare July 2, 2026 10:43
Russoul added 3 commits July 2, 2026 14:47
Wire it back into cabal.project, CODEOWNERS, and the Nix ecosystem.
The constructor PrometheusM in Hermod.Tracing.Types.Annotations and the
internal helper presentPrometheusM in Hermod.Tracing.Tracer.EKG are renamed
to LabelSetM / presentLabelSetM to remove Prometheus-specific naming from
the core API layer.
Replaces the untyped Maybe Int with the explicit CounterAction sum type
(CounterIncrement / CounterAdd), making the intent clear at the call site.
Russoul and others added 10 commits July 2, 2026 14:47
- Drop cardano-node integration section, cardano-tracer prose, and
  cardano-node-wiki links from hermod-tracing-core.md
- Replace remaining cardano-specific wording with generic equivalents
  in doc, DocuGenerator.hs, and Composed.hs
- Relax contra-tracer ^>= 0.2.1 to contra-tracer in both
  hermod-tracing-core and hermod-tracing-prometheus cabal files
Update the CHANGELOG to document their removal and the contra-tracer
bound loosening.
Rename api-src -> src/public and src -> src/internal, and fix up the
README to reference the new directory names.
…tracing-core

The seventeen combinators (filterTraceBySeverity, filterTraceByPrivacy,
setSeverity, withSeverity, setPrivacy, withPrivacy, privately, allPublic,
allConfidential, setDetails, withDetails, withNames, withInnerNames,
appendPrefixName, appendPrefixNames, appendInnerName, appendInnerNames) are
implementation details consumed only by hermod-tracing-core internals.

They move to Hermod.Tracing.Trace.Annotations (other-modules in core) and are
no longer part of the hermod-tracing-api public surface.
- API.hs now wraps internal combinators with ergonomic signatures:
  contramapM/contramapMCond take (a -> m b), filterTrace takes (a -> Bool),
  foldTraceM/foldCondTraceM take (acc -> a -> m acc). LoggingContext and
  TraceControl are no longer visible to tracer authors.
- routingTrace, contramapM', and LogDoc removed from the public surface.
- contramapM/contramapMCond in Combinators.hs made pure (Trace m a, not
  m (Trace m a)); all call sites in core updated to match.
- Formatter functions (preFormatted, humanFormatter, machineFormatter,
  cborFormatter, forwardFormatter) now pure.
- withLoggingContext moved from Combinators to Trace.Annotations.
- Hermod.Tracing.Trace.Annotations promoted to exposed-modules in core.
- hermod-tracing-api:public explicit dep added to core and recon-framework.
- Routing unit test removed along with routingTrace.
Update hermod-tracing-api's CHANGELOG for the 1.0.0 release.
- contramap' and (>!$!<) removed from Combinators and API
- Trace's contramap instance made strict (bang on tr, $! on result)
- Add INLINE pragmas to the public API's thin wrapper functions
- hermod-tracing-api CHANGELOG: attribute extraction to trace-dispatcher,
  document contramap strictness and removal of contramap'/>!$!<
- hermod-tracing-core CHANGELOG: reframe as initial release, drop old
  trace-dispatcher version history, note routingTrace/contramapM' removal
Port mkarg/config-source's trace-dispatcher change onto hermod-tracing-core.
Introduce ConfigSource in Hermod.Tracing.ConfigurationParser, replacing the
FilePath parameter in readConfiguration and related functions. Supported
sources: File (YAML or JSON), strict or lazy ByteStrings (YAML or JSON), and
pre-parsed Aeson.Objects.

hermod-recon-framework: wrap the optional config file path in FromFile to
match the new ConfigSource-based API (readConfigurationWithDefault now takes
a ConfigSource instead of a bare FilePath).
@Russoul Russoul force-pushed the jutaro/trace-dispatcher-api branch from adbd74a to 3066d8f Compare July 2, 2026 10:55
Russoul added 5 commits July 2, 2026 19:14
It was dropped along with contramapM' and LogDoc when the public API was
pared down, but its signature never referenced LoggingContext/TraceControl,
so there was no reason to remove it. Re-add the combinator, its unit test,
and the doc/changelog mentions; adapt the test to the now-pure
contramapM/machineFormatter signatures.
… periodic tracers

- TraceConfig: drop tcResourceFrequency/tcLedgerMetricsFrequency, add
  tcPeriodicTracers :: Map Text Word64 (arbitrary identifier -> cardinal
  number in an application-specific, per-identifier timeunit).
- ConfigRepresentation: drop traceOptionResourceFrequency/
  traceOptionLedgerMetricsFrequency, add traceOptionPeriodicTracers,
  parsed/emitted under the "PeriodicTracers" JSON key.
- Drop parseAsLegacy (the top-level "TraceOptions"/"TraceOptionForwarder"/…
  format); only the "HermodTracing"-wrapped and flattened top-level formats
  remain.
- Update mergeWithDefault, representationToConfig, configToRepresentation
  for the new field; update tests and the doc/config.json example
  accordingly.
No round-trip (encode . decode) coverage for now, just a direct check
that the shipped example config parses to the TraceConfig we expect.
…tionName

Keeps hermod-tracing-core's internal field name paired with
hermod-tracing-api's TraceConfig.tcApplicationName, like every other
field in this pair. The "ApplicationName" JSON key is unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants