Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(risedev): support prometheus + redpanda #3083

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions risedev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ template:
# Etcd used by this Prometheus instance
provide-etcd: "etcd*"

# Redpanda used by this Prometheus instance
provide-redpanda: "redpanda*"

frontend:
# Advertise address of frontend
address: "127.0.0.1"
Expand Down
6 changes: 5 additions & 1 deletion src/risedevtool/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ impl Compose for RedPandaConfig {
self.outside_port.to_string(),
],
volumes: vec![format!("{}:/var/lib/redpanda/data", self.id)],
ports: vec![format!("{}:{}", self.outside_port, self.outside_port)],
ports: vec![
format!("{}:{}", self.outside_port, self.outside_port),
// Redpanda admin port
"9644:9644".to_string(),
],
..Default::default()
})
}
Expand Down
24 changes: 18 additions & 6 deletions src/risedevtool/src/config_gen/prometheus_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,37 +62,49 @@ impl PrometheusGen {
.map(|node| format!("\"{}:{}\"", node.address, node.exporter_port))
.join(",");

let redpanda_targets = config
.provide_redpanda
.as_ref()
.unwrap()
.iter()
.map(|node| format!("\"{}:{}\"", node.address, 9644))
.join(",");

format!(
r#"# --- THIS FILE IS AUTO GENERATED BY RISEDEV ---
global:
scrape_interval: 1s
evaluation_interval: 5s

scrape_configs:
- job_name: "prometheus"
- job_name: prometheus
static_configs:
- targets: ["{prometheus_host}:{prometheus_port}"]

- job_name: compute-job
- job_name: compute
static_configs:
- targets: [{compute_node_targets}]

- job_name: meta-job
- job_name: meta
static_configs:
- targets: [{meta_node_targets}]

- job_name: minio-job
- job_name: minio
metrics_path: /minio/v2/metrics/cluster
static_configs:
- targets: [{minio_targets}]

- job_name: compactor-job
- job_name: compactor
static_configs:
- targets: [{compactor_targets}]

- job_name: etcd-job
- job_name: etcd
static_configs:
- targets: [{etcd_targets}]

- job_name: redpanda
static_configs:
- targets: [{redpanda_targets}]
"#,
)
}
Expand Down
1 change: 1 addition & 0 deletions src/risedevtool/src/service_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ pub struct PrometheusConfig {
pub provide_minio: Option<Vec<MinioConfig>>,
pub provide_compactor: Option<Vec<CompactorConfig>>,
pub provide_etcd: Option<Vec<EtcdConfig>>,
pub provide_redpanda: Option<Vec<RedPandaConfig>>,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
Expand Down