Skip to content

Commit 30a78a9

Browse files
committed
Return static strings
1 parent 565013d commit 30a78a9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

crates/sdk-core/src/connector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ pub trait Connector: Send + 'static {
4444
/// The type of unserializable state
4545
type State: Send + Sync;
4646

47-
fn connector_name() -> String;
47+
fn connector_name() -> &'static str;
4848

49-
fn connector_version() -> String;
49+
fn connector_version() -> &'static str;
5050

5151
/// Update any metrics from the state
5252
///

crates/sdk-core/src/connector/example.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ impl Connector for Example {
3434
type Configuration = ();
3535
type State = ();
3636

37-
fn connector_name() -> String {
38-
"example".into()
37+
fn connector_name() -> &'static str {
38+
"example"
3939
}
4040

41-
fn connector_version() -> String {
42-
"1.0.0".into()
41+
fn connector_version() -> &'static str {
42+
env!("CARGO_PKG_VERSION")
4343
}
4444

4545
fn fetch_metrics(_configuration: &Self::Configuration, _state: &Self::State) -> Result<()> {

crates/sdk/src/tracing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ static CONNECTOR_VERSION: &str = "service.connector.version";
1717
pub fn init_tracing(
1818
service_name: Option<&str>,
1919
otlp_endpoint: Option<&str>,
20-
connector_name: String,
21-
connector_version: String,
20+
connector_name: &str,
21+
connector_version: &str,
2222
) -> Result<(), Box<dyn Error + Send + Sync>> {
2323
let trace_endpoint = otlp_endpoint
2424
.map(ToOwned::to_owned)

0 commit comments

Comments
 (0)