Skip to content

Add deployment environments to events - #98

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

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

Conversation

@ejsmith

@ejsmith ejsmith commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Adds deployment environments (e.g. production, staging) to events. They're sent as the root environment property, matching the .NET (#371) and JavaScript (#193) clients and the server (Exceptionless #2570).

Self-hosted: upgrade the server first. Older servers drop the property.

Usage

Exceptionless.startup(config -> config.apiKey("YOUR_API_KEY").environment("production"));
Exceptionless.createLog("Deployment complete").setEnvironment("staging").submit(); // per-event override

Which value wins

flowchart TD
    A["EventBuilder.setEnvironment(name)"] -->|null| B[Value already on the event]
    A -->|valid| V[Use it]
    A -->|invalid| U[Send unspecified]
    B -->|none| C["config.environment(...) in code"]
    C -->|not set| D["exceptionless.properties → EXCEPTIONLESS_ENVIRONMENT<br/>→ system property → Spring property"]
    D -->|not set| E[Spring: the single active profile]
Loading
  • Strict names: trimmed, casing kept, then it must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. Anything else (Staging West, prod/eu, produção, empty, over 64 characters) is unspecified and never rewritten.
  • A configured value that's invalid stays configured and blocks the lower levels, the same as .NET.
  • data.@environment (machine info) is untouched.
  • The duplicate checker keeps the same error in different environments apart.

Testing

  • Builds: ./mvnw verify on JDK 17, 21 and 25, plus Spring Boot 4, all green locally and in CI.
  • Tests: 432 core tests plus the logging, servlet and starter modules.
  • Mutation checks: each key rule was broken on purpose, and a test failed every time. The real-server end-to-end job was not run.

🤖 Generated with Claude Code

Events get an optional root `environment` property, separate from the
`@environment` machine data. The client configuration holds a default
(`environment(String)`, `exceptionless.environment`,
`EXCEPTIONLESS_ENVIRONMENT`), `EventBuilder.setEnvironment` overrides it
per event, and the Spring Boot starter falls back to the only active
profile. Names are normalized like the server does: trimmed, and
unspecified when empty, over 64 characters or containing control
characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-11-03T00:07:23.684695Z b832ea3 New commits
ℹ️ 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.

ejsmith and others added 2 commits October 28, 2026 08:16
EventBuilder.setEnvironment(null) now clears any earlier override on the
builder so the configured default applies, matching the .NET and
JavaScript clients. Only a non-null value that is not valid (empty or
white space, over 64 characters, control characters) is an explicit
override that sends the event without an environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Names are trimmed, then must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$.
Anything else is unspecified and never rewritten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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