MLE-30272: [Node Client] Document ML-Agent-ID Telemetry Header and Provide Opt-Out Option - #1106
MLE-30272: [Node Client] Document ML-Agent-ID Telemetry Header and Provide Opt-Out Option#1106ngodugu-marklogic wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-out for the ML-Agent-ID: nodejs telemetry header and documents the default behavior across the JS API docs, README, and TypeScript typings, while preserving the existing default (header is sent unless explicitly disabled).
Changes:
- Gated setting the
ML-Agent-IDheader behind a newdisableTelemetryHeaderconnection option. - Added
disableTelemetryHeaderto the allowed connection parameters and TypeScriptDatabaseClientConfigtyping. - Documented the behavior and added JS + TS runtime/compile-time tests covering both default and opt-out behavior.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/requester.js | Conditionally adds ML-Agent-ID only when disableTelemetryHeader is not enabled. |
| lib/marklogic.js | Allows disableTelemetryHeader in connection parameters and documents it in createDatabaseClient JSDoc. |
| marklogic.d.ts | Adds disableTelemetryHeader?: boolean to DatabaseClientConfig. |
| README.md | Documents default telemetry header behavior and how to opt out. |
| test-basic/telemetry-header-test.js | JS unit test verifying header present by default and omitted when disabled. |
| test-typescript/telemetry-header-runtime.test.ts | TS runtime smoke test verifying the same header behavior at runtime. |
| test-typescript/basic-types.test.ts | TS compile-time coverage ensuring the new config option type-checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }); | ||
| ``` | ||
|
|
||
| ### Telemetry Header |
There was a problem hiding this comment.
Couple thoughts here. First, I don't think we want to establish a pattern of every new feature being documented in the README file. That file should typically be brief, providing an overview of the client and links to the documentation and other resources. This establishes a pattern that will produce an enormous README file over time. The right place for this information is in the existing Node Client docs.
Second - I would provide a link to the MarkLogic telemetry docs in the type definition above - https://docs.progress.com/bundle/marklogic-server-monitor-12/page/topics/telemetry.html . And possibly in the config example above as well. I think saying that it enables or disables telemetry usage with a link to the telemetry docs is all we want.
| user: 'admin', | ||
| password: 'admin', | ||
| authType: 'DIGEST', | ||
| // disableTelemetryHeader is optional and can be set to true to suppress the ML-Agent-ID header. |
There was a problem hiding this comment.
I would make this and the next comment briefer by removing the name of the field, since it's obvious what it's referring too - e.g. Optional; set to true to suppress inclusion of the ML-Agent-ID header in each request to MarkLogic..
Summary
This PR documents the ML-Agent-ID telemetry header behavior and adds an opt-out connection option so security-sensitive deployments can suppress that header when needed.
Default behavior is preserved: if no opt-out is provided, requests still include ML-Agent-ID: nodejs.
What Changed
Why This Approach
Validation
npm installnpx mocha telemetry-header-test.jsnpm run test:compilenpm run test:typescriptExpected Results