diff --git a/src/Umbraco.Core/Constants-Telemetry.cs b/src/Umbraco.Core/Constants-Telemetry.cs index b5c1e15c94f7..4ea11822266f 100644 --- a/src/Umbraco.Core/Constants-Telemetry.cs +++ b/src/Umbraco.Core/Constants-Telemetry.cs @@ -36,5 +36,10 @@ public static class Telemetry public static string WebhookTotal = $"{WebhookPrefix}Total"; public static string WebhookCustomHeaders = $"{WebhookPrefix}CustomHeaders"; public static string WebhookCustomEvent = $"{WebhookPrefix}CustomEvent"; + public static string RichTextEditorCount = "RichTextEditorCount"; + public static string RichTextBlockCount = "RichTextBlockCount"; + public static string TotalPropertyCount = "TotalPropertyCount"; + public static string HighestPropertyCount = "HighestPropertyCount"; + public static string TotalCompositions = "TotalCompositions"; } } diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml index 5559768c675f..499596799389 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml @@ -3077,7 +3077,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
  • Anonymized site ID, Umbraco version, and packages installed.
  • -
  • Number of: Root nodes, Content nodes, Macros, Media, Document Types, Templates, Languages, Domains, User Group, Users, Members, Backoffice external login providers, Webhooks, and Property Editors in use.
  • +
  • Number of: Root nodes, Content nodes, Macros, Media, Document Types, Property Types, Compositions, Templates, Languages, Domains, User Group, Users, Members, Backoffice external login providers, Webhooks, rich text datatypes, blocks used in rich text datatypes, and Property Editors in use.
  • System information: Webserver, server OS, server framework, server OS language, and database provider.
  • Configuration settings: Modelsbuilder mode, if custom Umbraco path exists, ASP environment, whether the delivery API is enabled, and allows public access, and if you are in debug mode.
  • diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml index 35dfc458ce8f..39b20009f47a 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml @@ -3096,7 +3096,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont We will send: diff --git a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.TelemetryProviders.cs b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.TelemetryProviders.cs index 69ee653c199e..e18a8fbdf8fa 100644 --- a/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.TelemetryProviders.cs +++ b/src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.TelemetryProviders.cs @@ -21,6 +21,7 @@ public static IUmbracoBuilder AddTelemetryProviders(this IUmbracoBuilder builder builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); + builder.Services.AddTransient(); return builder; } } diff --git a/src/Umbraco.Infrastructure/Telemetry/Providers/BlocksInRichTextTelemetryProvider.cs b/src/Umbraco.Infrastructure/Telemetry/Providers/BlocksInRichTextTelemetryProvider.cs new file mode 100644 index 000000000000..2af4a7f6adff --- /dev/null +++ b/src/Umbraco.Infrastructure/Telemetry/Providers/BlocksInRichTextTelemetryProvider.cs @@ -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 GetInformation() + { + IEnumerable 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); + } +} diff --git a/src/Umbraco.Infrastructure/Telemetry/Providers/PropertyEditorTelemetryProvider.cs b/src/Umbraco.Infrastructure/Telemetry/Providers/PropertyEditorTelemetryProvider.cs index 1c8e0af1ab49..8bd735ec1c7d 100644 --- a/src/Umbraco.Infrastructure/Telemetry/Providers/PropertyEditorTelemetryProvider.cs +++ b/src/Umbraco.Infrastructure/Telemetry/Providers/PropertyEditorTelemetryProvider.cs @@ -16,11 +16,19 @@ public IEnumerable GetInformation() { IEnumerable contentTypes = _contentTypeService.GetAll(); var propertyTypes = new HashSet(); + var propertyTypeCounts = new List(); + var totalCompositions = 0; + foreach (IContentType contentType in contentTypes) { propertyTypes.UnionWith(contentType.PropertyTypes.Select(x => x.PropertyEditorAlias)); + propertyTypeCounts.Add(contentType.CompositionPropertyTypes.Count()); + totalCompositions += contentType.CompositionAliases().Count(); } yield return new UsageInformation(Constants.Telemetry.Properties, propertyTypes); + yield return new UsageInformation(Constants.Telemetry.TotalPropertyCount, propertyTypeCounts.Sum()); + yield return new UsageInformation(Constants.Telemetry.HighestPropertyCount, propertyTypeCounts.Count > 0 ? propertyTypeCounts.Max() : 0); + yield return new UsageInformation(Constants.Telemetry.TotalCompositions, totalCompositions); } } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Core/Telemetry/TelemetryServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Core/Telemetry/TelemetryServiceTests.cs index e5691c15cb02..67b2f63c191a 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Core/Telemetry/TelemetryServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Core/Telemetry/TelemetryServiceTests.cs @@ -58,6 +58,11 @@ public void Expected_Detailed_Telemetry_Exists() Constants.Telemetry.WebhookTotal, Constants.Telemetry.WebhookCustomHeaders, Constants.Telemetry.WebhookCustomEvent, + Constants.Telemetry.RichTextEditorCount, + Constants.Telemetry.RichTextBlockCount, + Constants.Telemetry.TotalPropertyCount, + Constants.Telemetry.HighestPropertyCount, + Constants.Telemetry.TotalCompositions, }; // Add the default webhook events.