Skip to content

Use hermod-tracing instead of trace-dispatcher - #77

Draft
jutaro wants to merge 4 commits into
mainfrom
jutaro/hermod-tracing-0.7.1.0
Draft

jutaro wants to merge 4 commits into
mainfrom
jutaro/hermod-tracing-0.7.1.0

Conversation

@jutaro

@jutaro jutaro commented Oct 9, 2026 •

Copy link
Copy Markdown

Moves dmq-node from trace-dispatcher onto hermod-tracing, which is
trace-dispatcher renamed and split into hermod-tracing-api (instances
only), hermod-tracing-core and hermod-tracing-prometheus. The module
namespace Cardano.Logging became Hermod.Tracing.

The shape of it

dmq-node is an application, so it keeps hermod-tracing for its own
structured traces and adapts at the boundary with ouroboros-network and
ouroboros-consensus, whose public libraries carry contra-tracer. Both tracer
records in DMQ.Tracer are mkTracer $ Logging.traceWith <tracer> — the 25
fields of Diffusion.Tracers and the 23 of DMQTracers — with the traces
themselves built by mkLoggingTracer on hermod.

One field deliberately is not contra-tracer. dmqStartupTracer is dmq's
own message type, consumed only in Main and handed to
hermod-tracing-prometheus, which since 1.1 takes a hermod Trace. So it
stays Logging.Trace m DMQStartupTrace, the toContraTracer bridge in front
of runPrometheusSimple goes, and Main qualifies its six traceWith calls
accordingly. No ouroboros-network type is involved, so nothing requires it to
be contra-tracer.

hermod-tracing-api is not a dependency of any stanza: no module imports
Hermod.Tracing.API, and -Werror=unused-packages rejects it.

Configuration is read as before

hermod-tracing-core 1.0.1 reads trace-dispatcher's configuration layout
with the precedence trace-dispatcher 2.13 had, and still falls back to
TRACE_DISPATCHER_LOGGING_HOSTNAME, so an existing configuration file keeps
working. The changelog entries say so under Non-Breaking, and name the two
keys that matter here, the silent case of mixing old and new names in one
file, and what to keep for a rollback to 0.7.

The source-repository-package stanzas

cabal.project carries two temporary pins, both of which must be removed
before this merges
:

ouroboros-consensus needs no pin; it resolves from CHaP.

Also in this branch, and worth knowing

This branch is 7 commits behind main and will need updating before it can
merge.

The shipped `dmq-node/config.json` and the examples in `README.md` spell the
tracing options with the legacy key names `TraceOptions` and
`TraceOptionMetricsPrefix`. The tracing configuration parser accepts three
shapes, tried in order: the legacy one, a `HermodTracing`/`TraceDispatcher`
wrapper object, and the keys flattened at the top level -- and the flattened
form spells them `Options` and `MetricsPrefix`.

Both spellings therefore work today, but only the current one survives the
removal of the legacy parser. Moving the shipped configuration and the
documentation over now keeps that later change from stranding anyone who
copied their configuration from this repository.

No behaviour changes: existing configuration files, in either spelling, keep
being accepted exactly as before.
The bound has been `^>=4.1` since c9312a6, which means `>=4.1 && <4.2` and so
excludes ouroboros-consensus 4.2. CHaP already carries this same widening as
revision 2 of dmq-node 0.7.0.0, but it was never merged back into the source
tree, so 0.7.1.0 still declares `^>=4.1`.

Widening the bound on its own is not enough: ouroboros-consensus 4.2.0.0 was
published to CHaP on 2026-08-27, after the pinned index-state of
2026-08-11T14:53:43Z, so at that index-state there is no 4.2 to resolve to.
The index-state moves to 2026-09-16T14:05:36Z, and `flake.lock` follows via
`nix flake update CHaP`, the same pairing as in c9312a6.

`cabal build all --dry-run` resolves, and the solver delta is confined to
ouroboros-consensus and its own closure:

    cardano-ledger-shelley  1.19.0.0 -> 1.19.0.1
    cardano-slotting        0.2.1.0  -> 0.2.2.0
    ouroboros-consensus     4.1.0.0  -> 4.2.1.0
    plutus-core             1.67.0.0 -> 1.69.0.0
    plutus-ledger-api       1.67.0.0 -> 1.69.0.0
    plutus-tx               1.67.0.0 -> 1.69.0.0
    sop-extras                       -> 0.4.2.0  (new)

Note this invalidates the `dist-newstyle` CI cache, which is keyed on the hash
of `cabal.project`.
`trace-dispatcher` has been renamed and split into `hermod-tracing-api`,
`hermod-tracing-core` and `hermod-tracing-prometheus`; the module namespace
`Cardano.Logging` became `Hermod.Tracing`.

dmq-node is an application, so it keeps hermod-tracing for its own structured
traces and adapts at the boundary with ouroboros-network and
ouroboros-consensus, whose public libraries carry contra-tracer. Both tracer
records in DMQ.Tracer are `mkTracer $ Logging.traceWith <tracer>` -- the 25
fields of Diffusion.Tracers and the 23 of DMQTracers -- with the traces
themselves built by mkLoggingTracer on hermod.

One field is not contra-tracer. `dmqStartupTracer` is dmq's own message type,
consumed only in Main and handed to hermod-tracing-prometheus, which since 1.1
takes a hermod `Trace`. It stays `Logging.Trace m DMQStartupTrace`, so the
toContraTracer bridge in front of runPrometheusSimple goes and Main qualifies
its six traceWith calls accordingly. No ouroboros-network type is involved, so
nothing requires it to be contra-tracer.

