(tokens []string)
| 94 | } |
| 95 | |
| 96 | func (d *Drain) train(tokens []string) *LogCluster { |
| 97 | cluster := d.findMatchingClusterForTokens(tokens) |
| 98 | |
| 99 | if cluster == nil { |
| 100 | cluster = d.newCluster(tokens) |
| 101 | d.addClusterToRootNode(cluster) |
| 102 | d.metrics.PatternsDetectedTotal.Inc() |
| 103 | } else { |
| 104 | cluster.ingestTokens(tokens) |
| 105 | } |
| 106 | |
| 107 | d.idToCluster.Put(cluster) |
| 108 | return cluster |
| 109 | } |
| 110 | |
| 111 | // Prune removes old branches from the tree. We rely on the cache eviction |
| 112 | // algorithm to remove clusters from the cache, then this method will remove |
no test coverage detected