Skip to content

refactor(config): decouple monitoring config from amp-config schemars#1859

Merged
mitchhs12 merged 5 commits intomainfrom
mitchhs12/decouple-monitoring-config
Feb 25, 2026
Merged

refactor(config): decouple monitoring config from amp-config schemars#1859
mitchhs12 merged 5 commits intomainfrom
mitchhs12/decouple-monitoring-config

Conversation

@mitchhs12
Copy link
Contributor

@mitchhs12 mitchhs12 commented Feb 25, 2026

Summary

  • Remove schemars dependency from the monitoring crate by duplicating OpenTelemetryConfig in amp-config with its own serde + schemars support
  • Change monitoring::init to accept impl Into<OpenTelemetryConfig> per the decoupling pattern
  • Implement From<&amp_config::OpenTelemetryConfig> for monitoring::config::OpenTelemetryConfig
  • Remove monitoring/schemars from the amp-config feature chain

Part of #1790 (PR 1 of 2)

Remove schemars dependency from the monitoring crate by duplicating
OpenTelemetryConfig in amp-config with its own serde + schemars support.
This is the first step toward making amp-config the sole owner of JSON
schema generation, so internal crates no longer carry application-level
concerns.

- Add application-level OpenTelemetryConfig in amp-config with From impl
- Change monitoring::init to accept impl Into<OpenTelemetryConfig>
- Add monitoring::init_logging_only convenience function
- Remove schemars feature propagation from amp-config to monitoring

Part of #1790 (PR 1 of 2)
@mitchhs12 mitchhs12 force-pushed the mitchhs12/decouple-monitoring-config branch from 21b3153 to 8d016c3 Compare February 25, 2026 15:31
@mitchhs12 mitchhs12 self-assigned this Feb 25, 2026
@mitchhs12 mitchhs12 marked this pull request as ready for review February 25, 2026 15:48
@mitchhs12 mitchhs12 requested a review from LNSD February 25, 2026 18:54
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

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

LGTM ✅

[features]
# JSON Schema generation support for configuration validation
schemars = ["dep:schemars", "amp-worker-core/schemars", "monitoring/schemars"]
schemars = ["dep:schemars", "amp-worker-core/schemars"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Extract OpenTelemetryConfig into its own `monitoring` submodule per
review feedback, keeping lib.rs clean. Rename the external monitoring
crate dependency to `monitoring-crate` in Cargo.toml to avoid name
collision with the local module.
fs-err.workspace = true
metadata-db = { path = "../core/metadata-db" }
monitoring = { path = "../core/monitoring" }
monitoring-crate = { package = "monitoring", path = "../core/monitoring" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
monitoring-crate = { package = "monitoring", path = "../core/monitoring" }
amp-monitoring = { package = "monitoring", path = "../core/monitoring" }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 9947b81

.map(|option| option.map(Duration::from_secs_f64))
}

impl From<&OpenTelemetryConfig> for monitoring_crate::config::OpenTelemetryConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
impl From<&OpenTelemetryConfig> for monitoring_crate::config::OpenTelemetryConfig {
impl From<&OpenTelemetryConfig> for amp_monitoring::config::OpenTelemetryConfig {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 9947b81

pub server_microbatch_max_interval: u64,
/// OpenTelemetry observability configuration.
pub opentelemetry: Option<OpenTelemetryConfig>,
pub opentelemetry: Option<monitoring::OpenTelemetryConfig>,
Copy link
Contributor

@LNSD LNSD Feb 25, 2026

Choose a reason for hiding this comment

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

Nit: Can we import it?

Suggested change
pub opentelemetry: Option<monitoring::OpenTelemetryConfig>,
pub opentelemetry: Option<OpenTelemetryConfig>,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved in 9947b81

- Rename dependency alias from monitoring-crate to amp-monitoring
- Import OpenTelemetryConfig in lib.rs instead of using qualified path
- Update From impl to use amp_monitoring
@mitchhs12 mitchhs12 merged commit 84affd2 into main Feb 25, 2026
9 checks passed
@mitchhs12 mitchhs12 deleted the mitchhs12/decouple-monitoring-config branch February 25, 2026 21:45
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