Skip to content

chore(telemetry): pin worker project_name in registerWorker options#426

Merged
rohitg00 merged 1 commit into
mainfrom
chore/worker-telemetry-id
May 16, 2026
Merged

chore(telemetry): pin worker project_name in registerWorker options#426
rohitg00 merged 1 commit into
mainfrom
chore/worker-telemetry-id

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented May 16, 2026

Summary

iii-sdk's InitOptions.telemetry.project_name auto-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" and framework: "iii-sdk" for the same reason.

Test plan

  • npm run build clean
  • npm test — 956/956 passing
  • iii-sdk field surface verified at node_modules/iii-sdk/dist/index.d.mts:32-37 (TelemetryOptions)

Summary by CodeRabbit

  • Chores
    • Enhanced telemetry tracking metadata in worker registration for improved analytics and monitoring.

Review Change Stack

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).
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment May 16, 2026 9:05am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

Worker registration in src/index.ts now includes explicit telemetry metadata attributes that pin project_name, language, and framework to stable values. Accompanying comments explain that these values remain constant across different installs and hosts for consistent telemetry attribution.

Changes

Worker Telemetry Configuration

Layer / File(s) Summary
Telemetry metadata registration
src/index.ts
registerWorker options are extended with an explicit telemetry object containing stable project_name, language, and framework values, with comments describing the purpose of pinning these attributes across installs and hosts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A worker now speaks with clearer voice,
With telemetry pinned—the stable choice,
Project name, language, framework aligned,
Attribution that persists, no matter the grind,
The memory traces its path with pride!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: pinning telemetry metadata (specifically project_name and related fields) in the registerWorker options to ensure consistent identification across different installation environments.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/worker-telemetry-id

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/index.ts (1)

173-179: 💤 Low value

Refine 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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27036551-f952-4a4a-aa31-0343b3ac28ec

📥 Commits

Reviewing files that changed from the base of the PR and between 705321b and 8eeb5e2.

📒 Files selected for processing (1)
  • src/index.ts

Comment thread src/index.ts
Comment on lines +180 to +184
telemetry: {
project_name: "agentmemory",
language: "node",
framework: "iii-sdk",
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 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 -40

Repository: rohitg00/agentmemory

Length of output: 1499


🏁 Script executed:

# Search for any references to telemetry in the codebase
rg -i "telemetry" --type ts --type json

Repository: 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 -50

Repository: 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:


🌐 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:


🌐 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:


🏁 Script executed:

# Check if there's any CHANGELOG or RELEASES file
fd -e 'CHANGELOG*' -e 'RELEASES*' -e 'HISTORY*' | head -5

Repository: 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.

@rohitg00 rohitg00 merged commit fae26ca into main May 16, 2026
5 checks passed
@rohitg00 rohitg00 deleted the chore/worker-telemetry-id branch May 16, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant