agents: add nsolid-version and add it to metadata - #460
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughCentralizes gRPC request metadata into a single GrpcMetadata cached on GrpcAgent. GrpcClient gains AddMetadata and MakeClientContext now accepts GrpcMetadata. Streams, exporters, lib/config, and tests are updated to build, pass, and validate the unified metadata; test noise is reduced. ChangesGrpc metadata centralization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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 unit tests (beta)
Comment |
4d4f8ea to
e9aee4a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@agents/grpc/src/grpc_agent.cc`:
- Around line 1045-1056: When saas_ is cleared or parse_saas_token fails we must
also tear down existing gRPC clients instead of leaving them running; update the
logic around the "if (grpc_changed || saas_changed)" block so that a
saas_changed event always executes the same gRPC shutdown/reset lifecycle used
for gRPC reconfiguration (the code that resets stubs/command stream/exporters),
even when there is no "/grpc" entry (i.e. when it == config_.end() && !saas_).
Concretely, after saas_ is reset and RefreshRpcMetadata() is called, invoke the
same teardown/reset code path (or refactor that teardown into a helper and call
it) referenced in the existing grpc reconfigure branch so stale endpoints/tokens
are cleared.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0e2dbd9c-8d8c-4f6e-8fcc-cf6d98cf630b
📒 Files selected for processing (11)
agents/grpc/src/asset_stream.ccagents/grpc/src/asset_stream.hagents/grpc/src/command_stream.ccagents/grpc/src/command_stream.hagents/grpc/src/grpc_agent.ccagents/grpc/src/grpc_agent.hagents/grpc/src/grpc_client.ccagents/grpc/src/grpc_client.htest/agents/test-grpc-basic.mjstest/common/nsolid-grpc-agent/index.jstest/common/nsolid-grpc-agent/server.mjs
✅ Files skipped from review due to trivial changes (2)
- agents/grpc/src/grpc_client.h
- agents/grpc/src/grpc_client.cc
🚧 Files skipped from review as they are similar to previous changes (7)
- test/common/nsolid-grpc-agent/server.mjs
- agents/grpc/src/command_stream.h
- agents/grpc/src/asset_stream.cc
- test/agents/test-grpc-basic.mjs
- agents/grpc/src/asset_stream.h
- test/common/nsolid-grpc-agent/index.js
- agents/grpc/src/grpc_agent.h
e9aee4a to
1e835bf
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@lib/nsolid.js`:
- Around line 792-796: The conditional that assigns nsolidConfig.grpc
re-stringifies the raw input (config.grpc) and can corrupt normalized values;
change this so you do not override the already-normalized value — preserve
nsolidConfig.grpc when config.grpc is not null instead of setting it to '' +
config.grpc; locate the assignment around nsolidConfig.grpc and modify the else
branch to leave the pre-normalized nsolidConfig.grpc intact (or assign from the
normalized source) so boolean and numeric semantics are preserved.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3efbfec8-4d7c-4fe3-ae9f-11bc532e90a8
📒 Files selected for processing (12)
agents/grpc/src/asset_stream.ccagents/grpc/src/asset_stream.hagents/grpc/src/command_stream.ccagents/grpc/src/command_stream.hagents/grpc/src/grpc_agent.ccagents/grpc/src/grpc_agent.hagents/grpc/src/grpc_client.ccagents/grpc/src/grpc_client.hlib/nsolid.jstest/agents/test-grpc-basic.mjstest/common/nsolid-grpc-agent/index.jstest/common/nsolid-grpc-agent/server.mjs
✅ Files skipped from review due to trivial changes (2)
- test/agents/test-grpc-basic.mjs
- test/common/nsolid-grpc-agent/index.js
🚧 Files skipped from review as they are similar to previous changes (5)
- agents/grpc/src/asset_stream.h
- agents/grpc/src/asset_stream.cc
- agents/grpc/src/command_stream.h
- test/common/nsolid-grpc-agent/server.mjs
- agents/grpc/src/grpc_agent.cc
0634808
1e835bf to
0634808
Compare
0634808 to
2bbf4b4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@test/common/nsolid-grpc-agent/index.js`:
- Around line 16-22: The checkRpcMetadata function currently indexes
metadata['nsolid-agent-id'][0] and metadata['nsolid-version'][0] without
validating those headers exist or are arrays; update checkRpcMetadata to first
validateArray(metadata['nsolid-agent-id'], 'metadata.nsolid-agent-id') and
validateArray(metadata['nsolid-version'], 'metadata.nsolid-version') and then
validateString(metadata['nsolid-agent-id'][0], 'metadata.nsolid-agent-id[0]')
and validateString(metadata['nsolid-version'][0], 'metadata.nsolid-version[0]')
before asserting their values (retain the existing assert.strictEqual checks for
agentId and version format).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bbf7c740-71b7-4d0e-93fc-2abcc0d425de
📒 Files selected for processing (18)
agents/grpc/src/asset_stream.ccagents/grpc/src/asset_stream.hagents/grpc/src/command_stream.ccagents/grpc/src/command_stream.hagents/grpc/src/grpc_agent.ccagents/grpc/src/grpc_agent.hagents/grpc/src/grpc_client.ccagents/grpc/src/grpc_client.hlib/nsolid.jssrc/nsolid/nsolid_api.cctest/agents/test-grpc-basic.mjstest/agents/test-grpc-continuous-profile.mjstest/agents/test-grpc-heap-profile.mjstest/agents/test-grpc-heap-sampling.mjstest/agents/test-grpc-profile.mjstest/agents/test-grpc-snapshot.mjstest/common/nsolid-grpc-agent/index.jstest/common/nsolid-grpc-agent/server.mjs
💤 Files with no reviewable changes (5)
- test/agents/test-grpc-snapshot.mjs
- test/agents/test-grpc-profile.mjs
- test/agents/test-grpc-heap-sampling.mjs
- test/agents/test-grpc-continuous-profile.mjs
- test/agents/test-grpc-heap-profile.mjs
Also, cache the metadata so it is not rebuilt for each RPC. Finally, resolve the `nsolid-saas` / `nsolid-saas-token` header split by standardizing on `nsolid-saas`. PR-URL: #460 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: #460 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: #460 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: #460 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2bbf4b4 to
37f19cd
Compare


Also, cache the metadata so it's not generated multiple times per different rpc's.
Finally, resolve having both
nsolid-saasandnsolid-saas-tokenheader name and settle for the first.Summary by CodeRabbit
Refactor
Tests
Bug Fix