Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions relay-event-schema/src/protocol/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,17 +553,15 @@ pub struct SpanData {
#[metastructure(field = "gen_ai.cost.output_tokens", pii = "maybe")]
pub gen_ai_cost_output_tokens: Annotated<Value>,

/// Prompt passed to LLM (Vercel AI SDK)
#[metastructure(field = "gen_ai.prompt", pii = "maybe")]
pub gen_ai_prompt: Annotated<Value>,

/// Prompt passed to LLM
/// The input messages to the model call.
#[metastructure(
field = "gen_ai.request.messages",
field = "gen_ai.input.messages",
pii = "maybe",
legacy_alias = "gen_ai.prompt",
legacy_alias = "gen_ai.request.messages",
legacy_alias = "ai.prompt.messages"
)]
pub gen_ai_request_messages: Annotated<Value>,
pub gen_ai_input_messages: Annotated<Value>,

/// Tool call arguments
#[metastructure(
Expand All @@ -590,14 +588,15 @@ pub struct SpanData {
)]
pub gen_ai_response_tool_calls: Annotated<Value>,

/// LLM response text (Vercel AI, generateText)
/// The output messages from the model call.
#[metastructure(
field = "gen_ai.response.text",
field = "gen_ai.output.messages",
legacy_alias = "gen_ai.response.text",
legacy_alias = "ai.response.text",
legacy_alias = "ai.responses",
pii = "maybe"
)]
pub gen_ai_response_text: Annotated<Value>,
pub gen_ai_output_messages: Annotated<Value>,

