GitHub user weiqingy edited a comment on the discussion: [Feature] 
Per-Event-Type Configurable Log Levels for Event Log

If max-length is a total size cap, the question becomes: how do we allocate the 
budget across fields? Proportional allocation, equal split, largest-first 
greedy - each has trade-offs, and the result is hard for users to predict. The 
config looks simple (one number), but the behavior is opaque. I'm rethinking 
about this - per-field thresholds seems actually the cleaner model. Each 
threshold independently controls one truncation strategy, so the behavior is 
predictable, e.g.,:
```
  event-log.standard.max-string-length: 2000
  event-log.standard.max-array-elements: 20
  event-log.standard.max-depth: 5
  ...
```
These compose by walking the object graph - array trimming reduces element 
count, then string truncation caps leaf string values within the retained 
structure, and depth collapsing handles deeply nested objects. For example, 
given a ChatRequestEvent with 50 messages and a 10K-char response:

  - max-array-elements: 20 trims messages from 50 to 20 elements
  - max-string-length: 2000 truncates the content field inside each retained 
message (e.g., a 5000-char content → 2000 chars), and truncates the 10K-char 
response to 2000 chars
  - Short fields like model, role, requestId are untouched

  Truncated fields use the wrapper format you suggested for parsability:
```
  {
    "messages": {
      "truncatedList": [
        {"role": "system", "content": "You are a helpful assistant..."},
        {"role": "user", "content": {"truncatedString": "Analyze this doc...", 
"omittedChars": 1000}},
        {"role": "assistant", "content": {"truncatedString": "Based on my...", 
"omittedChars": 3000}}
      ],
      "omittedElements": 30
    },
    "response": {"truncatedString": "Here is my detailed answer...", 
"omittedChars": 8000},
    "model": "gpt-4",
    "tools": ["add", "multiply"]
  }
```
  Each threshold has clear, independent behavior - no opaque budget allocation. 

GitHub link: 
https://github.com/apache/flink-agents/discussions/552#discussioncomment-15981219

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to