1
- use std:: { pin:: Pin , task:: { Context , Poll , ready } } ;
1
+ use std:: { pin:: Pin , task:: { Context , Poll } } ;
2
2
3
- use futures_util:: Stream ;
3
+ use futures_util:: { Stream , ready } ;
4
4
use vector_core:: event:: Metric ;
5
5
6
6
use super :: buffer:: metrics:: { MetricNormalize , MetricNormalizer } ;
7
7
8
- pub struct Normalizer < St , N >
9
- where
10
- N : MetricNormalize ,
11
- {
8
+ pub struct Normalizer < St , N > {
12
9
stream : St ,
13
- normalizer : MetricNormalizer < N > ,
10
+ normalizer : N ,
11
+ metric_set : MetricSet ,
14
12
}
15
13
16
- impl < St , N > Normalizer < St , N >
17
- where
18
- N : MetricNormalize ,
19
- {
20
- pub fn new ( stream : St ) -> Normalizer < St , N >
21
- where
22
- N : MetricNormalize ,
23
- {
14
+ impl < St , N > Normalizer < St , N > {
15
+ pub fn new ( stream : St , normalizer : N ) -> Self {
24
16
Self {
25
17
stream,
26
- normalizer : MetricNormalizer :: default ( ) ,
18
+ normalizer,
19
+ metric_set : MetricSet :: default ( ) ,
27
20
}
28
21
}
29
22
}
37
30
38
31
fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
39
32
let metric = ready ! ( self . stream. poll_next( cx) ) ;
33
+ let result = N :: apply_state ( & mut self . metric_set , metric) ;
40
34
}
41
35
}
0 commit comments