/// LLM response object (Vercel AI, generateObject)
#[metastructure(field = "gen_ai.response.object", pii = "maybe")]
Expand Down Expand Up @@ -700,14 +699,6 @@ pub struct SpanData {
#[metastructure(field = "gen_ai.function_id", pii = "maybe")]
pub gen_ai_function_id: Annotated<String>,

/// The input messages to the model call.
#[metastructure(field = "gen_ai.input.messages", pii = "maybe")]
pub gen_ai_input_messages: Annotated<Value>,

/// The output messages from the model call.
#[metastructure(field = "gen_ai.output.messages", pii = "maybe")]
pub gen_ai_output_messages: Annotated<Value>,

/// The result of the MCP prompt.
#[metastructure(field = "mcp.prompt.result", pii = "maybe")]
pub mcp_prompt_result: Annotated<Value>,
Expand Down Expand Up @@ -1526,12 +1517,11 @@ mod tests {
gen_ai_cost_total_tokens: ~,
gen_ai_cost_input_tokens: ~,
gen_ai_cost_output_tokens: ~,
gen_ai_prompt: ~,
gen_ai_request_messages: ~,
gen_ai_input_messages: ~,
gen_ai_tool_input: ~,
gen_ai_tool_output: ~,
gen_ai_response_tool_calls: ~,
gen_ai_response_text: ~,
gen_ai_output_messages: ~,
gen_ai_response_object: ~,
gen_ai_response_streaming: ~,
gen_ai_response_tokens_per_second: ~,
Expand All @@ -1552,8 +1542,6 @@ mod tests {
gen_ai_operation_type: ~,
gen_ai_agent_name: ~,
gen_ai_function_id: ~,
gen_ai_input_messages: ~,
gen_ai_output_messages: ~,
mcp_prompt_result: ~,
mcp_tool_result_content: ~,
browser_name: ~,
Expand Down
7 changes: 2 additions & 5 deletions relay-event-schema/src/protocol/span/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,11 @@ mod tests {
gen_ai_cost_total_tokens: ~,
gen_ai_cost_input_tokens: ~,
gen_ai_cost_output_tokens: ~,
gen_ai_prompt: ~,
gen_ai_request_messages: ~,
gen_ai_input_messages: ~,
gen_ai_tool_input: ~,
gen_ai_tool_output: ~,
gen_ai_response_tool_calls: ~,
gen_ai_response_text: ~,
gen_ai_output_messages: ~,
gen_ai_response_object: ~,
gen_ai_response_streaming: ~,
gen_ai_response_tokens_per_second: ~,
Expand All @@ -209,8 +208,6 @@ mod tests {
gen_ai_operation_type: ~,
gen_ai_agent_name: ~,
gen_ai_function_id: ~,
gen_ai_input_messages: ~,
gen_ai_output_messages: ~,
mcp_prompt_result: ~,
mcp_tool_result_content: ~,
browser_name: "Chrome",
Expand Down
25 changes: 11 additions & 14 deletions relay-pii/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,25 @@ static REPLACE_ONLY_SELECTOR: LazyLock<SelectorSpec> = LazyLock::new(|| {
[
"$logentry.formatted",
"$log.body",
"$span.data.'gen_ai.prompt'",
"$span.data.'gen_ai.input.messages'",
"attributes.'gen_ai.input.messages'.value",
"attributes.'gen_ai.prompt'.value",
"$span.data.'gen_ai.request.messages'",
"attributes.'gen_ai.request.messages'.value",
"$span.data.'gen_ai.tool.input'",
"attributes.'gen_ai.tool.input'.value",
"$span.data.'gen_ai.tool.output'",
"attributes.'gen_ai.tool.output'.value",
"$span.data.'gen_ai.response.tool_calls'",
"attributes.'gen_ai.response.tool_calls'.value",
"$span.data.'gen_ai.response.text'",
"$span.data.'gen_ai.output.messages'",
"attributes.'gen_ai.output.messages'.value",
"attributes.'gen_ai.response.text'.value",
"$span.data.'gen_ai.response.object'",
"attributes.'gen_ai.response.object'.value",
"$span.data.'gen_ai.request.available_tools'",
"attributes.'gen_ai.request.available_tools'.value",
"$span.data.'gen_ai.tool.name'",
"attributes.'gen_ai.tool.name'.value",
"$span.data.'gen_ai.input.messages'",
"attributes.'gen_ai.input.messages'.value",
"$span.data.'gen_ai.output.messages'",
"attributes.'gen_ai.output.messages'.value",
"$span.data.'mcp.prompt.result'",
"attributes.'mcp.prompt.result'.value",
"$span.data.'mcp.tool.result.content'",
Expand Down Expand Up @@ -362,7 +359,7 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"$http.env.REMOTE_ADDR || $user.ip_address || $sdk.client_ip || $span.sentry_tags.'user.ip'": [
"@anything:remove"
],
"$logentry.formatted || $log.body || $span.data.'gen_ai.prompt' || attributes.'gen_ai.prompt'.value || $span.data.'gen_ai.request.messages' || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.response.text' || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"$logentry.formatted || $log.body || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || attributes.'gen_ai.prompt'.value || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"@email:replace",
"@creditcard:replace",
"@iban:replace",
Expand Down Expand Up @@ -394,7 +391,7 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"$http.env.REMOTE_ADDR || $user.ip_address || $sdk.client_ip || $span.sentry_tags.'user.ip'": [
"@anything:remove"
],
"$logentry.formatted || $log.body || $span.data.'gen_ai.prompt' || attributes.'gen_ai.prompt'.value || $span.data.'gen_ai.request.messages' || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.response.text' || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"$logentry.formatted || $log.body || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || attributes.'gen_ai.prompt'.value || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"@email:replace",
"@creditcard:replace",
"@iban:replace",
Expand Down Expand Up @@ -437,7 +434,7 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"$http.env.REMOTE_ADDR || $user.ip_address || $sdk.client_ip || $span.sentry_tags.'user.ip'": [
"@anything:remove"
],
"$logentry.formatted || $log.body || $span.data.'gen_ai.prompt' || attributes.'gen_ai.prompt'.value || $span.data.'gen_ai.request.messages' || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.response.text' || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"$logentry.formatted || $log.body || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || attributes.'gen_ai.prompt'.value || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"@email:replace",
"@creditcard:replace",
"@iban:replace",
Expand Down Expand Up @@ -469,7 +466,7 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"$http.env.REMOTE_ADDR || $user.ip_address || $sdk.client_ip || $span.sentry_tags.'user.ip'": [
"@anything:remove"
],
"$logentry.formatted || $log.body || $span.data.'gen_ai.prompt' || attributes.'gen_ai.prompt'.value || $span.data.'gen_ai.request.messages' || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.response.text' || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"$logentry.formatted || $log.body || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || attributes.'gen_ai.prompt'.value || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"@email:replace",
"@creditcard:replace",
"@iban:replace",
Expand Down Expand Up @@ -1390,7 +1387,7 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"$http.env.REMOTE_ADDR || $user.ip_address || $sdk.client_ip || $span.sentry_tags.'user.ip'": [
"@anything:remove"
],
"$logentry.formatted || $log.body || $span.data.'gen_ai.prompt' || attributes.'gen_ai.prompt'.value || $span.data.'gen_ai.request.messages' || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.response.text' || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"$logentry.formatted || $log.body || $span.data.'gen_ai.input.messages' || attributes.'gen_ai.input.messages'.value || attributes.'gen_ai.prompt'.value || attributes.'gen_ai.request.messages'.value || $span.data.'gen_ai.tool.input' || attributes.'gen_ai.tool.input'.value || $span.data.'gen_ai.tool.output' || attributes.'gen_ai.tool.output'.value || $span.data.'gen_ai.response.tool_calls' || attributes.'gen_ai.response.tool_calls'.value || $span.data.'gen_ai.output.messages' || attributes.'gen_ai.output.messages'.value || attributes.'gen_ai.response.text'.value || $span.data.'gen_ai.response.object' || attributes.'gen_ai.response.object'.value || $span.data.'gen_ai.request.available_tools' || attributes.'gen_ai.request.available_tools'.value || $span.data.'gen_ai.tool.name' || attributes.'gen_ai.tool.name'.value || $span.data.'mcp.prompt.result' || attributes.'mcp.prompt.result'.value || $span.data.'mcp.tool.result.content' || attributes.'mcp.tool.result.content'.value": [
"@email:replace",
"@creditcard:replace",
"@iban:replace",
Expand Down Expand Up @@ -1992,15 +1989,15 @@ THd+9FBxiHLGXNKhG/FRSyREXEt+NyYIf/0cyByc9tNksat794ddUqnLOg0vwSkv
"spans": [
{
"data": {
"gen_ai.prompt": "Buy me a drink with my creditcard [creditcard]"
"gen_ai.input.messages": "Buy me a drink with my creditcard [creditcard]"
}
}
],
"_meta": {
"spans": {
"0": {
"data": {
"gen_ai.prompt": {
"gen_ai.input.messages": {
"": {
"rem": [
[
Expand Down
Loading
Loading