-
Notifications
You must be signed in to change notification settings - Fork 121
Use a singular option for all counter intervals #944
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
Changes from all commits
4984b95
37dbeba
497a161
9ac77bc
a5d6bfb
b6e837f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System.Text; | ||
|
|
||
| namespace Microsoft.Diagnostics.Monitoring.WebApi | ||
| { | ||
| public class GlobalCounterOptions | ||
| { | ||
| public const int IntervalMinSeconds = 1; | ||
| public const int IntervalMaxSeconds = 60 * 60 * 24; // One day | ||
|
|
||
| [Display( | ||
| ResourceType = typeof(OptionsDisplayStrings), | ||
| Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_GlobalCounterOptions_IntervalSeconds))] | ||
| [Range(IntervalMinSeconds, IntervalMaxSeconds)] | ||
| [DefaultValue(GlobalCounterOptionsDefaults.IntervalSeconds)] | ||
| public int? IntervalSeconds { get; set; } | ||
| } | ||
|
|
||
| internal static class GlobalCounterOptionsExtensions | ||
| { | ||
| public static int GetIntervalSeconds(this GlobalCounterOptions options) => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this better than our current scattering usage of GetValueOrDefault everywhere. Separately, I think we should do this with all of the nullable options properties. |
||
| options.IntervalSeconds.GetValueOrDefault(GlobalCounterOptionsDefaults.IntervalSeconds); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace Microsoft.Diagnostics.Monitoring.WebApi | ||
| { | ||
| internal static class GlobalCounterOptionsDefaults | ||
| { | ||
| public const int IntervalSeconds = 5; | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.