File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
opentelemetry/src/api/metrics Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ pub struct InstrumentConfig {
6
6
pub ( crate ) description : Option < String > ,
7
7
pub ( crate ) unit : Option < Unit > ,
8
8
pub ( crate ) instrumentation_name : String ,
9
+ pub ( crate ) instrumentation_version : Option < String > ,
9
10
}
10
11
11
12
impl InstrumentConfig {
@@ -15,6 +16,20 @@ impl InstrumentConfig {
15
16
description : None ,
16
17
unit : None ,
17
18
instrumentation_name,
19
+ instrumentation_version : None ,
20
+ }
21
+ }
22
+
23
+ /// Create a new config with instrumentation name and version
24
+ pub fn with_instrumentation (
25
+ instrumentation_name : String ,
26
+ instrumentation_version : String ,
27
+ ) -> Self {
28
+ InstrumentConfig {
29
+ description : None ,
30
+ unit : None ,
31
+ instrumentation_name,
32
+ instrumentation_version : Some ( instrumentation_version) ,
18
33
}
19
34
}
20
35
@@ -32,4 +47,9 @@ impl InstrumentConfig {
32
47
pub fn instrumentation_name ( & self ) -> & String {
33
48
& self . instrumentation_name
34
49
}
50
+
51
+ /// Instrumentation version returns the version of instrumentation
52
+ pub fn instrumentation_version ( & self ) -> Option < & String > {
53
+ self . instrumentation_version . as_ref ( )
54
+ }
35
55
}
You can’t perform that action at this time.
0 commit comments