chore(telemetry): pin worker project_name in registerWorker options#426
Conversation
iii-sdk's InitOptions.telemetry.project_name field falls back to auto-detection when omitted — cwd / package.json basename / hostname, in that order — which produces inconsistent identifiers per host (`agentmemory`, `node`, `npm`, occasionally the user's home dir basename when run via npx). Setting it explicitly to "agentmemory" gives every install the same stable project identifier in the engine's metrics + traces output, so downstream attribution and grouping read cleanly. Also pins `language: "node"` and `framework: "iii-sdk"` for the same reason — auto-detection of those two has the same divergence problem across install paths (npm global vs npx vs source build). No behavior change for users. No new deps. iii-sdk 0.11.6 exposes these fields under InitOptions.telemetry — see node_modules/iii-sdk/dist/index.d.mts:32-37 (TelemetryOptions).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughWorker registration in ChangesWorker Telemetry Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/index.ts (1)
173-179: 💤 Low valueRefine comment to focus on WHY rather than WHAT.
The first sentence explains what the code does, which is already clear from the field name. As per coding guidelines, comments should explain WHY rather than WHAT. Consider removing "Explicit worker telemetry metadata." and starting with "iii-sdk falls back to..." to focus on the rationale.
♻️ Suggested refinement
- // Explicit worker telemetry metadata. iii-sdk falls back to - // auto-detection (cwd / package.json name / hostname) when this - // is omitted, which produces inconsistent values per host — + // iii-sdk falls back to auto-detection (cwd / package.json name / + // hostname) when telemetry is omitted, which produces inconsistent values per host — // `agentmemory`, `node`, `npm`, occasionally the user's home // directory basename. Pinning the value here gives every install // the same stable project identifier for downstream attribution // and grouping in the engine's metrics + traces output.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/index.ts` around lines 173 - 179, The comment describing the telemetry metadata is explaining WHAT rather than WHY; update the comment near the worker telemetry metadata field so it focuses on the rationale: remove the opening sentence "Explicit worker telemetry metadata." and begin with "iii-sdk falls back to auto-detection (cwd / package.json name / hostname)..." then explain that this fallback causes inconsistent values like `agentmemory`, `node`, `npm`, or the user's home directory basename and that pinning the value ensures a stable project identifier for downstream attribution and grouping in the engine's metrics/traces; keep the rest of the explanation but trim redundant wording to emphasize the reason for pinning the value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/index.ts`:
- Around line 180-184: Replace the current comment that describes "what" with a
why-focused comment above the telemetry block: remove the "Explicit worker
telemetry metadata" line and instead add a brief explanation that iii-sdk falls
back to auto-detection (cwd / package.json name / hostname) producing
inconsistent values across hosts, so we pin
telemetry.project_name/project_name="agentmemory" and
telemetry.language/telemetry.framework to provide a stable project identifier
for downstream metrics and traces; keep the telemetry object with keys
project_name, language, and framework as shown.
---
Nitpick comments:
In `@src/index.ts`:
- Around line 173-179: The comment describing the telemetry metadata is
explaining WHAT rather than WHY; update the comment near the worker telemetry
metadata field so it focuses on the rationale: remove the opening sentence
"Explicit worker telemetry metadata." and begin with "iii-sdk falls back to
auto-detection (cwd / package.json name / hostname)..." then explain that this
fallback causes inconsistent values like `agentmemory`, `node`, `npm`, or the
user's home directory basename and that pinning the value ensures a stable
project identifier for downstream attribution and grouping in the engine's
metrics/traces; keep the rest of the explanation but trim redundant wording to
emphasize the reason for pinning the value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| telemetry: { | ||
| project_name: "agentmemory", | ||
| language: "node", | ||
| framework: "iii-sdk", | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify iii-sdk version and telemetry field availability
echo "=== Checking iii-sdk version ==="
cat package.json | jq -r '.dependencies["iii-sdk"] // .devDependencies["iii-sdk"] // "not found"'
echo -e "\n=== Checking for telemetry field in type definitions ==="
fd -e d.ts -e d.mts --full-path 'iii-sdk.*index\.d\.(ts|mts)' node_modules | head -1 | xargs cat | rg -A 10 'telemetry'Repository: rohitg00/agentmemory
Length of output: 281
🏁 Script executed:
# Read the relevant section of src/index.ts to see the exact code
head -200 src/index.ts | tail -40Repository: rohitg00/agentmemory
Length of output: 1499
🏁 Script executed:
# Search for any references to telemetry in the codebase
rg -i "telemetry" --type ts --type jsonRepository: rohitg00/agentmemory
Length of output: 727
🏁 Script executed:
# Check if there's a lock file that shows actual resolved version
fd -e 'package-lock.json' -e 'pnpm-lock.yaml' -e 'yarn.lock' | head -1 | xargs head -50Repository: rohitg00/agentmemory
Length of output: 46
🌐 Web query:
iii-sdk 0.11.2 telemetry registerWorker field documentation
💡 Result:
In the iii-sdk, there is no field named registerWorker within a telemetry object or configuration. Instead, registerWorker is the primary function used to initialize the SDK and connect a worker to the iii engine [1][2][3]. Telemetry in the iii-sdk is managed through the otel configuration option passed to registerWorker [1][4][5]. The relevant configuration for telemetry is as follows: 1. enableMetricsReporting: A boolean option (defaulting to true) that enables the reporting of CPU, memory, and event loop metrics to the engine via OpenTelemetry [1][2][4]. 2. otel: An object used to configure OpenTelemetry settings [1][4][5]. You can disable OTel entirely by setting { enabled: false } within this object or by using the environment variable OTEL_ENABLED=false [1][2][5]. If you are looking to configure telemetry, you should pass an otel object to the options argument of registerWorker, rather than looking for a registerWorker field within telemetry [5].
Citations:
- 1: https://iii.dev/docs/0-10-0/api-reference/sdk-node
- 2: https://iii.dev/docs/0-10-0/architecture/workers
- 3: https://iii.dev/docs/quickstart
- 4: https://iii.dev/docs/api-reference/sdk-node
- 5: https://iii.dev/docs/0-10-0/advanced/telemetry
🌐 Web query:
iii-sdk changelog "telemetry" "project_name" 0.11
💡 Result:
In the iii-sdk v0.11 release cycle, telemetry functionality was significantly enhanced to support automatic project identification and metadata reporting [1][2]. Key developments regarding telemetry and project_name in iii-sdk v0.11 include: 1. Automatic Project Name Detection: The SDK was updated to automatically detect the project_name by traversing the file system from the current working directory to locate the nearest manifest file (such as package.json for Node.js or pyproject.toml for Python) [1]. 2. Telemetry Metadata: Telemetry initialization was updated to accept a project_name parameter, allowing the engine to identify usage and report data (e.g., to Amplitude) [1]. 3. Ongoing Refinements: Following the initial v0.11 release, subsequent updates (such as PR #1596) focused on correcting client_type and improving the reliability of auto-detecting project_name across both the engine and SDKs [2]. The iii-sdk v0.11 series (including versions 0.11.0 through 0.11.6) introduced these changes to improve observability and engine integration [3][4]. Users are advised to check the specific minor version, as architectural changes in later v0.11.x releases (such as the introduction of sandboxed microVMs in v0.11.6) may impact how workers and telemetry are registered [4][5].
Citations:
- 1: feat(telemetry): pass framework=motia and project_name via SDK telemetry iii-hq/iii#1200
- 2: fix(telemetry): correct client_type and auto-detect project_name across engine + SDKs iii-hq/iii#1596
- 3: https://pypi.org/project/iii-sdk/
- 4: https://github.com/rohitg00/agentmemory/releases
- 5: https://signalforges.com/pages/rohitg00-agentmemory-best-practices-2026-05-13/
🌐 Web query:
iii-sdk registerWorker telemetry project_name language framework options
💡 Result:
In the iii-sdk, telemetry is configured through the options object passed to the registerWorker (or register_worker) function [1][2]. The SDK includes built-in OpenTelemetry (OTel) support, which is enabled by default [1][2]. To configure telemetry, you use the otel property within the options object [1][2]. Example (Node.js/TypeScript): const iii = registerWorker('ws://localhost:49134', { otel: { enabled: true, serviceName: 'my-service', }, }); Example (Python): from iii import InitOptions, OtelConfig, register_worker iii = register_worker( address="ws://localhost:49134", options=InitOptions( otel=OtelConfig( enabled=True, service_name="my-service",),),) Key Telemetry Options: - enabled (boolean): Whether OTel is enabled. Defaults to true [1][2]. - serviceName (string): The name of the service reported to the OTel collector [2]. You can also disable telemetry by setting { enabled: false } in the otel configuration or by using the environment variable OTEL_ENABLED=false [1][2]. Programmatic configuration passed to registerWorker takes precedence over environment variables [2]. Additionally, the enableMetricsReporting option (boolean, defaults to true) can be used to specifically toggle the reporting of CPU, memory, and event loop metrics to the engine [1][3].
Citations:
- 1: https://iii.dev/docs/api-reference/sdk-node
- 2: https://iii.dev/docs/0-10-0/advanced/telemetry
- 3: https://iii.dev/docs/0-10-0/architecture/workers
🏁 Script executed:
# Check if there's any CHANGELOG or RELEASES file
fd -e 'CHANGELOG*' -e 'RELEASES*' -e 'HISTORY*' | head -5Repository: rohitg00/agentmemory
Length of output: 46
Refactor comment to explain WHY, not WHAT.
The first sentence "Explicit worker telemetry metadata" explains what the code does rather than why. Per the coding guideline "Do not use code comments explaining WHAT — use clear naming instead," remove this sentence and retain the valuable context about auto-detection fallback behavior:
Suggested comment refinement
// iii-sdk falls back to auto-detection (cwd / package.json name / hostname)
// when telemetry is omitted, which produces inconsistent values per host —
// `agentmemory`, `node`, `npm`, occasionally the user's home
// directory basename. Pinning the value here gives every install
// the same stable project identifier for downstream attribution
// and grouping in the engine's metrics + traces output.
telemetry: {
project_name: "agentmemory",
language: "node",
framework: "iii-sdk",
},The telemetry field with project_name, language, and framework is confirmed available in iii-sdk v0.11.2 (and the entire v0.11 series supports these attributes). The passing tests confirm compatibility.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/index.ts` around lines 180 - 184, Replace the current comment that
describes "what" with a why-focused comment above the telemetry block: remove
the "Explicit worker telemetry metadata" line and instead add a brief
explanation that iii-sdk falls back to auto-detection (cwd / package.json name /
hostname) producing inconsistent values across hosts, so we pin
telemetry.project_name/project_name="agentmemory" and
telemetry.language/telemetry.framework to provide a stable project identifier
for downstream metrics and traces; keep the telemetry object with keys
project_name, language, and framework as shown.
Summary
iii-sdk'sInitOptions.telemetry.project_nameauto-detects when omitted — falls through cwd → package.json basename → hostname. That produces inconsistent identifiers per host (agentmemory,node,npm, occasionally the user's home dir basename when launched via npx).Pinning the value gives every install the same stable identifier in the engine's metrics + traces output, so grouping reads cleanly downstream.
Also pins
language: "node"andframework: "iii-sdk"for the same reason.Test plan
npm run buildcleannpm test— 956/956 passingnode_modules/iii-sdk/dist/index.d.mts:32-37(TelemetryOptions)Summary by CodeRabbit