-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from RaaLabs/modernize
Modernize
- Loading branch information
Showing
10 changed files
with
353 additions
and
283 deletions.
There are no files selected for viewing
This file contains 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 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 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,23 @@ | ||
// Copyright (c) RaaLabs. All rights reserved. | ||
// Licensed under the GPLv2 License. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Globalization; | ||
using RaaLabs.Edge.Modules.EdgeHub; | ||
|
||
namespace RaaLabs.Edge.Connectors.OPCUA; | ||
|
||
/// <summary> | ||
/// Config class for batching settings. | ||
/// </summary> | ||
public class BatchConfiguration : IEdgeHubOutgoingEventBatchConfiguration | ||
{ | ||
/// <summary> | ||
/// The batch size. | ||
/// </summary> | ||
public int BatchSize { get; set; } = int.Parse(Environment.GetEnvironmentVariable("EDGEHUB_BATCH_SIZE") ?? "250", CultureInfo.CurrentCulture); | ||
/// <summary> | ||
/// The batch interval in milliseconds. | ||
/// </summary> | ||
public int Interval { get; set; } = int.Parse(Environment.GetEnvironmentVariable("EDGEHUB_BATCH_INTERVAL") ?? "5000", CultureInfo.CurrentCulture); | ||
} |
This file contains 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 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,36 @@ | ||
// Copyright (c) RaaLabs. All rights reserved. | ||
// Licensed under the GPLv2 License. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Globalization; | ||
using System.Diagnostics.CodeAnalysis; | ||
using RaaLabs.Edge.Modules.Diagnostics.Metrics; | ||
using RaaLabs.Edge.Modules.EventHandling.RequestHandling; | ||
|
||
|
||
namespace RaaLabs.Edge.Connectors.OPCUA; | ||
|
||
/// <summary> | ||
/// Interface for registering metrics | ||
/// </summary> | ||
#pragma warning disable CS1591 | ||
[Metrics(Prefix = "raaedge")] | ||
[Labels("iothub", "{IOTEDGE_IOTHUBHOSTNAME:env}", "edge_device", "{IOTEDGE_DEVICEID:env}", "edge_module", "{IOTEDGE_MODULEID:env}", "module", "{IOTEDGE_MODULEID:env}", "instance_number", "{InstanceNumber}")] | ||
public interface IMetricsHandler : IMetricsClient, IWithStateFrom<MetricsHandlerState> | ||
{ | ||
|
||
[Counter(Name = "messages_received_total", Unit = "count", Description = "The total number of messages received", Exported = true)] | ||
public void NumberOfMessagesReceived(long value); | ||
|
||
[Counter(Name = "messages_sent_total", Unit = "count", Description = "The total number of messages sent", Exported = true)] | ||
public void NumberOfMessagesSent(long value); | ||
} | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class MetricsHandlerState | ||
{ | ||
/// <summary> | ||
/// The instance number. | ||
/// </summary> | ||
public string InstanceNumber { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString("x", CultureInfo.InvariantCulture); | ||
} |
This file contains 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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<TrimMode>partial</TrimMode> | ||
<AssemblyName>RaaLabs.Edge.Connectors.OPCUA</AssemblyName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectCapability Include="AzureIoTEdgeModule" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="RaaLabs.Edge" Version="1.7.2" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.EventHandling" Version="1.7.2" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.Configuration" Version="1.7.2" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.EdgeHub" Version="1.7.2" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.4.368.58" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.4.368.58" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.4.368.58" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.4.368.58" /> | ||
<PackageReference Include="Polly" Version="7.2.2" /> | ||
<PackageReference Include="System.Linq" Version="4.3.0" /> | ||
<PackageReference Include="morelinq" Version="3.3.2" /> | ||
<TrimmerRootAssembly Include="RaaLabs.Edge.Connectors.OPCUA" preserve="all" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="RaaLabs.Edge" Version="1.13.6" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.EventHandling" Version="1.13.6" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.Configuration" Version="1.13.6" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.EdgeHub" Version="1.13.6" /> | ||
<PackageReference Include="RaaLabs.Edge.Modules.Diagnostics" Version="1.13.6" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.4.371.60" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client" Version="1.4.371.60" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.4.371.60" /> | ||
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.4.371.60" /> | ||
<PackageReference Include="Polly" Version="7.2.3" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.