feat(dispatch): wire hostmetrics through embed via EmbedConsumers (PIPE-1023)#231
Merged
Merged
Conversation
Contributor
Author
eKuG
approved these changes
Jun 3, 2026
fbcd092 to
968e23e
Compare
3b86361 to
ea7b2ef
Compare
968e23e to
92b26a1
Compare
Base automatically changed from
dylanmyers/pipe-1023-hostmetrics-migration
to
main
June 3, 2026 13:28
92b26a1 to
4b4412d
Compare
Merge activity
|
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.

Proposed Change
Refactor
dispatch.ForEmbedto take anEmbedConsumersstruct (withLogConsumer,MetricConsumer, andTraceConsumerfields) instead of a singleembed.LogConsumer. Each per-signal nil check is hoisted into arequireLog/requireMetric/requireTracehelper method onEmbedConsumers, so the per-case boilerplate stays a single line and the error messages all live in one place.New
GeneratorTypeHostMetricscase constructshostmetrics.New(...)withconsumers.MetricConsumer, returning the helper's typed error if it's nil.config.EmbedOptsgrows aMetricConsumer embed.MetricConsumerfield;config.LoadModulespasses both consumers through todispatch.ForEmbed. The old "EmbedOpts.LogConsumer is required" early check goes away — the error now surfaces fromForEmbedper-generator-type with the relevant signal in the message.cmd/blitz/main.gono longer hand-constructs hostmetrics: it delegates todispatch.ForEmbedafter asserting the configured output implementsoutput.MetricWriterand wrapping it viaoutput.WriterAsMetricConsumer. This kills the per-generator-type duplication between cmd/blitz and dispatch that #228 already partially cleaned up for logs.New
yamlSeedDefaulthelper translates YAML zero-valueSeedinto-1(randomize per worker) for hostmetrics. Programmatic Go callers bypass the translation. See PIPE-1036 for the follow-up that routes identity-level determinism throughenvironment.seed_config.Conflict-point note: this PR shares
internal/dispatch/embed.goandconfig/loader.gowith #235. Conflicts:EmbedConsumersstruct (each PR adds its consumer field),EmbedOptsstruct (each PR adds its consumer field), onecaseper generator type, and theyamlSeedDefaulthelper (both PRs define it identically). Whichever lands second rebases mechanically — the helper resolution is "keep one, drop the duplicate."Tests
Existing
TestForEmbed*updated to useEmbedConsumers{LogConsumer: ...}; newTestForEmbedHostMetricsReturnsProducerModule,TestForEmbedHostMetricsRejectsMissingMetricConsumer,TestForEmbedRejectsMissingLogConsumerForLogType.TestLoadModules_NilConsumerupdated to feed a valid config so the error surfaces fromForEmbed.Part of PIPE-1023. Stacked on #230.