Rename trace-dispatcher → hermod-tracing-{core,api,prometheus} and restructure package split#16
Open
jutaro wants to merge 35 commits into
Open
Rename trace-dispatcher → hermod-tracing-{core,api,prometheus} and restructure package split#16jutaro wants to merge 35 commits into
jutaro wants to merge 35 commits into
Conversation
e5fd150 to
a4d50d8
Compare
3f14c2c to
8e5ad8c
Compare
eaf1cd9 to
f370299
Compare
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.
…ng imports to hermod-tracing-core
- 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
c2f81df to
adbd74a
Compare
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.
- 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).
adbd74a to
3066d8f
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, restorestrace-dispatcheras 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 — defineLogFormatting/MetaTraceinstances and calltraceWith— 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 fromtrace-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:internal—Hermod.Tracing.Types(theTracecarrier,TraceControlGADT,LogFormatting/MetaTracetypeclasses, and the fullTraceConfig/BackendConfigdependency chain) andHermod.Tracing.Trace/Trace.Combinators(structural and annotation combinators).hermod-tracing-api:public—Hermod.Tracing.API, a single-import front door that wraps the internal combinators with ergonomic signatures (contramapM/contramapMCondtake(a -> m b),filterTracetakes(a -> Bool),foldTraceM/foldCondTraceMtake(acc -> a -> m acc)) and hidesLoggingContext/TraceControlfrom callers entirely. Annotation combinators (setSeverity,withPrivacy,withNames, …) stay internal tohermod-tracing-core, since they aren't part of the minimal type-definition surface.Build-depends for
hermod-tracing-apiis kept deliberately small: no async, bytestring, cborg-json, time, or YAML.The two original large files (
Types.hsat 568 lines,Trace.hsat 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
trace-dispatcherhermod-tracing-{api,core,prometheus}Cardano.Logging.*Hermod.Tracing.*trace-dispatcheritself has been restored as a backward-compatible mirror oforigin/master's copy (wired back intocabal.project,CODEOWNERS, and the Nix ecosystem), so existing pinned consumers keep building unchanged.New package:
hermod-tracing-prometheusThe Prometheus TCP server backend (
Exposition,NetworkRun,TCPServer) has been extracted fromhermod-tracing-coreinto a standalone optional package. Deps exclusive to the Prometheus server (hashable,http-date,time-manager,unix-compat) are removed fromhermod-tracing-coreand moved here.Identifier and field renames
mkCardanoTracer/mkCardanoTracer'mkHermodTracer/mkHermodTracer'TraceDispatcherMessageHermodTracingMessagesetupTraceDispatcher(recon)setupHermodTracingTRACE_DISPATCHER_LOGGING_HOSTNAMEHERMOD_TRACING_LOGGING_HOSTNAMEPrometheusMconstructorLabelSetMpresentPrometheusM(internal, EKG)presentLabelSetMTraceConfig.tcNodeNametcApplicationNameConfigRepresentation.traceOptionNodeName(internal)traceOptionApplicationNameCounterM's field type changed fromMaybe InttoCounterAction(CounterIncrement/CounterAdd) for clarity of intent.contramapwas made strict;contramap'and>!$!<were removed.routingTraceandcontramapM'were briefly dropped during the public-API simplification pass androutingTracewas restored, since its signature never leakedLoggingContext/TraceControland there was no reason to remove it;contramapM'stays removed.Hermod.Tracing.Types.NodeInfoandHermod.Tracing.Types.NodeStartupInfowere removed fromhermod-tracing-core(cardano-node–specific types with no generic utility), and thecontra-tracerversion bound was loosened from^>= 0.2.1to unconstrained.Configuration format changes
Hermod.Tracing.ConfigurationParsergainedConfigSource(FromFile/FromStrictBytes/FromLazyBytes/FromJSONObject), replacing the bareFilePathparameter ofreadConfigurationand related functions — configs can now be ingested from a file, a strict/lazyByteString, or a pre-parsedAeson.Object."TraceOptions"/"TraceOptionForwarder"/"TraceOptionResourceFrequency"/…) has been dropped; only the"HermodTracing"-wrapped and flattened top-level formats are now accepted.TraceConfig'stcResourceFrequency/tcLedgerMetricsFrequency(Maybe Int, milliseconds) are replaced by a single generalizedtcPeriodicTracers :: 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.doc/config.jsonand checks it against the expectedTraceConfig.hermod-recon-frameworkupdatedtrace-dispatchertohermod-tracing-core+hermod-tracing-prometheus.Cardano.Logging.*imports replaced withHermod.Tracing.*.MIN_VERSION_trace_dispatcher) removed.--trace-dispatcher-cfg→--hermod-tracing-cfg.hermod-trace-resourcesupdatedtrace-dispatchertohermod-tracing-core.Cardano.Loggingimport updated toHermod.Tracing.Versioning
hermod-tracing-api,hermod-tracing-core, andhermod-tracing-prometheusare bumped to1.0.0, with CHANGELOGs reframed as initial releases based ontrace-dispatcher-2.13.0.Docs and config cleaned up
UseTraceDispatcherconfig key removed everywhere (no longer applicable).trace-dispatcher,iohk-monitoring, andCardano.Loggingupdated throughout READMEs, CHANGELOGs, and doc files.CODEOWNERSupdated to reflect all renamed and new packages.Compatibility
trace-dispatchercontinues to exist (restored as a mirror oforigin/master's copy) and exports the same surface, so existing consumers keep building unchanged until they migrate tohermod-tracing-*.