proxy: change is cold start to enum (#6948)

## Problem

Actually it's good idea to distinguish between cases when it's a cold
start, but we took the compute from the pool

## Summary of changes

Updated to enum.
This commit is contained in:
Anna Khanova
2024-03-04 13:31:28 +04:00
committed by GitHub
parent 8dc7dc79dd
commit 3114be034a
3 changed files with 55 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use std::fmt;
use crate::auth::IpPattern;
@@ -98,7 +98,16 @@ pub struct MetricsAuxInfo {
pub endpoint_id: EndpointId,
pub project_id: ProjectId,
pub branch_id: BranchId,
pub is_cold_start: Option<bool>,
pub cold_start_info: Option<ColdStartInfo>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum ColdStartInfo {
Unknown = 0,
Warm = 1,
PoolHit = 2,
PoolMiss = 3,
}
#[cfg(test)]
@@ -111,6 +120,7 @@ mod tests {
"endpoint_id": "endpoint",
"project_id": "project",
"branch_id": "branch",
"cold_start_info": "unknown",
})
}