-
Notifications
You must be signed in to change notification settings - Fork 609
Add new features to MongoDbStorage provider #613
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
Merged
NickCraver
merged 18 commits into
MiniProfiler:main
from
IanKemp:IanKemp/add-mongodb-expiration
Aug 2, 2023
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
601e4ea
add expiration option to MongoDbStorage
4378998
fix
00f8165
bump mongodb driver version
a83465d
fix issues
beaf706
cleanup
95783d6
preserve backwards compatibility
cb2b2d1
change implementation to be fully backwards (binary) compatible and c…
c5b651d
more backwards compat
aa9871e
improve docs
fa0fe4b
Add explicit handling around AutomaticallyRecreateIndexes
NickCraver 07667f0
Merge branch 'main' into pr/613
NickCraver 8d8d67c
RavenDB: Use separate databases like other suites
NickCraver c7fdd88
Change detection to error code
NickCraver 00b9b58
Fix NRTs and GUID serialization
NickCraver 6dfbbd1
Take 12
NickCraver 91598df
Use options memoized
NickCraver ad81673
Don't run MongoDB on AppVeyor
NickCraver 90d3c32
Update release notes
NickCraver 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ services: | |
- mssql2019 | ||
- mysql | ||
- postgresql | ||
- mongodb | ||
|
||
nuget: | ||
disable_publish_on_pr: true | ||
|
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
55 changes: 55 additions & 0 deletions
55
src/MiniProfiler.Providers.MongoDB/MongoDbStorageOptions.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,55 @@ | ||
using System; | ||
|
||
namespace StackExchange.Profiling | ||
{ | ||
/// <summary> | ||
/// Options for configuring <see cref="MongoDbStorage"/>. | ||
/// </summary> | ||
public class MongoDbStorageOptions | ||
{ | ||
/// <summary> | ||
/// The connection string to use for connecting to MongoDB. | ||
/// Defaults to <c>mongodb://localhost</c>. | ||
/// </summary> | ||
public string? ConnectionString { get; set; } | ||
|
||
/// <summary> | ||
/// Name of the collection in which to store <see cref="MiniProfiler"/> sessions in. | ||
/// Defaults to <c>profilers</c>. | ||
/// </summary> | ||
public string CollectionName { get; set; } = "profilers"; | ||
|
||
/// <summary> | ||
/// If set to <see langword="true"/>, C# <c>decimal</c> fields will be serialized as <c>NumberDecimal</c>s in MongoDB. | ||
/// If set to <see langword="false"/>, will serialize these fields as strings (backwards-compatible with older versions of this provider). | ||
/// Defaults to <see langword="true"/>. | ||
/// </summary> | ||
public bool SerializeDecimalFieldsAsNumberDecimal { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Specifies whether relevant indexes will automatically created when this provider is instantiated. | ||
/// Defaults to <see langword="true" />. | ||
/// </summary> | ||
public bool AutomaticallyCreateIndexes { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Specifies whether relevant indexes will automatically recreated if creation fails (e.g. because something with | ||
/// different options was previously created). | ||
/// *THIS DROPS EXISTING DATA* | ||
/// Defaults to <see langword="false" />. | ||
/// </summary> | ||
public bool AutomaticallyRecreateIndexes { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Gets or sets how long to cache each <see cref="MiniProfiler"/> for, in absolute terms. | ||
/// Defaults to one hour. | ||
/// </summary> | ||
/// <remarks><list type="bullet"> | ||
/// <item>You need to either set <see cref="AutomaticallyCreateIndexes"/> to true or call | ||
/// <see cref="MongoDbStorage.WithIndexCreation(TimeSpan)"/> for this value to have any effect.</item> | ||
/// <item>Setting this option will drop any (<see cref="MiniProfiler.Started"/>, ascending) index previously | ||
/// defined, including those with custom options.</item> | ||
/// </list></remarks> | ||
public TimeSpan CacheDuration { get; set; } = TimeSpan.FromHours(1); | ||
} | ||
} |
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
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.