-
-
Notifications
You must be signed in to change notification settings - Fork 143
Add deployment environments to events #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ejsmith
wants to merge
9
commits into
main
Choose a base branch
from
feature/event-environments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6f4f136
Add deployment environments to events
ejsmith 5713934
Update SourceLink patch to unblock SDK validation
ejsmith 2ac945e
Preserve client ownership and environment override semantics
ejsmith 5f875dc
Keep explicitly invalid host environments unspecified
ejsmith fca9d0e
Keep host defaults distinct from explicit environment settings
ejsmith cb3f215
Preserve environment overrides when splitting aggregate exceptions
ejsmith 609fe96
Apply deployment environments before event exclusions
ejsmith 400e18d
Preserve supplied environment casing
ejsmith 1e984cd
Preserve casing in aggregate exception expectations
ejsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Exceptionless/Plugins/Default/001_DeploymentEnvironmentPlugin.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace Exceptionless.Plugins.Default { | ||
| [Priority(1)] | ||
| public sealed class DeploymentEnvironmentPlugin : IEventPlugin { | ||
| public void Run(EventPluginContext context) { | ||
| if (!context.Event.HasEnvironmentOverride) | ||
| context.Event.Environment = context.Client.Configuration.Environment; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| using System; | ||
|
|
||
| namespace Exceptionless.Utility { | ||
| internal static class DeploymentEnvironment { | ||
| public static string Normalize(string value) { | ||
| string name = value?.Trim(); | ||
| if (String.IsNullOrEmpty(name) || name.Length > 64) | ||
| return null; | ||
|
|
||
| foreach (char character in name) { | ||
| if (Char.IsControl(character)) | ||
| return null; | ||
| } | ||
|
|
||
| return name; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
test/Exceptionless.Tests/Configuration/DeploymentEnvironmentConfigurationTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #if NET45 | ||
| using System.Collections.Specialized; | ||
| using System.Configuration; | ||
| using System.IO; | ||
| using Xunit; | ||
|
|
||
| namespace Exceptionless.Tests.Configuration { | ||
| public class DeploymentEnvironmentConfigurationTests { | ||
| [Fact] | ||
| public void ReadFromConfigSection_LoadsEnvironmentAttribute() { | ||
| string path = Path.GetTempFileName(); | ||
| try { | ||
| File.WriteAllText(path, "<configuration><configSections><section name=\"exceptionless\" type=\"Exceptionless.ExceptionlessSection, Exceptionless\" /></configSections><exceptionless apiKey=\"test\" environment=\" Staging \" /></configuration>"); | ||
| var mapped = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = path }, ConfigurationUserLevel.None); | ||
| using var client = new ExceptionlessClient(); | ||
| client.Configuration.ReadFromConfigSection((ExceptionlessSection)mapped.GetSection("exceptionless")); | ||
| Assert.Equal("Staging", client.Configuration.Environment); | ||
| } finally { | ||
| File.Delete(path); | ||
| } | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ReadFromConfigSection_MissingEnvironment_PreservesConfiguredValue() { | ||
| using var client = new ExceptionlessClient(); | ||
| client.Configuration.Environment = "staging"; | ||
| client.Configuration.ReadFromConfigSection(new ExceptionlessSection()); | ||
| Assert.Equal("staging", client.Configuration.Environment); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ReadFromAppSettings_LoadsEnvironmentAndPreservesMissingSetting() { | ||
| using var client = new ExceptionlessClient(); | ||
| client.Configuration.Environment = "staging"; | ||
| client.Configuration.ReadFromAppSettings(new NameValueCollection()); | ||
| Assert.Equal("staging", client.Configuration.Environment); | ||
| client.Configuration.ReadFromAppSettings(new NameValueCollection { ["Exceptionless:Environment"] = " Production " }); | ||
| Assert.Equal("Production", client.Configuration.Environment); | ||
| } | ||
| } | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.