mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
Allow plus signs in metric tags (#55227)
## Why App versions containing build metadata use `+`, which metric tag validation previously rejected. ## What changed Accept `+` in metric tag keys and values so these versions can be included in the `app.version` session tag. ## Testing Extend the session metric tag test to cover a version with build metadata, verifying that its value and tag ordering are preserved. GitOrigin-RevId: 62ad732b8d280c2d0c4e1b0de8cab26ff87c9d47
This commit is contained in:
@@ -84,28 +84,30 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn session_metric_tags_include_expected_tags_in_order() {
|
||||
let tags = SessionMetricTagValues {
|
||||
auth_mode: Some("api_key"),
|
||||
session_source: "cli",
|
||||
originator: "codex_cli",
|
||||
service_name: Some("desktop_app"),
|
||||
model: "gpt-5.1",
|
||||
app_version: "1.2.3",
|
||||
}
|
||||
.into_tags()
|
||||
.expect("tags");
|
||||
for app_version in ["1.2.3", "0.164.0-alpha.1+internal"] {
|
||||
let tags = SessionMetricTagValues {
|
||||
auth_mode: Some("api_key"),
|
||||
session_source: "cli",
|
||||
originator: "codex_cli",
|
||||
service_name: Some("desktop_app"),
|
||||
model: "gpt-5.1",
|
||||
app_version,
|
||||
}
|
||||
.into_tags()
|
||||
.expect("tags");
|
||||
|
||||
assert_eq!(
|
||||
tags,
|
||||
vec![
|
||||
(AUTH_MODE_TAG, "api_key"),
|
||||
(SESSION_SOURCE_TAG, "cli"),
|
||||
(ORIGINATOR_TAG, "codex_cli"),
|
||||
(SERVICE_NAME_TAG, "desktop_app"),
|
||||
(MODEL_TAG, "gpt-5.1"),
|
||||
(APP_VERSION_TAG, "1.2.3"),
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
tags,
|
||||
vec![
|
||||
(AUTH_MODE_TAG, "api_key"),
|
||||
(SESSION_SOURCE_TAG, "cli"),
|
||||
(ORIGINATOR_TAG, "codex_cli"),
|
||||
(SERVICE_NAME_TAG, "desktop_app"),
|
||||
(MODEL_TAG, "gpt-5.1"),
|
||||
(APP_VERSION_TAG, app_version),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -51,5 +51,5 @@ fn is_metric_char(c: char) -> bool {
|
||||
}
|
||||
|
||||
fn is_tag_char(c: char) -> bool {
|
||||
c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-' | '/')
|
||||
c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-' | '/' | '+')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user