Skip to content

Commit

Permalink
RavenDB-21412 added TotalNumberOfQueueSinkTasks
Browse files Browse the repository at this point in the history
  • Loading branch information
arekpalinski committed Jun 14, 2024
1 parent 3cae942 commit cbf0679
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ protected override Integer32 GetData()

protected static int GetNumberOfActiveSqlEtls(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.SqlEtls.Where(x => x.Disabled == false));

protected static int GetNumberOfActiveQueueSinks(RachisState rachisState, string nodeTag, RawDatabaseRecord database) => CountTasks(rachisState, nodeTag, database.Topology, database.QueueSinks.Where(x => x.Disabled == false));

protected static int GetNumberOfActiveSubscriptions(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database)
{
var count = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Raven.Client.ServerWide;
using Raven.Server.ServerWide;
using Raven.Server.ServerWide.Context;

namespace Raven.Server.Monitoring.Snmp.Objects.Database;

public class TotalNumberOfActiveQueueSinkTasks : ActiveOngoingTasksBase
{
public TotalNumberOfActiveQueueSinkTasks(ServerStore serverStore) : base(serverStore, SnmpOids.Databases.General.TotalNumberOfActiveQueueSinkTasks)
{
}

protected override int GetCount(TransactionOperationContext context, RachisState rachisState, string nodeTag, RawDatabaseRecord database)
{
return GetNumberOfActiveQueueSinks(rachisState, nodeTag, database);
}
}
3 changes: 3 additions & 0 deletions src/Raven.Server/Monitoring/Snmp/SnmpOids.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ private General()
[Description("Number of active Pull Replication As Sink tasks for all databases")]
public const string TotalNumberOfActivePullReplicationAsSinkTasks = "5.1.11.20";

[Description("Number of active Queue Sink tasks for all databases")]
public const string TotalNumberOfActiveQueueSinkTasks = "5.1.11.21";

public static DynamicJsonArray ToJson()
{
var array = new DynamicJsonArray();
Expand Down
3 changes: 2 additions & 1 deletion test/FastTests/Issues/RavenDB_21412.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public void Validate_All_OngoingTaskTypes_Are_Added_To_Snmp()
OngoingTaskType.RavenEtl,
OngoingTaskType.Replication,
OngoingTaskType.SqlEtl,
OngoingTaskType.Subscription
OngoingTaskType.Subscription,
OngoingTaskType.QueueSink
};

foreach (var enumValue in Enum.GetValues<OngoingTaskType>())
Expand Down

0 comments on commit cbf0679

Please sign in to comment.