File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ pub trait Connector: Send + 'static {
44
44
/// The type of unserializable state
45
45
type State : Send + Sync ;
46
46
47
- fn connector_name ( ) -> String ;
47
+ fn connector_name ( ) -> & ' static str ;
48
48
49
- fn connector_version ( ) -> String ;
49
+ fn connector_version ( ) -> & ' static str ;
50
50
51
51
/// Update any metrics from the state
52
52
///
Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ impl Connector for Example {
34
34
type Configuration = ( ) ;
35
35
type State = ( ) ;
36
36
37
- fn connector_name ( ) -> String {
38
- "example" . into ( )
37
+ fn connector_name ( ) -> & ' static str {
38
+ "example"
39
39
}
40
40
41
- fn connector_version ( ) -> String {
42
- "1.0.0" . into ( )
41
+ fn connector_version ( ) -> & ' static str {
42
+ env ! ( "CARGO_PKG_VERSION" )
43
43
}
44
44
45
45
fn fetch_metrics ( _configuration : & Self :: Configuration , _state : & Self :: State ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ static CONNECTOR_VERSION: &str = "service.connector.version";
17
17
pub fn init_tracing (
18
18
service_name : Option < & str > ,
19
19
otlp_endpoint : Option < & str > ,
20
- connector_name : String ,
21
- connector_version : String ,
20
+ connector_name : & str ,
21
+ connector_version : & str ,
22
22
) -> Result < ( ) , Box < dyn Error + Send + Sync > > {
23
23
let trace_endpoint = otlp_endpoint
24
24
. map ( ToOwned :: to_owned)
You can’t perform that action at this time.
0 commit comments