diff --git a/Cargo.lock b/Cargo.lock index bb84e5a0d..7dbfd6ae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7143,6 +7143,7 @@ dependencies = [ "spin-llm-local", "spin-llm-remote-http", "spin-locked-app", + "spin-telemetry", "spin-world", "tokio", "toml 0.8.19", diff --git a/crates/factor-llm/Cargo.toml b/crates/factor-llm/Cargo.toml index ef5a98549..e069dbbfd 100644 --- a/crates/factor-llm/Cargo.toml +++ b/crates/factor-llm/Cargo.toml @@ -22,9 +22,10 @@ spin-llm-local = { path = "../llm-local", optional = true } spin-llm-remote-http = { path = "../llm-remote-http" } spin-locked-app = { path = "../locked-app" } spin-world = { path = "../world" } +tracing = { workspace = true } +spin-telemetry = { path = "../telemetry" } tokio = { workspace = true, features = ["sync"] } toml = { workspace = true } -tracing = { workspace = true } url = { version = "2", features = ["serde"] } [dev-dependencies] diff --git a/crates/factor-llm/src/spin.rs b/crates/factor-llm/src/spin.rs index 08ad42745..75507b9d8 100644 --- a/crates/factor-llm/src/spin.rs +++ b/crates/factor-llm/src/spin.rs @@ -71,6 +71,7 @@ impl LlmEngine for RemoteHttpLlmEngine { prompt: String, params: v2::InferencingParams, ) -> Result { + spin_telemetry::monotonic_counter!(spin.llm_infer = 1, model_name = model); self.infer(model, prompt, params).await } diff --git a/examples/spin-timer/Cargo.lock b/examples/spin-timer/Cargo.lock index 41c4e14a6..2b14fc44a 100644 --- a/examples/spin-timer/Cargo.lock +++ b/examples/spin-timer/Cargo.lock @@ -1832,7 +1832,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", + "tower 0.4.13", "tower-service", "tracing", ] @@ -2075,7 +2075,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", - "tower", + "tower 0.4.13", "tracing", ] @@ -3841,6 +3841,7 @@ dependencies = [ "spin-factors", "spin-llm-remote-http", "spin-locked-app", + "spin-telemetry", "spin-world", "tokio", "toml", @@ -4772,7 +4773,7 @@ dependencies = [ "socket2", "tokio", "tokio-stream", - "tower", + "tower 0.4.13", "tower-layer", "tower-service", "tracing", @@ -4798,6 +4799,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -6031,6 +6046,24 @@ dependencies = [ "wit-parser", ] +[[package]] +name = "wit-parser" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb893dcd6d370cfdf19a0d9adfcd403efb8e544e1a0ea3a8b81a21fe392eaa78" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.217.0", +] + [[package]] name = "wit-parser" version = "0.217.0"