|
5 | 5 | "fmt" |
6 | 6 | "reflect" |
7 | 7 | "regexp" |
| 8 | + "slices" |
8 | 9 | "strings" |
9 | 10 |
|
10 | 11 | "github.com/adrg/strutil" |
@@ -57,6 +58,8 @@ type BuiltinFilter struct { |
57 | 58 | HasText *bool `json:",omitempty" default:"false"` |
58 | 59 | // Only process messages that have this tail code. |
59 | 60 | TailCode string `json:",omitempty" default:"N999AP"` |
| 61 | + // Only process messages that have one of these labels |
| 62 | + Labels []string `json:",omitempty" default:"[87,85,81]"` |
60 | 63 | // Only process messages that have this flight number. |
61 | 64 | FlightNumber string `json:",omitempty" default:"N999AP"` |
62 | 65 | // Only process messages that have ASS Status. |
@@ -297,6 +300,15 @@ var ( |
297 | 300 | valueBelow := GetAPMessageCommonFieldAsInt(m, field) < f.LLMProcessedNumberBelow |
298 | 301 | return !valueBelow, reason, nil |
299 | 302 | }, |
| 303 | + "Labels": func(f BuiltinFilter, m APMessage) (filter bool, reason string, err error) { |
| 304 | + field := "Label" |
| 305 | + label := GetAPMessageCommonFieldAsString(m, field) |
| 306 | + var match bool |
| 307 | + if slices.Contains(f.Labels, label) { |
| 308 | + match = true |
| 309 | + } |
| 310 | + return !match, reason, nil |
| 311 | + }, |
300 | 312 | } |
301 | 313 | ) |
302 | 314 |
|
|
0 commit comments