Mechanically:

  * `Cardano.Logging` -> `Hermod.Tracing` (`hermod-tracing-core`), and
    `Cardano.Logging.Prometheus.TCPServer` ->
    `Hermod.Tracing.Prometheus.TCPServer`, which is now its own package;
  * `mkCardanoTracer` -> `mkHermodTracer`;
  * `trace-dispatcher` -> `hermod-tracing-core` + `hermod-tracing-prometheus`
    in the library, and both in the executable, which needs core for the
    startup trace; contra-tracer in the library, the executable and the test
    suite. `dmq-cddl` needs no tracing dependency at all.
    `hermod-tracing-api` is not a dependency of any stanza: no module imports
    `Hermod.Tracing.API`, and -Werror=unused-packages rejects it.

Then `scripts/ci/run-stylish-haskell.sh` and `scripts/ci/run-cabal-gild.sh`.

Configuration is read as before. hermod-tracing-core 1.0.1 reads
trace-dispatcher's layout with the precedence trace-dispatcher 2.13 had, and
still falls back to TRACE_DISPATCHER_LOGGING_HOSTNAME, so an existing
configuration file keeps working. The changelog entries say so under
Non-Breaking, and name the two keys that matter to dmq-node, the silent case
of mixing old and new names in one file, and what to keep for a rollback to
0.7. dmq-node requires hermod-tracing-core ^>=1.0.1, the first release with
those fallbacks, and hermod-tracing-prometheus ^>=1.1.
…builds

Lets CI build this branch before CHaP has hermod-tracing-core 1.0.1 and
hermod-tracing-prometheus 1.1.0, which are IntersectMBO/hermod-tracing#21.
hermod-tracing-api is listed only because hermod-tracing-prometheus depends on
its internal sublibrary; no module here imports it.

ouroboros-network is pinned for a different reason: its tracing sublibraries
provide their LogFormatting instances against hermod-tracing-api rather than
trace-dispatcher, and no version bound can express that, because the flipped
packages keep their released version numbers. Without it DMQ.Tracer does not
compile -- 40 errors of the shape "Could not deduce LogFormatting
(Mx.WithBearer (ConnectionId RemoteAddress) Mx.Trace)". The pin is
IntersectMBO/ouroboros-network#5447.

ouroboros-consensus needs no pin; it resolves from CHaP.

Both stanzas must be removed before this merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Temporary source pins remain despite the pre-merge requirement, and the main migration changelog misstates the tracer boundary.

2 open findings
What changed in this PR

Migrates dmq-node logging from trace-dispatcher to hermod-tracing while preserving contra-tracer boundaries.

Changes:

  • Replaces tracing dependencies, namespaces, configuration keys, and Prometheus integration.
  • Updates consensus/CHaP dependencies and documentation.
  • Adds temporary upstream source pins.
File Description
README.md Updates tracing names and configuration keys.
flake.lock Updates the CHaP revision.
dmq-node/​test/​DMQ/​Protocol/​LocalMsgNotification/​Test.hs Reorders tracer import.
dmq-node/​test/​DMQ/​Protocol/​LocalMsgNotification/​Examples.hs Reorders tracer import.
dmq-node/​src/​DMQ/​Tracer.hs Builds Hermod traces and adapts boundary tracers.
dmq-node/​src/​DMQ/​SigSubmissionV2/​Outbound.hs Reorders package-import pragma.
dmq-node/​src/​DMQ/​SigSubmissionV2/​Inbound.hs Reorders package-import pragma.
dmq-node/​src/​DMQ/​Protocol/​SigSubmission/​Type.hs Migrates logging namespace.
dmq-node/​src/​DMQ/​NodeToNode.hs Reorders package-import pragma.
dmq-node/​src/​DMQ/​NodeToClient/​LocalStateQueryClient/​Types.hs Migrates logging namespace.
dmq-node/​src/​DMQ/​NodeToClient/​LocalStateQueryClient.hs Reorders package-qualified tracer import.
dmq-node/​src/​DMQ/​NodeToClient/​LocalMsgSubmission.hs Migrates logging namespace and imports.
dmq-node/​src/​DMQ/​NodeToClient/​LocalMsgNotification.hs Reorders tracer import.
dmq-node/​src/​DMQ/​NodeToClient.hs Reorders package-import pragma.
dmq-node/​src/​DMQ/​Diffusion/​NodeKernel.hs Reorders package-import pragma.
dmq-node/​src/​DMQ/​Diffusion/​Arguments.hs Reorders package-qualified tracer import.
dmq-node/​dmq-node.cabal Replaces tracing dependencies and bumps consensus.
dmq-node/​config.json Uses the current tracing configuration key.
dmq-node/​changelog.d/​20261002_120000_juergen.nicklisch_prometheus_trace.md Documents direct Prometheus tracing.
dmq-node/​changelog.d/​20260924_214805_juergen.nicklisch_hermod_tracing.md Documents the tracing migration.
dmq-node/​changelog.d/​20260924_194229_juergen.nicklisch_bump_consensus_4_2.md Documents the consensus bump.
dmq-node/​changelog.d/​20260924_194135_juergen.nicklisch_tracing_config_keys.md Documents configuration-key migration.
dmq-node/​app/​Main.hs Uses Hermod for startup and Prometheus traces.
cabal.project Advances CHaP and temporarily pins upstream sources.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cabal.project
-- https://github.com/dmwit/ordered-containers/issues/33
, ordered-containers:containers

-- TEMPORARY, for review only: remove before merging.
Comment on lines +3 to +8
- Replace `trace-dispatcher` with `hermod-tracing`, its successor, and
`contra-tracer` with the `hermod-tracing-api` facade. The tracers `dmq-node`
builds are now `hermod-tracing` traces end to end, so they keep the control
channel that lets an application configure, silence and document a tracer it
has already handed out; the 48 places that previously collapsed a configured
trace into a plain callback are gone.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants