-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blocks in RTE telemetry (#16104)
* Add blocks telemetry * Use constants and update tests * V13: Add property type information to telemetry (#16109) * Add property type counts to telemetry * Use constants and fix tests * Update description
- Loading branch information
1 parent
a27a4dc
commit 0980350
Showing
7 changed files
with
63 additions
and
2 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
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
42 changes: 42 additions & 0 deletions
42
src/Umbraco.Infrastructure/Telemetry/Providers/BlocksInRichTextTelemetryProvider.cs
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,42 @@ | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.Models; | ||
using Umbraco.Cms.Core.PropertyEditors; | ||
using Umbraco.Cms.Core.Services; | ||
using Umbraco.Cms.Infrastructure.Telemetry.Interfaces; | ||
|
||
namespace Umbraco.Cms.Infrastructure.Telemetry.Providers; | ||
|
||
public class BlocksInRichTextTelemetryProvider : IDetailedTelemetryProvider | ||
{ | ||
private readonly IDataTypeService _dataTypeService; | ||
|
||
public BlocksInRichTextTelemetryProvider(IDataTypeService dataTypeService) | ||
{ | ||
_dataTypeService = dataTypeService; | ||
} | ||
|
||
public IEnumerable<UsageInformation> GetInformation() | ||
{ | ||
IEnumerable<IDataType> richTextDataTypes = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.TinyMce).ToArray(); | ||
int registeredBlocks = 0; | ||
yield return new UsageInformation(Constants.Telemetry.RichTextEditorCount, richTextDataTypes.Count()); | ||
|
||
foreach (IDataType richTextDataType in richTextDataTypes) | ||
{ | ||
if (richTextDataType.Configuration is not RichTextConfiguration richTextConfiguration) | ||
{ | ||
// Might be some custom data type, skip it | ||
continue; | ||
} | ||
|
||
if (richTextConfiguration.Blocks is null) | ||
{ | ||
continue; | ||
} | ||
|
||
registeredBlocks += richTextConfiguration.Blocks.Length; | ||
} | ||
|
||
yield return new UsageInformation(Constants.Telemetry.RichTextBlockCount, registeredBlocks); | ||
} | ||
} |
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