Skip to content

Commit 1640a38

Browse files
committed
+ Added actions to disable or reset Observability settings.
1 parent 1634bd2 commit 1640a38

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

RockSweeper/RockSweeper.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@
178178
<Compile Include="SweeperActions\DataScrubbing\PersonTokenRemoveData.cs" />
179179
<Compile Include="SweeperActions\General\DisableRockJobs.cs" />
180180
<Compile Include="SweeperActions\General\DisableSslForSitesAndPages.cs" />
181+
<Compile Include="SweeperActions\ServiceProviders\ObservabilityDisable.cs" />
182+
<Compile Include="SweeperActions\ServiceProviders\ObservabilityReset.cs" />
181183
<Compile Include="SweeperActions\SweeperAction.cs" />
182184
<Compile Include="SweeperActions\Storage\ConvertBinaryFilesToDatabasePlaceholders.cs" />
183185
<Compile Include="SweeperActions\Storage\MoveBinaryFilesIntoDatabase.cs" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.ComponentModel;
2+
using System.Threading.Tasks;
3+
4+
using RockSweeper.Attributes;
5+
6+
namespace RockSweeper.SweeperActions.ServiceProviders
7+
{
8+
/// <summary>
9+
/// Updates the Rock configuration to that the observability feature is disabled.
10+
/// </summary>
11+
[ActionId( "5e27c631-3681-4d1b-b50c-0e5f3898e541" )]
12+
[Title( "Observability (Disable)" )]
13+
[Description( "Updates the Rock configuration to that the observability feature is disabled." )]
14+
[Category( "Service Providers" )]
15+
[DefaultValue( true )]
16+
[ConflictsWithAction( typeof( ObservabilityReset ) )]
17+
public class ObservabilityDisable : SweeperAction
18+
{
19+
public override async Task ExecuteAsync()
20+
{
21+
await Sweeper.SqlCommandAsync( "DELETE FROM [Attribute] WHERE [EntityTypeQualifierColumn] = 'SystemSetting' AND [Key] = 'core_ObservabilityEnabled'" );
22+
}
23+
}
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.ComponentModel;
2+
using System.Threading.Tasks;
3+
4+
using RockSweeper.Attributes;
5+
6+
namespace RockSweeper.SweeperActions.ServiceProviders
7+
{
8+
/// <summary>
9+
/// Resets all observability settings to system default values.
10+
/// </summary>
11+
[ActionId( "12956c26-2965-4c40-9cfd-28c542357e55" )]
12+
[Title( "Observability (Reset)" )]
13+
[Description( "Resets all observability settings to system default values." )]
14+
[Category( "Service Providers" )]
15+
[ConflictsWithAction( typeof( ObservabilityDisable ) )]
16+
public class ObservabilityReset : SweeperAction
17+
{
18+
public override async Task ExecuteAsync()
19+
{
20+
await Sweeper.SqlCommandAsync( "DELETE FROM [Attribute] WHERE [EntityTypeQualifierColumn] = 'SystemSetting' AND [Key] LIKE 'core_Observability%'" );
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)