Skip to content

feat(dispatch): wire hostmetrics through embed via EmbedConsumers (PIPE-1023)#231

Merged
Dylan-M merged 1 commit into
mainfrom
dylanmyers/pipe-1023-dispatch-runtime-wiring
Jun 3, 2026
Merged

feat(dispatch): wire hostmetrics through embed via EmbedConsumers (PIPE-1023)#231
Dylan-M merged 1 commit into
mainfrom
dylanmyers/pipe-1023-dispatch-runtime-wiring

Conversation

@Dylan-M

@Dylan-M Dylan-M commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Proposed Change

Refactor dispatch.ForEmbed to take an EmbedConsumers struct (with LogConsumer, MetricConsumer, and TraceConsumer fields) instead of a single embed.LogConsumer. Each per-signal nil check is hoisted into a requireLog/requireMetric/requireTrace helper method on EmbedConsumers, so the per-case boilerplate stays a single line and the error messages all live in one place.

New GeneratorTypeHostMetrics case constructs hostmetrics.New(...) with consumers.MetricConsumer, returning the helper's typed error if it's nil.

config.EmbedOpts grows a MetricConsumer embed.MetricConsumer field; config.LoadModules passes both consumers through to dispatch.ForEmbed. The old "EmbedOpts.LogConsumer is required" early check goes away — the error now surfaces from ForEmbed per-generator-type with the relevant signal in the message.

cmd/blitz/main.go no longer hand-constructs hostmetrics: it delegates to dispatch.ForEmbed after asserting the configured output implements output.MetricWriter and wrapping it via output.WriterAsMetricConsumer. This kills the per-generator-type duplication between cmd/blitz and dispatch that #228 already partially cleaned up for logs.

New yamlSeedDefault helper translates YAML zero-value Seed into -1 (randomize per worker) for hostmetrics. Programmatic Go callers bypass the translation. See PIPE-1036 for the follow-up that routes identity-level determinism through environment.seed_config.

Conflict-point note: this PR shares internal/dispatch/embed.go and config/loader.go with #235. Conflicts: EmbedConsumers struct (each PR adds its consumer field), EmbedOpts struct (each PR adds its consumer field), one case per generator type, and the yamlSeedDefault helper (both PRs define it identically). Whichever lands second rebases mechanically — the helper resolution is "keep one, drop the duplicate."

Tests

Existing TestForEmbed* updated to use EmbedConsumers{LogConsumer: ...}; new TestForEmbedHostMetricsReturnsProducerModule, TestForEmbedHostMetricsRejectsMissingMetricConsumer, TestForEmbedRejectsMissingLogConsumerForLogType. TestLoadModules_NilConsumer updated to feed a valid config so the error surfaces from ForEmbed.

Part of PIPE-1023. Stacked on #230.

@Dylan-M Dylan-M requested review from a team as code owners June 2, 2026 15:46
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1023-dispatch-runtime-wiring branch from fbcd092 to 968e23e Compare June 3, 2026 12:28
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1023-hostmetrics-migration branch 2 times, most recently from 3b86361 to ea7b2ef Compare June 3, 2026 13:19
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1023-dispatch-runtime-wiring branch from 968e23e to 92b26a1 Compare June 3, 2026 13:19
Base automatically changed from dylanmyers/pipe-1023-hostmetrics-migration to main June 3, 2026 13:28
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1023-dispatch-runtime-wiring branch from 92b26a1 to 4b4412d Compare June 3, 2026 13:28
@graphite-app

graphite-app Bot commented Jun 3, 2026

Copy link
Copy Markdown

Merge activity

  • Jun 3, 1:29 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@Dylan-M Dylan-M added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit bdc229c Jun 3, 2026
19 checks passed
@Dylan-M Dylan-M deleted the dylanmyers/pipe-1023-dispatch-runtime-wiring branch June 3, 2026 13:34
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.

2 participants