Skip to content

Add deployment environments to events - #193

Open
ejsmith wants to merge 5 commits into
mainfrom
feature/event-environments
Open

Add deployment environments to events#193
ejsmith wants to merge 5 commits into
mainfrom
feature/event-environments

Conversation

@ejsmith

@ejsmith ejsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI lite review requested due to automatic review settings September 10, 2026 03:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T05:15:10.967628Z 0e675b4 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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.environment and 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.md still has a copyable setup example that writes the deployment environment to config.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.environment as the deployment-environment API, but other copyable SDK guidance still uses defaultData["deployment"] (references/client-core.md:25), a DeploymentPlugin that writes data.deployment (references/plugins.md:44), and the React Native README's defaultData["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:25 and packages/react-native/README.md:82). Those snippets emit nested event data rather than the new top-level environment, 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 as production. 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread packages/core/src/Utils.ts Outdated
@ejsmith

ejsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread .agents/skills/exceptionless-javascript/SKILL.md Outdated
@ejsmith

ejsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread README.md Outdated
@ejsmith

ejsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 0d459e6ad1

ℹ️ 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".

@ejsmith

ejsmith commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 0e675b4caa

ℹ️ 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".

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.

3 participants