Skip to content

feat(asm-runner): use strata-logging from strata-common#108

Merged
prajwolrg merged 3 commits into
mainfrom
feat-use-strata-logging
May 20, 2026
Merged

feat(asm-runner): use strata-logging from strata-common#108
prajwolrg merged 3 commits into
mainfrom
feat-use-strata-logging

Conversation

@prajwolrg
Copy link
Copy Markdown
Collaborator

@prajwolrg prajwolrg commented May 19, 2026

Description

Replaces the in-tree tracing-subscriber bootstrap in bin/asm-runner with the shared strata-logging crate from strata-common (the same one already used by alpen/strata-client and alpen/strata-signer). The runner now picks up OTLP traces/metrics export, rolling file logs, JSON output, and the tracing-to-metrics bridge through a new optional [logging] section in config.toml.

The init path moves below the Tokio runtime build because strata-logging's OTLP exporter needs a runtime context, and strata_logging::finalize() is invoked on both the graceful and crash shutdown branches so any in-flight OTLP spans get flushed.

Type of Change

  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Dependency update

Notes to Reviewers

Today LoggingInitConfig<'a> is fully borrowed (&'a str, Option<&'a str>, Option<&'a PathBuf>, &'a [&'a str]), which forces every consumer (asm-runner, strata-client, strata-signer, …) to define its own owned LoggingConfig struct purely to hold deserialized TOML values and then re-borrow them at the init call-site. I think it would be cleaner if strata-logging shipped an owned, serde-friendly counterpart (e.g. OwnedLoggingConfig with String / Option<String> / Vec<String> fields, deriving Serialize/Deserialize) plus an as_init_config(&self) -> LoggingInitConfig<'_> method. Consumers could then embed that type directly in their config struct and drop the per-binary boilerplate (the LoggingConfig added in this PR would go away). Happy to follow up upstream if reviewers agree. CC: @voidash

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

None.

Drop the in-tree tracing-subscriber bootstrap and share the strata-common
logging stack used by alpen/strata-signer. This unlocks OTLP traces/metrics,
optional rolling file logs, JSON output, and the tracing-to-metrics bridge
through a TOML [logging] section, with field-level defaults so existing
config.toml files keep working unchanged. Init now runs inside a Tokio
runtime context (required by the OTLP exporter) and finalize() flushes on
both the graceful and crash shutdown paths.
@prajwolrg prajwolrg requested review from storopoli and voidash May 19, 2026 03:28
The custom serde-default and matching manual Default impl were boilerplate
that disagreed with the derived Default. Rely on derive(Default) so the
empty-section and missing-field paths agree, and let operators populate
extra_filter_directives explicitly in TOML when they want them.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bin/asm-runner/src/main.rs 85.18% 4 Missing ⚠️
Files with missing lines Coverage Δ
bin/asm-runner/src/config.rs 100.00% <100.00%> (ø)
bin/asm-runner/src/main.rs 92.59% <85.18%> (-4.91%) ⬇️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Commit: 865ea8b
SP1 Execution Results

program cycles gas
asm-stf 130,103,924 129,731,987
moho 5,191,380 5,499,715

@prajwolrg prajwolrg marked this pull request as ready for review May 19, 2026 06:56
Comment thread bin/asm-runner/src/config.rs
@prajwolrg prajwolrg self-assigned this May 19, 2026
Without struct-level `#[serde(default)]`, a `[logging]` section that omits
`extra_filter_directives` (a `Vec`, not an `Option`) fails to deserialize with
`missing field`, despite the docs promising all fields are optional. Moving the
attribute to the struct piggybacks on the derived `Default` and makes every
field uniformly skippable, including future non-`Option` additions. Adds
deserialization tests covering both a partial `[logging]` section and a
config with no `[logging]` table at all.
Copy link
Copy Markdown
Member

@storopoli storopoli left a comment

Choose a reason for hiding this comment

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

ACK 1d95891

@prajwolrg
Copy link
Copy Markdown
Collaborator Author

@storopoli also I'm curious to know your thoughts on using owned type as mentioned in Note to Reviewers section.

@storopoli
Copy link
Copy Markdown
Member

@storopoli also I'm curious to know your thoughts on using owned type as mentioned in Note to Reviewers section.

Oh missed that. Yes let's make it owned it will be very useful for downstream users.

@voidash
Copy link
Copy Markdown

voidash commented May 20, 2026

LoggingInitConfig<'a> is fully borrowed (&'a str, Option<&'a str>, Option<&'a PathBuf>, &'a [&'a str]), which forces every consumer (asm-runner, strata-client, strata-signer, …) to define its own owned LoggingConfig struct purely to hold deserialized TOML values and then re-borrow them at the init call-site

This is done such that each portion is in charge of it's own config schema and defaults. I understand it's boilerplatey but it gives each binary what it wants to do. For example

  • strata exposes metrics_port, installs a Prometheus recorder, and sets enable_metrics_layer
  • strata-signer does not expose metrics config and passes enable_metrics_layer: false.

Likewise service names, default log file prefixes, and noisy dependency filters are binary policy. The borrowed
LoggingInitConfig<'_> lets each binary combine its own owned config values with those fixed policy choices without making strata-logging define one config

But i think your point is valid and with careful design of this ownedConfig it should be possible to do such stuff too. we can manage it with optional serde feature, which will gate the default Owned logging config

@prajwolrg

@prajwolrg
Copy link
Copy Markdown
Collaborator Author

prajwolrg commented May 20, 2026

Thanks @voidash, agree an optional serde-gated owned counterpart is the cleanest middle ground.
Filed STR-3539 to track the upstream work

@prajwolrg prajwolrg added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 04bd384 May 20, 2026
23 checks passed
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