diff --git a/Cargo.lock b/Cargo.lock index b94bde3868..a1cf2a5136 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9231,6 +9231,7 @@ dependencies = [ "spin-factors-test", "spin-locked-app", "spin-resource-table", + "spin-telemetry", "spin-wasi-async", "spin-world", "tokio", diff --git a/crates/factor-outbound-mqtt/src/host.rs b/crates/factor-outbound-mqtt/src/host.rs index 5a090f3772..63d2932a90 100644 --- a/crates/factor-outbound-mqtt/src/host.rs +++ b/crates/factor-outbound-mqtt/src/host.rs @@ -163,8 +163,12 @@ impl v3::HostConnectionWithStore for crate::MqttFactorData { } #[instrument(name = "spin_outbound_mqtt.publish", skip(accessor, connection, payload), err(level = Level::INFO), - fields(otel.kind = "producer", otel.name = format!("{} publish", topic), messaging.operation = "publish", - messaging.system = "mqtt"))] + fields( + otel.kind = "producer", + messaging.operation = "publish", + messaging.system = "mqtt", + messaging.destination.name = topic, + ))] async fn publish( accessor: &Accessor, connection: Resource, @@ -236,8 +240,12 @@ impl v2::HostConnection for InstanceState { /// current trace context into the payload yourself. /// https://w3c.github.io/trace-context-mqtt/#mqtt-v3-recommendation. #[instrument(name = "spin_outbound_mqtt.publish", skip(self, connection, payload), err(level = Level::INFO), - fields(otel.kind = "producer", otel.name = format!("{} publish", topic), messaging.operation = "publish", - messaging.system = "mqtt"))] + fields( + otel.kind = "producer", + messaging.operation = "publish", + messaging.system = "mqtt", + messaging.destination.name = topic, + ))] async fn publish( &mut self, connection: Resource, diff --git a/crates/factor-outbound-mysql/src/host.rs b/crates/factor-outbound-mysql/src/host.rs index 0e3fdf512c..79d94186bb 100644 --- a/crates/factor-outbound-mysql/src/host.rs +++ b/crates/factor-outbound-mysql/src/host.rs @@ -178,7 +178,8 @@ impl v3::HostConnectionWithStore for MysqlFactorData { impl v2::Host for InstanceState {} impl v2::HostConnection for InstanceState { - #[instrument(name = "spin_outbound_mysql.open", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_mysql.open", skip(self, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open(&mut self, address: String) -> Result, v2::Error> { let permit = self .semaphore @@ -193,7 +194,8 @@ impl v2::HostConnection for InstanceState { .map(Resource::new_own) } - #[instrument(name = "spin_outbound_mysql.execute", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql", otel.name = statement))] + #[instrument(name = "spin_outbound_mysql.execute", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql"))] async fn execute( &mut self, connection: Resource, @@ -211,7 +213,8 @@ impl v2::HostConnection for InstanceState { .map_err(track_db_error_on_span) } - #[instrument(name = "spin_outbound_mysql.query", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql", otel.name = statement))] + #[instrument(name = "spin_outbound_mysql.query", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "mysql"))] async fn query( &mut self, connection: Resource, diff --git a/crates/factor-outbound-pg/src/host.rs b/crates/factor-outbound-pg/src/host.rs index 34b66249f0..09f1951f80 100644 --- a/crates/factor-outbound-pg/src/host.rs +++ b/crates/factor-outbound-pg/src/host.rs @@ -92,7 +92,8 @@ fn v3_params_to_v4(params: Vec) -> Vec { } impl v3::HostConnection for InstanceState { - #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open(&mut self, address: String) -> Result, v3::Error> { spin_factor_outbound_networking::record_address_fields(&address); @@ -106,7 +107,8 @@ impl v3::HostConnection for InstanceState { .map_err(v3::Error::from) } - #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn execute( &mut self, connection: Resource, @@ -122,7 +124,8 @@ impl v3::HostConnection for InstanceState { .map_err(track_db_error_on_span_v3) } - #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn query( &mut self, connection: Resource, @@ -199,7 +202,8 @@ impl v4::HostConnectionBuilder for InstanceState { } impl v4::HostConnection for InstanceState { - #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open(&mut self, address: String) -> Result, v4::Error> { spin_factor_outbound_networking::record_address_fields(&address); @@ -210,7 +214,8 @@ impl v4::HostConnection for InstanceState { self.open_connection(&address, None).await } - #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn execute( &mut self, connection: Resource, @@ -224,7 +229,8 @@ impl v4::HostConnection for InstanceState { .map_err(track_db_error_on_span_v4) } - #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn query( &mut self, connection: Resource, @@ -247,7 +253,8 @@ impl v4::HostConnection for InstanceState { impl spin_world::spin::postgres4_2_0::postgres::HostConnectionWithStore for crate::PgFactorData { - #[instrument(name = "spin_outbound_pg.open_async", skip(accessor, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_pg.open_async", skip(accessor, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open_async( accessor: &Accessor, address: String, @@ -260,7 +267,8 @@ impl spin_world::spin::postgres4_2_0::postgres::HostConnectio Self::open_connection_async(accessor, &address, None).await } - #[instrument(name = "spin_outbound_pg.execute", skip(accessor, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.execute", skip(accessor, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn execute_async( accessor: &Accessor, connection: Resource, @@ -282,7 +290,8 @@ impl spin_world::spin::postgres4_2_0::postgres::HostConnectio } #[allow(clippy::type_complexity)] // blame bindgen, clippy, blame bindgen - #[instrument(name = "spin_outbound_pg.query_async", skip(accessor, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.query_async", skip(accessor, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn query_async( accessor: &Accessor, connection: Resource, @@ -472,7 +481,8 @@ macro_rules! delegate { impl v2::Host for InstanceState {} impl v2::HostConnection for InstanceState { - #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_pg.open", skip(self, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open(&mut self, address: String) -> Result, v2::Error> { self.otel.reparent_tracing_span(); spin_factor_outbound_networking::record_address_fields(&address); @@ -486,7 +496,8 @@ impl v2::HostConnection for InstanceState { .map_err(v2::Error::from) } - #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.execute", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn execute( &mut self, connection: Resource, @@ -506,7 +517,8 @@ impl v2::HostConnection for InstanceState { .map_err(track_db_error_on_span_v2) } - #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql", otel.name = statement))] + #[instrument(name = "spin_outbound_pg.query", skip(self, connection, params), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "postgresql"))] async fn query( &mut self, connection: Resource, diff --git a/crates/factor-outbound-redis/src/host.rs b/crates/factor-outbound-redis/src/host.rs index f349cf1992..6414a8e922 100644 --- a/crates/factor-outbound-redis/src/host.rs +++ b/crates/factor-outbound-redis/src/host.rs @@ -236,7 +236,8 @@ impl crate::RedisFactorData { } impl v3::HostConnectionWithStore for crate::RedisFactorData { - #[instrument(name = "spin_outbound_redis.open_connection", skip(accessor, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_redis.open_connection", skip(accessor, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open( accessor: &Accessor, address: String, @@ -281,7 +282,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { }) } - #[instrument(name = "spin_outbound_redis.publish", skip(accessor, connection, payload), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("PUBLISH {}", channel)))] + #[instrument(name = "spin_outbound_redis.publish", skip(accessor, connection, payload), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "PUBLISH"))] async fn publish( accessor: &Accessor, connection: Resource, @@ -292,7 +294,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::publish(&mut conn, channel, payload).await } - #[instrument(name = "spin_outbound_redis.get", skip(accessor, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("GET {}", key)))] + #[instrument(name = "spin_outbound_redis.get", skip(accessor, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "GET"))] async fn get( accessor: &Accessor, connection: Resource, @@ -302,7 +305,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::get(&mut conn, key).await } - #[instrument(name = "spin_outbound_redis.set", skip(accessor, connection, value), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SET {}", key)))] + #[instrument(name = "spin_outbound_redis.set", skip(accessor, connection, value), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SET"))] async fn set( accessor: &Accessor, connection: Resource, @@ -313,7 +317,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::set(&mut conn, key, value).await } - #[instrument(name = "spin_outbound_redis.incr", skip(accessor, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("INCRBY {} 1", key)))] + #[instrument(name = "spin_outbound_redis.incr", skip(accessor, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "INCRBY"))] async fn incr( accessor: &Accessor, connection: Resource, @@ -323,7 +328,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::incr(&mut conn, key).await } - #[instrument(name = "spin_outbound_redis.del", skip(accessor, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("DEL {}", keys.join(" "))))] + #[instrument(name = "spin_outbound_redis.del", skip(accessor, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "DEL"))] async fn del( accessor: &Accessor, connection: Resource, @@ -333,7 +339,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::del(&mut conn, keys).await } - #[instrument(name = "spin_outbound_redis.sadd", skip(accessor, connection, values), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SADD {} {}", key, values.join(" "))))] + #[instrument(name = "spin_outbound_redis.sadd", skip(accessor, connection, values), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SADD"))] async fn sadd( accessor: &Accessor, connection: Resource, @@ -344,7 +351,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::sadd(&mut conn, key, values).await } - #[instrument(name = "spin_outbound_redis.smembers", skip(accessor, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SMEMBERS {}", key)))] + #[instrument(name = "spin_outbound_redis.smembers", skip(accessor, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SMEMBERS"))] async fn smembers( accessor: &Accessor, connection: Resource, @@ -354,7 +362,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::smembers(&mut conn, key).await } - #[instrument(name = "spin_outbound_redis.srem", skip(accessor, connection, values), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SREM {} {}", key, values.join(" "))))] + #[instrument(name = "spin_outbound_redis.srem", skip(accessor, connection, values), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SREM"))] async fn srem( accessor: &Accessor, connection: Resource, @@ -365,7 +374,8 @@ impl v3::HostConnectionWithStore for crate::RedisFactorData { operations::srem(&mut conn, key, values).await } - #[instrument(name = "spin_outbound_redis.execute", skip(accessor, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("{}", command)))] + #[instrument(name = "spin_outbound_redis.execute", skip(accessor, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("{}", command)))] async fn execute( accessor: &Accessor, connection: Resource, @@ -386,7 +396,8 @@ impl v2::Host for crate::InstanceState { } impl v2::HostConnection for crate::InstanceState { - #[instrument(name = "spin_outbound_redis.open_connection", skip(self, address), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] + #[instrument(name = "spin_outbound_redis.open_connection", skip(self, address), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", {otel_attribute::SERVER_ADDRESS} = Empty, {otel_attribute::SERVER_PORT} = Empty, {otel_attribute::DB_NAMESPACE} = Empty))] async fn open(&mut self, address: String) -> Result, v2::Error> { self.otel.reparent_tracing_span(); if !self @@ -400,7 +411,8 @@ impl v2::HostConnection for crate::InstanceState { self.establish_connection(address).await } - #[instrument(name = "spin_outbound_redis.publish", skip(self, connection, payload), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("PUBLISH {}", channel)))] + #[instrument(name = "spin_outbound_redis.publish", skip(self, connection, payload), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "PUBLISH"))] async fn publish( &mut self, connection: Resource, @@ -414,7 +426,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::publish(conn, channel, payload).await?) } - #[instrument(name = "spin_outbound_redis.get", skip(self, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("GET {}", key)))] + #[instrument(name = "spin_outbound_redis.get", skip(self, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "GET"))] async fn get( &mut self, connection: Resource, @@ -427,7 +440,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::get(conn, key).await?) } - #[instrument(name = "spin_outbound_redis.set", skip(self, connection, value), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SET {}", key)))] + #[instrument(name = "spin_outbound_redis.set", skip(self, connection, value), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SET"))] async fn set( &mut self, connection: Resource, @@ -440,7 +454,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::set(conn, key, value).await?) } - #[instrument(name = "spin_outbound_redis.incr", skip(self, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("INCRBY {} 1", key)))] + #[instrument(name = "spin_outbound_redis.incr", skip(self, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "INCRBY"))] async fn incr( &mut self, connection: Resource, @@ -452,7 +467,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::incr(conn, key).await?) } - #[instrument(name = "spin_outbound_redis.del", skip(self, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("DEL {}", keys.join(" "))))] + #[instrument(name = "spin_outbound_redis.del", skip(self, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "DEL"))] async fn del( &mut self, connection: Resource, @@ -464,7 +480,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::del(conn, keys).await?) } - #[instrument(name = "spin_outbound_redis.sadd", skip(self, connection, values), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SADD {} {}", key, values.join(" "))))] + #[instrument(name = "spin_outbound_redis.sadd", skip(self, connection, values), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SADD"))] async fn sadd( &mut self, connection: Resource, @@ -477,7 +494,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::sadd(conn, key, values).await?) } - #[instrument(name = "spin_outbound_redis.smembers", skip(self, connection), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SMEMBERS {}", key)))] + #[instrument(name = "spin_outbound_redis.smembers", skip(self, connection), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SMEMBERS"))] async fn smembers( &mut self, connection: Resource, @@ -489,7 +507,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::smembers(conn, key).await?) } - #[instrument(name = "spin_outbound_redis.srem", skip(self, connection, values), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("SREM {} {}", key, values.join(" "))))] + #[instrument(name = "spin_outbound_redis.srem", skip(self, connection, values), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = "SREM"))] async fn srem( &mut self, connection: Resource, @@ -502,7 +521,8 @@ impl v2::HostConnection for crate::InstanceState { Ok(operations::srem(conn, key, values).await?) } - #[instrument(name = "spin_outbound_redis.execute", skip(self, connection, arguments), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = format!("{}", command)))] + #[instrument(name = "spin_outbound_redis.execute", skip(self, connection, arguments), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "redis", otel.name = command))] async fn execute( &mut self, connection: Resource, diff --git a/crates/factor-sqlite/Cargo.toml b/crates/factor-sqlite/Cargo.toml index fa98e585ba..4774898d56 100644 --- a/crates/factor-sqlite/Cargo.toml +++ b/crates/factor-sqlite/Cargo.toml @@ -16,6 +16,7 @@ spin-factor-otel = { path = "../factor-otel" } spin-factors = { path = "../factors" } spin-locked-app = { path = "../locked-app" } spin-resource-table = { path = "../table" } +spin-telemetry = { path = "../telemetry" } spin-wasi-async = { path = "../wasi-async" } spin-world = { path = "../world" } tokio = { workspace = true, features = ["sync"] } diff --git a/crates/factor-sqlite/src/host.rs b/crates/factor-sqlite/src/host.rs index 3833984942..e4e321c24d 100644 --- a/crates/factor-sqlite/src/host.rs +++ b/crates/factor-sqlite/src/host.rs @@ -102,12 +102,14 @@ impl v3::Host for InstanceState { } impl v3::HostConnection for InstanceState { - #[instrument(name = "spin_sqlite.open", skip(self), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] + #[instrument(name = "spin_sqlite.open", skip(self), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] async fn open(&mut self, database: String) -> Result, v3::Error> { self.open_impl(database).await } - #[instrument(name = "spin_sqlite.execute", skip(self, connection, parameters), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", otel.name = query, sqlite.backend = Empty))] + #[instrument(name = "spin_sqlite.execute", skip(self, connection, parameters), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] async fn execute( &mut self, connection: Resource, @@ -275,13 +277,15 @@ impl v2::Host for InstanceState { } impl v2::HostConnection for InstanceState { - #[instrument(name = "spin_sqlite.open", skip(self), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] + #[instrument(name = "spin_sqlite.open", skip(self), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] async fn open(&mut self, database: String) -> Result, v2::Error> { self.otel.reparent_tracing_span(); self.open_impl(database).await.map_err(to_v2_error) } - #[instrument(name = "spin_sqlite.execute", skip(self, connection, parameters), err(level = Level::INFO), fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", otel.name = query, sqlite.backend = Empty))] + #[instrument(name = "spin_sqlite.execute", skip(self, connection, parameters), err(level = Level::INFO), + fields(otel.kind = "client", {otel_attribute::DB_SYSTEM_NAME} = "sqlite", sqlite.backend = Empty))] async fn execute( &mut self, connection: Resource,