diff --git a/Cargo.lock b/Cargo.lock index 3295d890c..5c0ab488d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7645,6 +7645,7 @@ dependencies = [ "spin-llm-local", "spin-llm-remote-http", "spin-locked-app", + "spin-telemetry", "spin-world", "tokio", "toml 0.8.14", @@ -7923,6 +7924,7 @@ dependencies = [ "lru 0.9.0", "spin-app", "spin-core", + "spin-telemetry", "spin-world", "table", "tokio", diff --git a/crates/factor-llm/Cargo.toml b/crates/factor-llm/Cargo.toml index e5a26b018..e64f35a2d 100644 --- a/crates/factor-llm/Cargo.toml +++ b/crates/factor-llm/Cargo.toml @@ -18,6 +18,7 @@ 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 = { version = "1", features = ["sync"] } toml = "0.8" url = "2" diff --git a/crates/factor-llm/src/spin.rs b/crates/factor-llm/src/spin.rs index 6ebd7a706..10d0abf06 100644 --- a/crates/factor-llm/src/spin.rs +++ b/crates/factor-llm/src/spin.rs @@ -40,6 +40,8 @@ impl LlmEngine for RemoteHttpLlmEngine { prompt: String, params: v2::InferencingParams, ) -> Result { + spin_telemetry::monotonic_counter!(spin.llm_infer = 1, model_name = model); + println!("This is LLM inference for remotehhtpengine"); self.infer(model, prompt, params).await } diff --git a/crates/key-value/Cargo.toml b/crates/key-value/Cargo.toml index e5b53aec5..77659791c 100644 --- a/crates/key-value/Cargo.toml +++ b/crates/key-value/Cargo.toml @@ -13,6 +13,7 @@ tokio = { version = "1", features = ["macros", "sync", "rt"] } spin-app = { path = "../app" } spin-core = { path = "../core" } spin-world = { path = "../world" } +spin-telemetry = { path = "../telemetry" } table = { path = "../table" } tracing = { workspace = true } lru = "0.9.0" diff --git a/crates/key-value/src/lib.rs b/crates/key-value/src/lib.rs index c9d2b6354..820fb5140 100644 --- a/crates/key-value/src/lib.rs +++ b/crates/key-value/src/lib.rs @@ -98,6 +98,8 @@ impl key_value::HostStore for KeyValueDispatch { store: Resource, key: String, ) -> Result>, Error>> { + spin_telemetry::monotonic_counter!(spin.key_value_get = 1, key = key); + let store = self.get_store(store)?; Ok(store.get(&key).await) } @@ -108,6 +110,8 @@ impl key_value::HostStore for KeyValueDispatch { key: String, value: Vec, ) -> Result> { + spin_telemetry::monotonic_counter!(spin.key_value_set = 1, key = key); + let store = self.get_store(store)?; Ok(store.set(&key, &value).await) } diff --git a/examples/spin-timer/Cargo.lock b/examples/spin-timer/Cargo.lock index 425b5c4b7..11157e073 100644 --- a/examples/spin-timer/Cargo.lock +++ b/examples/spin-timer/Cargo.lock @@ -5662,6 +5662,7 @@ dependencies = [ "lru 0.9.0", "spin-app", "spin-core", + "spin-telemetry", "spin-world", "table", "tokio",