Skip to content

Commit 2bcb443

Browse files
committed
Add changelog
1 parent 241f96b commit 2bcb443

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Do not PII-scrub code locations by default. ([#3116](https://github.com/getsentry/relay/pull/3116))
2323
- Accept transactions with unfinished spans. ([#3162](https://github.com/getsentry/relay/pull/3162))
2424
- Don't run validation on renormalization, and don't normalize spans from librelay calls. ([#3214](https://github.com/getsentry/relay/pull/3214))
25+
- Do not consider strings with the word "tokens" plural to be passwords ([#3106](https://github.com/getsentry/relay/pull/3106))
2526

2627
**Internal**:
2728

relay-event-schema/src/protocol/span.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,26 @@ pub struct SpanData {
260260
#[metastructure(field = "http.response.status_code", legacy_alias = "status_code")]
261261
pub http_response_status_code: Annotated<Value>,
262262

263+
/// The input messages to an AI model call
264+
#[metastructure(field = "ai.input_messages")]
265+
pub ai_input_messages: Annotated<Value>,
266+
267+
/// The number of tokens used to generate the response to an AI call
268+
#[metastructure(field = "ai.completion_tokens.used")]
269+
pub ai_completion_tokens_used: Annotated<Value>,
270+
271+
/// The number of tokens used to process a request for an AI call
272+
#[metastructure(field = "ai.prompt_tokens.used")]
273+
pub ai_prompt_tokens_used: Annotated<Value>,
274+
275+
/// The total number of tokens used to for an AI call
276+
#[metastructure(field = "ai.total_tokens.used")]
277+
pub ai_total_tokens_used: Annotated<Value>,
278+
279+
/// The responses to an AI model call
280+
#[metastructure(field = "ai.responses")]
281+
pub ai_responses: Annotated<Value>,
282+
263283
/// Label identifying a thread from where the span originated.
264284
#[metastructure(field = "thread.name")]
265285
pub thread_name: Annotated<Value>,

relay-pii/src/processor.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ mod tests {
473473
NativeDebugImage, Request, Span, TagEntry, Tags, TraceContext,
474474
};
475475
use relay_protocol::{
476-
assert_annotated_snapshot, get_value, Annotated, FromValue, Object, Value,
476+
assert_annotated_snapshot, get_value, Annotated, FromValue, Object, Val, Value,
477477
};
478478
use serde_json::json;
479479

@@ -1339,6 +1339,33 @@ mod tests {
13391339
);
13401340
}
13411341

1342+
#[test]
1343+
fn test_span_data_tokens() {
1344+
let mut span = Span::from_value(
1345+
json!({
1346+
"data": {
1347+
"ai.total_tokens.used": 10,
1348+
}
1349+
})
1350+
.into(),
1351+
);
1352+
1353+
let ds_config = DataScrubbingConfig {
1354+
scrub_data: true,
1355+
scrub_defaults: true,
1356+
..Default::default()
1357+
};
1358+
let pii_config = ds_config.pii_config().unwrap().as_ref().unwrap();
1359+
1360+
let mut pii_processor = PiiProcessor::new(pii_config.compiled());
1361+
process_value(&mut span, &mut pii_processor, ProcessingState::root()).unwrap();
1362+
1363+
assert_eq!(
1364+
Val::from(get_value!(span.data.ai_total_tokens_used!)).as_u64(),
1365+
Some(10),
1366+
);
1367+
}
1368+
13421369
#[test]
13431370
fn test_scrub_breadcrumb_data_http_not_scrubbed() {
13441371
let mut breadcrumb: Annotated<Breadcrumb> = Annotated::from_json(

relay-pii/src/regexes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,6 @@ static US_SSN_REGEX: Lazy<Regex> = Lazy::new(|| {
286286

287287
static PASSWORD_KEY_REGEX: Lazy<Regex> = Lazy::new(|| {
288288
Regex::new(
289-
r"(?i)(password|secret|passwd|api_key|apikey|auth|credentials|mysql_pwd|privatekey|private_key|token([a-r,t-z]|\b))"
289+
r"(?i)(password|secret|passwd|api_key|apikey|auth|credentials|mysql_pwd|privatekey|private_key|token([^s]|\b))"
290290
).unwrap()
291291
});

0 commit comments

Comments
 (0)