diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aecd190..471b274 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build & Test on: pull_request: branches: - - master + - main paths-ignore: - 'docs/**' # Don't run workflow when files are only in the /docs directory @@ -16,9 +16,8 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '3.1.201' + - name: Install .NET SDK + uses: actions/setup-dotnet@v1 - name: .NET Build run: dotnet build Build.csproj -c Release --nologo /p:CI=true - name: .NET Test @@ -31,6 +30,8 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Install .NET SDK + uses: actions/setup-dotnet@v1 - name: .NET Build run: dotnet build Build.csproj -c Release --nologo /p:CI=true - name: .NET Test diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 5fbdccc..76fb668 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,7 +3,7 @@ name: Build, Test & Package on: push: branches: - - master + - main paths-ignore: - 'docs/**' # Don't run workflow when files are only in the /docs directory @@ -16,9 +16,8 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '3.1.201' + - name: Install .NET SDK + uses: actions/setup-dotnet@v1 - name: .NET Build run: dotnet build Build.csproj -c Release --nologo /p:CI=true - name: .NET Test diff --git a/Directory.build.props b/Directory.Build.props similarity index 58% rename from Directory.build.props rename to Directory.Build.props index 8298fe9..9bedb0c 100644 --- a/Directory.build.props +++ b/Directory.Build.props @@ -1,11 +1,11 @@ 1.0.0 - 2019 Stack Exchange, Inc. + 2021 Stack Exchange, Inc. netstandard2.0 $(AssemblyName) strict - Stack Exchange, Inc., Bret Copeland + Stack Exchange, Inc., Bret Copeland, Dean Ward $(MSBuildThisFileDirectory)Shared.ruleset NETSDK1069 NU5105 @@ -16,15 +16,22 @@ true embedded en-US - false + true true + snupkg + true + + true + + + true - - + + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100755 index 0000000..6decc34 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StackExchange.Metrics.sln b/StackExchange.Metrics.sln index 49152b8..73a15ef 100644 --- a/StackExchange.Metrics.sln +++ b/StackExchange.Metrics.sln @@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes .gitignore = .gitignore - appveyor.yml = appveyor.yml build.cmd = build.cmd build.ps1 = build.ps1 Directory.build.props = Directory.build.props diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index bb6053c..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -os: Visual Studio 2019 - -skip_branch_with_pr: true -skip_tags: true -skip_commits: - files: - - '**/*.md' - - docs/* - -environment: - Appveyor: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - -build_script: -- ps: .\build.ps1 -PullRequestNumber "$env:APPVEYOR_PULL_REQUEST_NUMBER" -CreatePackages $true - -artifacts: -- path: .\.nupkgs\*.nupkg - -test: off - -deploy: -- provider: NuGet - server: https://www.myget.org/F/stackoverflow/api/v2 - on: - branch: master - api_key: - secure: P/UHxq2DEs0GI1SoDXDesHjRVsSVgdywz5vmsnhFQQY5aJgO3kP+QfhwfhXz19Rw - symbol_server: https://www.myget.org/F/stackoverflow/symbols/api/v2/package \ No newline at end of file diff --git a/benchmarks/StackExchange.Metrics.Benchmarks/StackExchange.Metrics.Benchmarks.csproj b/benchmarks/StackExchange.Metrics.Benchmarks/StackExchange.Metrics.Benchmarks.csproj index 7fdcfe1..e5c4c89 100644 --- a/benchmarks/StackExchange.Metrics.Benchmarks/StackExchange.Metrics.Benchmarks.csproj +++ b/benchmarks/StackExchange.Metrics.Benchmarks/StackExchange.Metrics.Benchmarks.csproj @@ -2,14 +2,14 @@ Exe - net472;netcoreapp3.1 + net472;net6.0 false - - + + diff --git a/global.json b/global.json index 531745d..cadb66d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.100", + "version": "6.0.101", "rollForward": "latestMajor", "allowPrerelease": false } diff --git a/samples/StackExchange.Metrics.SampleHost/MyCustomHandler.cs b/samples/StackExchange.Metrics.SampleHost/MyCustomHandler.cs index 4db7876..7732ab8 100644 --- a/samples/StackExchange.Metrics.SampleHost/MyCustomHandler.cs +++ b/samples/StackExchange.Metrics.SampleHost/MyCustomHandler.cs @@ -13,14 +13,12 @@ namespace StackExchange.Metrics.SampleHost { /// /// A simple handler that serializes metrics as plain text in the format: - /// <metric_name>,<metric_value>\n + /// <metric_name>,<metric_value>\n /// public class MyCustomHandler : BufferedHttpMetricHandler { private static readonly MediaTypeHeaderValue _plainText = new MediaTypeHeaderValue("text/plain"); - private Uri _uri; - /// /// Constructs a new handler pointing at the specified . /// @@ -35,10 +33,7 @@ public MyCustomHandler(Uri uri) /// /// Gets or sets the URI used by the handler. /// - public Uri Uri - { - get; set; - } + public Uri Uri { get; } // no pre or post-amble for this handler protected override int GetPostambleLength(PayloadType payloadType) => 0; @@ -57,9 +52,9 @@ protected override HttpClient CreateHttpClient() return httpClient; } - protected override ValueTask SendCounterAsync(ReadOnlySequence sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.Counter, _plainText, sequence); - protected override ValueTask SendCumulativeCounterAsync(ReadOnlySequence sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.CumulativeCounter, _plainText, sequence); - protected override ValueTask SendGaugeAsync(ReadOnlySequence sequence) => SendAsync(_uri, HttpMethod.Post, PayloadType.Gauge, _plainText, sequence); + protected override ValueTask SendCounterAsync(ReadOnlySequence sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.Counter, _plainText, sequence); + protected override ValueTask SendCumulativeCounterAsync(ReadOnlySequence sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.CumulativeCounter, _plainText, sequence); + protected override ValueTask SendGaugeAsync(ReadOnlySequence sequence) => SendAsync(Uri, HttpMethod.Post, PayloadType.Gauge, _plainText, sequence); // this implementation doesn't support metadata protected override ValueTask SendMetadataAsync(ReadOnlySequence sequence) => default; diff --git a/samples/StackExchange.Metrics.SampleHost/StackExchange.Metrics.SampleHost.csproj b/samples/StackExchange.Metrics.SampleHost/StackExchange.Metrics.SampleHost.csproj index 63cf7f5..525af80 100644 --- a/samples/StackExchange.Metrics.SampleHost/StackExchange.Metrics.SampleHost.csproj +++ b/samples/StackExchange.Metrics.SampleHost/StackExchange.Metrics.SampleHost.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 false diff --git a/src/StackExchange.Metrics/Handlers/BosunMetricHandler.cs b/src/StackExchange.Metrics/Handlers/BosunMetricHandler.cs index c98e519..876b65c 100644 --- a/src/StackExchange.Metrics/Handlers/BosunMetricHandler.cs +++ b/src/StackExchange.Metrics/Handlers/BosunMetricHandler.cs @@ -54,7 +54,7 @@ public BosunMetricHandler(Uri baseUri) _counterValues = new Dictionary(MetricKeyComparer.Default); _jsonOptions = new JsonSerializerOptions { - IgnoreNullValues = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, Converters = { new JsonEpochConverter(), diff --git a/src/StackExchange.Metrics/Infrastructure/MemoryExtensions.cs b/src/StackExchange.Metrics/Infrastructure/MemoryExtensions.cs index 7cbad6d..e44a092 100644 --- a/src/StackExchange.Metrics/Infrastructure/MemoryExtensions.cs +++ b/src/StackExchange.Metrics/Infrastructure/MemoryExtensions.cs @@ -6,10 +6,40 @@ namespace StackExchange.Metrics.Infrastructure { + /// + /// Extension methods for , and . + /// public static class MemoryExtensions { #pragma warning disable RCS1231 // Make parameter ref read-only. + /// + /// Tries to return the underlying representing a single segment + /// . + /// + /// + /// A instance. + /// + /// + /// Could not obtain the underlying from the + /// + /// + /// An . + /// public static ArraySegment GetArray(this Memory buffer) => GetArray((ReadOnlyMemory)buffer); + + /// + /// Tries to return the underlying representing a single segment + /// . + /// + /// + /// A instance. + /// + /// + /// Could not obtain the underlying from the + /// + /// + /// An . + /// public static ArraySegment GetArray(this ReadOnlyMemory buffer) #pragma warning restore RCS1231 // Make parameter ref read-only. { diff --git a/src/StackExchange.Metrics/StackExchange.Metrics.csproj b/src/StackExchange.Metrics/StackExchange.Metrics.csproj index ceb9fa8..acc251c 100644 --- a/src/StackExchange.Metrics/StackExchange.Metrics.csproj +++ b/src/StackExchange.Metrics/StackExchange.Metrics.csproj @@ -26,14 +26,15 @@ - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/tests/StackExchange.Metrics.Tests/StackExchange.Metrics.Tests.csproj b/tests/StackExchange.Metrics.Tests/StackExchange.Metrics.Tests.csproj index 6920b08..b6c81c4 100644 --- a/tests/StackExchange.Metrics.Tests/StackExchange.Metrics.Tests.csproj +++ b/tests/StackExchange.Metrics.Tests/StackExchange.Metrics.Tests.csproj @@ -1,21 +1,21 @@ - netcoreapp3.1 + net6.0 false - - - - + + + + + - diff --git a/version.json b/version.json index 311298b..2b9f5ac 100644 --- a/version.json +++ b/version.json @@ -2,7 +2,7 @@ "version": "2.0", "assemblyVersion": "2.0", "publicReleaseRefSpec": [ - "^refs/heads/master$", + "^refs/heads/main$", "^refs/tags/v\\d+\\.\\d+" ], "nugetPackageVersion": {