Add deployment environments to events - #193
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
There was a problem hiding this comment.
🔵 Needs a closer look
Address the two environment-normalization issues and stale documentation examples before approval.
Pull request overview
Adds deployment-environment support across the JavaScript SDK, including configuration defaults, per-event overrides, normalization, and environment-aware duplicate detection.
Changes:
- Adds
configuration.environmentand event-level environment APIs. - Applies normalized environments to events and duplicate tracking.
- Updates tests and SDK documentation.
File summaries
| File | Summary | Review notes |
|---|---|---|
README.md |
Documents environment configuration. | Nit (1 vote): update remaining defaultData examples. |
packages/core/test/plugins/default/DuplicateCheckerPlugin.test.ts |
Tests environment-aware deduplication. | — |
packages/core/test/plugins/default/ConfigurationDefaultsPlugin.test.ts |
Tests defaults and overrides. | — |
packages/core/test/configuration/Configuration.test.ts |
Tests configuration normalization. | — |
packages/core/src/Utils.ts |
Normalizes environment values. | Moderate (1 vote): validate control characters before trimming and lowercase before length validation. |
packages/core/src/plugins/default/DuplicateCheckerPlugin.ts |
Separates duplicate tracking by environment. | — |
packages/core/src/plugins/default/ConfigurationDefaultsPlugin.ts |
Applies environment defaults. | — |
packages/core/src/models/Event.ts |
Adds the event environment field. | — |
packages/core/src/EventBuilder.ts |
Adds per-event environment overrides. | — |
packages/core/src/configuration/Configuration.ts |
Adds normalized environment configuration. | — |
.agents/skills/exceptionless-javascript/SKILL.md |
Updates SDK guidance. | Nit (1 vote): update stale legacy environment examples. |
.agents/skills/exceptionless-javascript/references/sending-events.md |
Documents event overrides. | — |
.agents/skills/exceptionless-javascript/references/configuration.md |
Documents configuration behavior. | Nit (1 vote): update stale deployment examples. |
Review details
Suppressed comments (5)
.agents/skills/exceptionless-javascript/SKILL.md:12
- This new index advertises the top-level environment API, but the linked
references/client-core.mdstill has a copyable setup example that writes the deployment environment toconfig.defaultData["deployment"]. That guidance will not populate the new top-level field or its environment-aware duplicate behavior; update the stale reference (and other package examples using the legacy shape) in this change.
Deployment environments use `config.environment` or `config.setEnvironment(name)` as the default, and `builder.setEnvironment(name)` for overrides. They serialize as top-level `environment`, separately from `data.@environment`. See [configuration.md](references/configuration.md).
.agents/skills/exceptionless-javascript/references/configuration.md:34
- This new guidance establishes
config.environmentas the deployment-environment API, but other copyable SDK guidance still usesdefaultData["deployment"](references/client-core.md:25), aDeploymentPluginthat writesdata.deployment(references/plugins.md:44), and the React Native README'sdefaultData["environment"]example (packages/react-native/README.md:82). Those examples bypass the new top-level field, so update the stale deployment examples in the same documentation change.
Set `config.environment = "production"` or call `config.setEnvironment("production")`. Per-event `setEnvironment("staging")` overrides the default. Names are trimmed and lowercased; empty names, names longer than 64 characters, and control characters are ignored. Missing values remain unspecified. This property is independent of `data.@environment` runtime metadata and of the application version. It does not change server stack grouping or create per-environment status.
README.md:11
- This introduces the canonical deployment-environment setting, but package-specific guidance still tells users to put deployment values in
defaultData(for example,.agents/skills/exceptionless-javascript/references/client-core.md:25andpackages/react-native/README.md:82). Those snippets emit nested event data rather than the new top-levelenvironment, so please update the remaining setup examples in the same change.
Set a deployment environment in startup configuration with `config.environment = "production"` (or `config.setEnvironment("production")`). Override it on an event with `Exceptionless.createLog("Example").setEnvironment("staging").submit()`. Names are trimmed, lowercased, and limited to 64 characters. Missing or invalid names remain unspecified. The top-level `environment` is separate from machine/runtime diagnostics in `data.@environment`; stacks and fixed versions remain shared across environments.
packages/core/src/Utils.ts:568
- The documented validation rejects control characters, but
trim()removes leading/trailing tabs and newlines before the regex runs, so values such as"\nproduction\n"are accepted asproduction. Validate the original input for control characters before trimming so all control-containing names remain unspecified.
const name = value.trim();
// eslint-disable-next-line no-control-regex -- Deployment names cannot contain control characters.
return name && name.length <= 64 && !/[\u0000-\u001f\u007f-\u009f]/u.test(name) ? name.toLowerCase() : undefined;
packages/core/src/Utils.ts:568
- The length check runs before lowercasing. Unicode lowercasing can expand a 64-code-unit input (for example,
"\u0130".repeat(64)becomes 128 code units), so this can emit an environment longer than the documented/server 64-character limit. Lowercase first and validate the normalized value.
return name && name.length <= 64 && !/[\u0000-\u001f\u007f-\u009f]/u.test(name) ? name.toLowerCase() : undefined;
- Files reviewed: 13/13 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af5bea4acc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 638593309e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dedcec3a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds
configuration.environment,setEnvironment(...), and per-event overrides across the JavaScript SDK packages. Environment values retain their supplied casing after trimming. Search and aggregation normalization happens on the server, which continues grouping the same error into one stack. Duplicate detection preserves distinct event payloads.Includes configuration examples and updated SDK guidance. Deploy the server support before adopting the new setting.
Validation: the full SDK test suite, all package/example builds, lint, and CodeQL passed. Regression coverage includes invalid overrides, Unicode values, casing preservation, and duplicate detection. No breaking public APIs.
Related PRs: Exceptionless #2570, Exceptionless.Net #371.