Skip to content

Commit

Permalink
Prepare for RTM (#511)
Browse files Browse the repository at this point in the history
* Prepare for RTM

* Tweaks

* Add test to verify JSON serialization

* Remove SimpleJson

* Remove unused code

---------

Co-authored-by: Brandon Ording <bording@gmail.com>
  • Loading branch information
andreasohlund and bording authored Mar 1, 2024
1 parent 6b5b99c commit 8bae31f
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 2,220 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescr

var storageDir = Path.Combine(NServiceBusAcceptanceTest.StorageRootDir, NUnit.Framework.TestContext.CurrentContext.Test.ID);

configuration.UseSerialization<SystemJsonSerializer>();
configuration.UseTransport(new LearningTransport { StorageDirectory = storageDir });

configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
<ProjectReference Include="..\NServiceBus.Metrics.ServiceControl\NServiceBus.Metrics.ServiceControl.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0" />
<PackageReference Include="NServiceBus.Metrics" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.1" />
<PackageReference Include="NServiceBus.Metrics" Version="5.0.0-alpha.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public void Approve()
{
var publicApi = typeof(MetricsOptionsExtensions).Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
ExcludeAttributes = new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" }
ExcludeAttributes = ["System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute"]
});
Approver.Verify(publicApi);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"NServiceBus.Metrics.ServiceControl.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5")]
namespace NServiceBus.Metrics.ServiceControl
{
public interface IReportNativeQueueLength
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"PluginVersion":3,"LocalAddress":"localAddress"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace NServiceBus.Metrics.ServiceControl.Tests
{
using NServiceBus.Metrics.ServiceControl.ServiceControlReporting;
using NUnit.Framework;
using Particular.Approvals;

[TestFixture]
class EndpointMetadataTests
{
[Test]
public void Verify_serialization()
{
var endpointMetadata = new EndpointMetadata("localAddress");
var json = endpointMetadata.ToJson();

Approver.Verify(json);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBusTests.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\NServiceBus.Metrics.ServiceControl\NServiceBus.Metrics.ServiceControl.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.Metrics" Version="5.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.1" />
</ItemGroup>

</Project>
39 changes: 0 additions & 39 deletions src/NServiceBus.Metrics.ServiceControl/Guard.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public static class MetricsOptionsExtensions
/// <param name="instanceId">Unique, human-readable, stable between restarts, identifier for running endpoint instance.</param>
public static void SendMetricDataToServiceControl(this MetricsOptions options, string serviceControlMetricsAddress, TimeSpan interval, string instanceId = null)
{
Guard.AgainstNullAndEmpty(nameof(serviceControlMetricsAddress), serviceControlMetricsAddress);
Guard.AgainstNegativeAndZero(nameof(interval), interval);
ArgumentException.ThrowIfNullOrWhiteSpace(serviceControlMetricsAddress);
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(interval, TimeSpan.Zero);

var reporting = ReportingOptions.Get(options);

Expand All @@ -32,6 +32,8 @@ public static void SendMetricDataToServiceControl(this MetricsOptions options, s
/// <param name="timeToBeReceived">Time to be received.</param>
public static void SetServiceControlMetricsMessageTTBR(this MetricsOptions options, TimeSpan timeToBeReceived)
{
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(timeToBeReceived, TimeSpan.Zero);

var reporting = ReportingOptions.Get(options);

reporting.TimeToBeReceived = timeToBeReceived;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(SolutionDir)NServiceBus.snk</AssemblyOriginatorKeyFile>
<Description>Plugin for sending endpoint monitoring data to a ServiceControl Monitoring instance</Description>
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.1" />
<PackageReference Include="NServiceBus.Metrics" Version="5.0.0-alpha.1" />
<PackageReference Include="NServiceBus" Version="[9.0.0, 10.0.0)" />
<PackageReference Include="NServiceBus.Metrics" Version="[5.0.0, 6.0.0)" />
<PackageReference Include="Particular.Packaging" Version="4.1.0" PrivateAssets="All" />
<PackageReference Include="ServiceControl.Monitoring.Data" Version="3.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="NServiceBus.Metrics.ServiceControl.Tests" Key="$(NServiceBusTestsKey)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace NServiceBus.Metrics.ServiceControl.ServiceControlReporting
{
using System.Text.Json;

class EndpointMetadata
{
readonly string localAddress;
Expand All @@ -11,7 +13,7 @@ public EndpointMetadata(string localAddress)

public string ToJson()
{
return SimpleJson.SerializeObject(new
return JsonSerializer.Serialize(new
{
PluginVersion = 3,
LocalAddress = localAddress
Expand Down
Loading

0 comments on commit 8bae31f

Please sign in to comment.