mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-08 16:23:08 +00:00
Compose: set prometheus platform for arm hosts
This commit is contained in:
parent
cc2a1e548c
commit
eb179d1640
@ -1,7 +1,8 @@
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.0.1
|
||||
command:
|
||||
{% if prometheus.platform %} platform: {{ prometheus.platform }}
|
||||
{% endif %} command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --web.enable-otlp-receiver
|
||||
|
||||
@ -199,6 +199,11 @@ impl<'a> ComposeDescriptorBuilder<'a> {
|
||||
let (default_image, default_platform) = resolve_image();
|
||||
let image = default_image;
|
||||
let platform = default_platform;
|
||||
// Prometheus image is x86_64-only on some tags; set platform when on arm hosts.
|
||||
let prometheus_platform = match std::env::consts::ARCH {
|
||||
"aarch64" | "arm64" => Some(String::from("linux/arm64")),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let validators = build_nodes(
|
||||
self.topology.validators(),
|
||||
@ -219,7 +224,7 @@ impl<'a> ComposeDescriptorBuilder<'a> {
|
||||
);
|
||||
|
||||
Ok(ComposeDescriptor {
|
||||
prometheus: PrometheusTemplate::new(prometheus_host_port),
|
||||
prometheus: PrometheusTemplate::new(prometheus_host_port, prometheus_platform),
|
||||
validators,
|
||||
executors,
|
||||
})
|
||||
@ -230,12 +235,15 @@ impl<'a> ComposeDescriptorBuilder<'a> {
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct PrometheusTemplate {
|
||||
host_port: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
platform: Option<String>,
|
||||
}
|
||||
|
||||
impl PrometheusTemplate {
|
||||
fn new(port: u16) -> Self {
|
||||
fn new(port: u16, platform: Option<String>) -> Self {
|
||||
Self {
|
||||
host_port: format!("127.0.0.1:{port}:9090"),
|
||||
platform,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user