Repository navigation
feat: telemetry - #826
feat: telemetry#826
Conversation
Public API Changes
|
ankurdotb
left a comment
There was a problem hiding this comment.
Claude comments:
-
node() reads process.env without a guard (config.ts:43 (packages/sdk/src/node/config.ts)). This now runs inside createConfig, so it throws ReferenceError on runtimes without process (a Worker without nodejs_compat, or a browser bundle that pulls in /node). Using globalThis.process?.env would fix it. The agent put this at 60% confidence; I confirmed the bare read but not the failure.
-
Some operation labels have no test. Nothing asserts vault-deposit, vault-redeem, vault-balance or delegated-user-decrypt, so swapping them would pass CI. The offload-encrypt worker path has no header assertion either. One agent says the live offload CI job passed against the real relayer, which covers it end to end but doesn't assert the headers.
-
Version test is tautological
|
🎉 This PR is included in version 3.7.0-beta.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Adds SDK usage telemetry. Every relayer request now carries four
x-zama-sdk-*headers, which Kong already logs into Grafana:x-zama-sdk-version3.7.0x-zama-sdk-layercoreorreactx-zama-sdk-runtimebrowser(web()) ornode(node())x-zama-sdk-operationconfidential-transfer,unshield,decrypt-balance,vault-*,encrypt,user-decrypt,delegated-user-decrypt,public-decrypt,offline-prepare. Omitted on the FHE key fetch.@fhevm/sdk's per-requestheadersoption and are stamped in one place,FhevmRelayer.createConfig({ telemetry: false })turns it off. On Node,ZAMA_SDK_TELEMETRY=0does the same.ZamaProvidertags its SDK asreact.operationlabel is an@internalfield on the newRelayerRequestOptionstype, so it is stripped from the published types.telemetry?: booleanon the config. The per-call options ofsdk.encryptandsdk.decryption.*change from an inlinePick<FhevmRelayerOptions, "signal" | "timeout">to the namedRelayerRequestOptions, which has the same shape.x-zama-sdk-*headers.Scope
@zama-fhe/sdk@zama-fhe/react-sdk@zama-fhe/test-components@zama-fhe/test-nextjs@zama-fhe/test-viteexamples/)Validation
pnpm typecheckpnpm lintpnpm test:run(all unit tests pass)pnpm buildpnpm api-report:checkpnpm llm:build+pnpm llm:checkpnpm docs:check-linksx-zama-sdk-versioninlines as the version string, and the internaloperationfield is not in the published.d.ts.Related
Demo (if possible)
N/A, no UI change.