@@ -46,32 +46,13 @@ use tokio::time::Sleep;
46
46
// The `KstatSampler` generates some statistics about its own operation, mostly
47
47
// for surfacing failures to collect and dropped samples.
48
48
mod self_stats {
49
+ oximeter:: use_timeseries!( "kstat-sampler.toml" ) ;
49
50
use super :: BTreeMap ;
50
51
use super :: Cumulative ;
51
52
use super :: TargetId ;
52
-
53
- /// Information identifying this kstat sampler.
54
- #[ derive( Debug , oximeter:: Target ) ]
55
- pub struct KstatSampler {
56
- /// The hostname (or zonename) of the host machine.
57
- pub hostname : String ,
58
- }
59
-
60
- /// The total number of samples dropped for a single target.
61
- #[ derive( Debug , oximeter:: Metric ) ]
62
- pub struct SamplesDropped {
63
- /// The ID of the target being tracked.
64
- pub target_id : u64 ,
65
- /// The name of the target being tracked.
66
- pub target_name : String ,
67
- pub datum : Cumulative < u64 > ,
68
- }
69
-
70
- /// The cumulative number of expired targets.
71
- #[ derive( Debug , oximeter:: Metric ) ]
72
- pub struct ExpiredTargets {
73
- pub datum : Cumulative < u64 > ,
74
- }
53
+ pub use kstat_sampler:: ExpiredTargets ;
54
+ pub use kstat_sampler:: KstatSampler ;
55
+ pub use kstat_sampler:: SamplesDropped ;
75
56
76
57
#[ derive( Debug ) ]
77
58
pub struct SelfStats {
@@ -85,7 +66,7 @@ mod self_stats {
85
66
impl SelfStats {
86
67
pub fn new ( hostname : String ) -> Self {
87
68
Self {
88
- target : KstatSampler { hostname } ,
69
+ target : KstatSampler { hostname : hostname . into ( ) } ,
89
70
drops : BTreeMap :: new ( ) ,
90
71
expired : ExpiredTargets { datum : Cumulative :: new ( 0 ) } ,
91
72
}
@@ -797,7 +778,7 @@ impl KstatSamplerWorker {
797
778
* drops += n_overflow_samples as u64 ;
798
779
let metric = self_stats:: SamplesDropped {
799
780
target_id : target_id. 0 ,
800
- target_name,
781
+ target_name : target_name . into ( ) ,
801
782
datum : * drops,
802
783
} ;
803
784
let sample = match Sample :: new ( & stats. target , & metric) {
0 commit comments