[model-gateway] Tighten visibility in modules and remove unused re-exports (#16524)

This commit is contained in:
Chang Su
2026-01-05 17:38:50 -08:00
committed by GitHub
parent ce694b2b9e
commit b98bd9a5fb
33 changed files with 130 additions and 383 deletions
@@ -32,7 +32,7 @@ static STRING_INTERNER: Lazy<DashMap<String, Arc<str>>> = Lazy::new(DashMap::new
/// This function is designed for high-throughput scenarios where the same
/// strings (model IDs, worker URLs) appear repeatedly. The first call allocates,
/// subsequent calls just clone the Arc (very cheap - just a ref count increment).
pub fn intern_string(s: &str) -> Arc<str> {
pub(crate) fn intern_string(s: &str) -> Arc<str> {
// Fast path: check if already interned
if let Some(entry) = STRING_INTERNER.get(s) {
return Arc::clone(entry.value());
@@ -46,7 +46,8 @@ pub fn intern_string(s: &str) -> Arc<str> {
.clone()
}
pub fn interner_size() -> usize {
#[allow(dead_code)]
pub(crate) fn interner_size() -> usize {
STRING_INTERNER.len()
}
@@ -91,7 +92,7 @@ pub fn status_code_to_static_str(code: u16) -> Option<&'static str> {
}
/// Static HTTP method strings to avoid allocations on every request.
pub mod http_methods {
pub(crate) mod http_methods {
pub const GET: &str = "GET";
pub const POST: &str = "POST";
pub const PUT: &str = "PUT";
@@ -144,7 +145,7 @@ impl Default for PrometheusConfig {
}
}
pub fn init_metrics() {
pub(crate) fn init_metrics() {
// Layer 1: HTTP metrics
describe_counter!(
"smg_http_requests_total",
@@ -52,7 +52,7 @@ fn get_allowed_targets() -> &'static [&'static str; 3] {
/// Filter that only allows specific module targets to be exported to OTEL.
#[derive(Clone, Copy, Default)]
pub struct CustomOtelFilter;
pub(crate) struct CustomOtelFilter;
impl CustomOtelFilter {
#[inline]