Skip to content

Commit a436c4a

Browse files
authored
Escape cluster and replica names (MaterializeInc#36394)
Escape cluster and replica names ### Motivation Metric fault if not escaped properly ### Description Ensures that cluster name and replica names are properly escaped in prom exporter. ### Verification 🤞🏻
1 parent a2c6756 commit a436c4a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/environmentd/src/http/prometheus.rs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// by the Apach
99

1010
use mz_catalog::memory::objects::{Cluster, ClusterReplica};
11+
use mz_sql::ast::display::escaped_string_literal;
1112

1213
use super::sql::SqlRequest;
1314

@@ -28,8 +29,10 @@ impl<'a> PrometheusSqlQuery<'a> {
2829
SqlRequest::Simple {
2930
query: if let Some((cluster, replica)) = cluster {
3031
format!(
31-
"SET auto_route_catalog_queries = false; SET CLUSTER = '{}'; SET CLUSTER_REPLICA = '{}'; {}",
32-
cluster.name, replica.name, self.query
32+
"SET auto_route_catalog_queries = false; SET CLUSTER = {}; SET CLUSTER_REPLICA = {}; {}",
33+
escaped_string_literal(&cluster.name),
34+
escaped_string_literal(&replica.name),
35+
self.query
3336
)
3437
} else {
3538
format!(

0 commit comments

Comments
 (0)