From c0a9936e45398975a1ff6e8a46c6eebbf76702bd Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:21:17 +0100
Subject: [PATCH 1/2] chore: remove obsolete az dependency telemetry
---
...LoggerAzureKeyVaultDependencyExtensions.cs | 64 ---
.../ILoggerAzureSearchDependencyExtensions.cs | 30 --
.../ILoggerBlobStorageDependencyExtensions.cs | 28 --
.../ILoggerCosmosSqlDependencyExtensions.cs | 31 --
.../ILoggerEventHubsDependencyExtensions.cs | 28 --
.../ILoggerIotHubDependencyExtensions.cs | 25 --
.../ILoggerServiceBusDependencyExtensions.cs | 251 ------------
...ILoggerTableStorageDependencyExtensions.cs | 28 --
.../Serilog/TelemetryTypeFilterTests.cs | 16 +-
...licationInsightsTelemetryConverterTests.cs | 118 ------
.../AzureBlobStorageDependencyLoggingTests.cs | 29 --
.../AzureKeyVaultDependencyLoggingTests.cs | 48 ---
.../AzureSearchDependencyLoggingTests.cs | 28 --
.../AzureServiceBusDependencyLoggingTests.cs | 381 ------------------
.../AzureTableStorageDependencyTests.cs | 29 --
.../CosmosSqlDependencyLoggingTests.cs | 31 --
.../EventHubsDependencyLoggingTests.cs | 29 --
.../Logging/IoTHubDependencyLoggingTests.cs | 28 --
18 files changed, 12 insertions(+), 1210 deletions(-)
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureKeyVaultDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureKeyVaultDependencyExtensions.cs
index a0918103..c3589534 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureKeyVaultDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureKeyVaultDependencyExtensions.cs
@@ -13,37 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Key Vault dependency.
- ///
- /// The logger to use.
- /// The URI pointing to the Azure Key Vault resource.
- /// The secret that is being used within the Azure Key Vault resource.
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- /// Thrown when the is not in the correct format.
- /// Thrown when the is not in the correct format.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Key Vault dependency")]
- public static void LogAzureKeyVaultDependency(
- this ILogger logger,
- string vaultUri,
- string secretName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires an logger instance to write the Azure Key Vault dependency");
- Guard.NotNullOrWhitespace(vaultUri, nameof(vaultUri), "Requires a non-blank URI for the Azure Key Vault");
- Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name for the Azure Key Vault");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Key Vault when tracking an Azure Key Vault dependency");
-
- context = context ?? new Dictionary();
- LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement, dependencyId: null, context);
- }
-
///
/// Logs an Azure Key Vault dependency.
///
@@ -73,39 +42,6 @@ public static void LogAzureKeyVaultDependency(
LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement, dependencyId: null, context);
}
- ///
- /// Logs an Azure Key Vault dependency.
- ///
- /// The logger to use.
- /// The URI pointing to the Azure Key Vault resource.
- /// The secret that is being used within the Azure Key Vault resource.
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// The ID of the dependency to link as parent ID.
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- /// Thrown when the is not in the correct format.
- /// Thrown when the is not in the correct format.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Key Vault dependency")]
- public static void LogAzureKeyVaultDependency(
- this ILogger logger,
- string vaultUri,
- string secretName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- string dependencyId,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires an logger instance to write the Azure Key Vault dependency");
- Guard.NotNullOrWhitespace(vaultUri, nameof(vaultUri), "Requires a non-blank URI for the Azure Key Vault");
- Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name for the Azure Key Vault");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Key Vault when tracking an Azure Key Vault dependency");
-
- context = context ?? new Dictionary();
- LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement.StartTime, measurement.Elapsed, dependencyId, context);
- }
-
///
/// Logs an Azure Key Vault dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureSearchDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureSearchDependencyExtensions.cs
index 18713d39..a139d585 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureSearchDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerAzureSearchDependencyExtensions.cs
@@ -13,36 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Search Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Azure Search service
- /// Name of the operation to execute on the Azure Search service
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure search dependency")]
- public static void LogAzureSearchDependency(
- this ILogger logger,
- string searchServiceName,
- string operationName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track the Azure Search dependency");
- Guard.NotNullOrWhitespace(searchServiceName, nameof(searchServiceName), "Requires a non-blank name for the Azure Search service to track the Azure Service dependency");
- Guard.NotNullOrWhitespace(operationName, nameof(operationName), "Requires a non-blank name for the Azure Search service to track the Azure Service dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Search resource when tracking the Azure Search dependency");
-
- context = context ?? new Dictionary();
-
- LogAzureSearchDependency(logger, searchServiceName, operationName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Search Dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerBlobStorageDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerBlobStorageDependencyExtensions.cs
index abe76466..b88ad9aa 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerBlobStorageDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerBlobStorageDependencyExtensions.cs
@@ -13,34 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Blob Storage Dependency.
- ///
- /// The logger to track the telemetry.
- /// Account of the storage resource
- /// Name of the Blob Container resource
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Blob storage dependency")]
- public static void LogBlobStorageDependency(
- this ILogger logger,
- string accountName,
- string containerName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(accountName, nameof(accountName), "Requires a non-blank account name for the Azure Blob storage resource to track an Azure Blob storage dependency");
- Guard.NotNullOrWhitespace(containerName, nameof(containerName), "Requires a non-blank container name in the Azure BLob storage resource to track an Azure Blob storage dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Blob storage when tracking an Azure Blob storage dependency");
-
- LogBlobStorageDependency(logger, accountName, containerName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Blob Storage Dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerCosmosSqlDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerCosmosSqlDependencyExtensions.cs
index 9c45b503..6dd11eb4 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerCosmosSqlDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerCosmosSqlDependencyExtensions.cs
@@ -13,37 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs a Cosmos SQL dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the storage resource
- /// Name of the database
- /// Name of the container
- /// Indication whether or not the operation was successful
- /// Measuring the latency of the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the , , or is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track a Cosmos SQL dependency")]
- public static void LogCosmosSqlDependency(
- this ILogger logger,
- string accountName,
- string database,
- string container,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(accountName, nameof(accountName), "Requires a non-blank account name of the Cosmos SQL storage to track a Cosmos SQL dependency");
- Guard.NotNullOrWhitespace(database, nameof(database), "Requires a non-blank database name of the Cosmos SQL storage to track a Cosmos SQL dependency");
- Guard.NotNullOrWhitespace(container, nameof(container), "Requires a non-blank container name of the Cosmos SQL storage to track a Cosmos SQL dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Cosmos SQL storage when tracking an Cosmos SQL dependency");
-
- LogCosmosSqlDependency(logger, accountName, database, container, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs a Cosmos SQL dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerEventHubsDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerEventHubsDependencyExtensions.cs
index a4d261b3..3d371592 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerEventHubsDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerEventHubsDependencyExtensions.cs
@@ -13,34 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Event Hub Dependency.
- ///
- /// The logger to track the telemetry.
- /// Namespace of the resource
- /// Name of the Event Hub resource
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Event Hubs dependency")]
- public static void LogEventHubsDependency(
- this ILogger logger,
- string namespaceName,
- string eventHubName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(namespaceName, nameof(namespaceName), "Requires a non-blank resource namespace of the Azure Event Hub to track an Azure Event Hub dependency");
- Guard.NotNullOrWhitespace(eventHubName, nameof(eventHubName), "Requires a non-blank Azure Event Hub name to track an Azure Event Hub dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Event Hub resource when tracking an Azure Event Hub dependency");
-
- LogEventHubsDependency(logger, namespaceName, eventHubName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Event Hub Dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerIotHubDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerIotHubDependencyExtensions.cs
index 85d0c07d..19b01d8b 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerIotHubDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerIotHubDependencyExtensions.cs
@@ -14,31 +14,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Iot Hub Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the IoT Hub resource
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure IoT Hub dependency")]
- public static void LogIotHubDependency(
- this ILogger logger,
- string iotHubName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(iotHubName, nameof(iotHubName), "Requires a non-blank resource name of the IoT Hub resource to track a IoT Hub dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the IoT Hub resource when tracking a IoT Hub dependency");
-
- LogIotHubDependency(logger, iotHubName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Iot Hub Dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerServiceBusDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerServiceBusDependencyExtensions.cs
index c829be45..b0600db2 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerServiceBusDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerServiceBusDependencyExtensions.cs
@@ -13,54 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus queue
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the Service Bus dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Service Bus queue dependency")]
- public static void LogServiceBusQueueDependency(
- this ILogger logger,
- string queueName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus Queue when tracking the Azure Service Bus Queue dependency");
-
- LogServiceBusQueueDependency(logger, queueName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// The name of the Service Bus queue.
- /// The indication whether or not the operation was successful.
- /// The measurement of the duration to call the dependency.
- /// The context that provides more insights on the dependency that was measured.
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the " + nameof(LogServiceBusQueueDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusQueueDependency(
- this ILogger logger,
- string queueName,
- bool isSuccessful,
- DurationMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(queueName, nameof(queueName), "Requires a non-blank Azure Service Bus Queue name to track an Azure Service Bus Queue dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus Queue when tracking the Azure Service Bus Queue dependency");
-
- LogServiceBusQueueDependency(logger, queueName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
@@ -90,34 +42,6 @@ public static void LogServiceBusQueueDependency(
LogServiceBusQueueDependency(logger, serviceBusNamespaceEndpoint, queueName, isSuccessful, measurement.StartTime, measurement.Elapsed, dependencyId, context);
}
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus queue
- /// Indication whether or not the operation was successful
- /// Point in time when the interaction with the HTTP dependency was started
- /// Duration of the operation
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the is null.
- /// Thrown when the is blank.
- /// Thrown when the is a negative time range.
- [Obsolete("Use the " + nameof(LogServiceBusQueueDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusQueueDependency(
- this ILogger logger,
- string queueName,
- bool isSuccessful,
- DateTimeOffset startTime,
- TimeSpan duration,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(queueName, nameof(queueName), "Requires a non-blank Azure Service Bus Queue name to track an Azure Service Bus Queue dependency");
- Guard.NotLessThan(duration, TimeSpan.Zero, nameof(duration), "Requires a positive time duration of the Azure Service Bus Queue operation");
-
- LogServiceBusDependency(logger, queueName, isSuccessful, startTime, duration, ServiceBusEntityType.Queue, context);
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
@@ -150,56 +74,6 @@ public static void LogServiceBusQueueDependency(
LogServiceBusDependency(logger, serviceBusNamespaceEndpoint, queueName, isSuccessful, startTime, duration, dependencyId, ServiceBusEntityType.Queue, context);
}
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus topic
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the Service Bus dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Service Bus topic dependency")]
- public static void LogServiceBusTopicDependency(
- this ILogger logger,
- string topicName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(topicName, nameof(topicName), "Requires a non-blank Azure Service Bus Topic name to track an Azure Service Bus Topic dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus Topic when tracking the Azure Service Bus Topic dependency");
-
- LogServiceBusTopicDependency(logger, topicName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// The name of the Service Bus topic.
- /// The indication whether or not the operation was successful.
- /// The measurement of the duration to call the dependency.
- /// The context that provides more insights on the dependency that was measured.
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the " + nameof(LogServiceBusTopicDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusTopicDependency(
- this ILogger logger,
- string topicName,
- bool isSuccessful,
- DurationMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(topicName, nameof(topicName), "Requires a non-blank Azure Service Bus Topic name to track an Azure Service Bus Topic dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus Topic when tracking the Azure Service Bus Topic dependency");
-
- LogServiceBusTopicDependency(logger, topicName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
@@ -229,34 +103,6 @@ public static void LogServiceBusTopicDependency(
LogServiceBusTopicDependency(logger, serviceBusNamespaceEndpoint, topicName, isSuccessful, measurement.StartTime, measurement.Elapsed, dependencyId, context);
}
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus topic
- /// Indication whether or not the operation was successful
- /// Point in time when the interaction with the HTTP dependency was started
- /// Duration of the operation
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the is null.
- /// Thrown when the is blank.
- /// Thrown when the is a negative time range.
- [Obsolete("Use the " + nameof(LogServiceBusTopicDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusTopicDependency(
- this ILogger logger,
- string topicName,
- bool isSuccessful,
- DateTimeOffset startTime,
- TimeSpan duration,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(topicName, nameof(topicName), "Requires a non-blank Azure Service Bus Topic name to track an Azure Service Bus Topic dependency");
- Guard.NotLessThan(duration, TimeSpan.Zero, nameof(duration), "Requires a positive time duration of the Azure Service Bus Topic operation");
-
- LogServiceBusDependency(logger, topicName, isSuccessful, startTime, duration, ServiceBusEntityType.Topic, context);
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
@@ -289,60 +135,6 @@ public static void LogServiceBusTopicDependency(
LogServiceBusDependency(logger, serviceBusNamespaceEndpoint, topicName, isSuccessful, startTime, duration, dependencyId, ServiceBusEntityType.Topic, context);
}
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus entity
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the Service Bus dependency
- /// Type of the Service Bus entity
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Service Bus dependency")]
- public static void LogServiceBusDependency(
- this ILogger logger,
- string entityName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- ServiceBusEntityType entityType = ServiceBusEntityType.Unknown,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(entityName, nameof(entityName), "Requires a non-blank Azure Service Bus entity name to track an Azure Service Bus dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus when tracking the Azure Service Bus dependency");
-
- LogServiceBusDependency(logger, entityName, isSuccessful, measurement.StartTime, measurement.Elapsed, entityType, context);
- }
-
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// The name of the Service Bus entity.
- /// The indication whether or not the operation was successful.
- /// The measurement of the duration to call the dependency.
- /// The type of the Service Bus entity.
- /// The context that provides more insights on the dependency that was measured.
- /// Thrown when the or is null.
- /// Thrown when the is blank.
- [Obsolete("Use the " + nameof(LogServiceBusDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusDependency(
- this ILogger logger,
- string entityName,
- bool isSuccessful,
- DurationMeasurement measurement,
- ServiceBusEntityType entityType = ServiceBusEntityType.Unknown,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(entityName, nameof(entityName), "Requires a non-blank Azure Service Bus entity name to track an Azure Service Bus dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Service Bus when tracking the Azure Service Bus dependency");
-
- LogServiceBusDependency(logger, entityName, isSuccessful, measurement.StartTime, measurement.Elapsed, entityType, context);
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
@@ -374,49 +166,6 @@ public static void LogServiceBusDependency(
LogServiceBusDependency(logger, serviceBusNamespaceEndpoint, entityName, isSuccessful, measurement.StartTime, measurement.Elapsed, dependencyId, entityType, context);
}
- ///
- /// Logs an Azure Service Bus Dependency.
- ///
- /// The logger to track the telemetry.
- /// Name of the Service Bus entity
- /// Indication whether or not the operation was successful
- /// Point in time when the interaction with the dependency was started
- /// Duration of the operation
- /// Type of the Service Bus entity
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the is null.
- /// Thrown when the is blank.
- /// Thrown when the is a negative time range.
- [Obsolete("Use the " + nameof(LogServiceBusDependency) + " method overload with an Azure Service Bus namespace endpoint instead")]
- public static void LogServiceBusDependency(
- this ILogger logger,
- string entityName,
- bool isSuccessful,
- DateTimeOffset startTime,
- TimeSpan duration,
- ServiceBusEntityType entityType = ServiceBusEntityType.Unknown,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(entityName, nameof(entityName), "Requires a non-blank Azure Service Bus entity name to track an Azure Service Bus dependency");
- Guard.NotLessThan(duration, TimeSpan.Zero, nameof(duration), "Requires a positive time duration of the Azure Service Bus operation");
-
- context = context ?? new Dictionary();
- context[ContextProperties.DependencyTracking.ServiceBus.EntityType] = entityType;
-
- logger.LogWarning(MessageFormats.DependencyFormat, new DependencyLogEntry(
- dependencyType: "Azure Service Bus",
- dependencyName: entityName,
- dependencyData: null,
- dependencyId: null,
- targetName: entityName,
- duration: duration,
- startTime: startTime,
- resultCode: null,
- isSuccessful: isSuccessful,
- context: context));
- }
-
///
/// Logs an Azure Service Bus Dependency.
///
diff --git a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerTableStorageDependencyExtensions.cs b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerTableStorageDependencyExtensions.cs
index f836ef6c..267aa173 100644
--- a/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerTableStorageDependencyExtensions.cs
+++ b/src/Arcus.Observability.Telemetry.Core/Extensions/ILoggerTableStorageDependencyExtensions.cs
@@ -13,34 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
- ///
- /// Logs an Azure Table Storage Dependency.
- ///
- /// The logger to track the telemetry.
- /// Account of the storage resource
- /// Name of the Table Storage resource
- /// Indication whether or not the operation was successful
- /// Measuring the latency to call the Table Storage dependency
- /// Context that provides more insights on the dependency that was measured
- /// Thrown when the or is null.
- /// Thrown when the or is blank.
- [Obsolete("Use the overload with " + nameof(DurationMeasurement) + " instead to track an Azure Table storage dependency")]
- public static void LogTableStorageDependency(
- this ILogger logger,
- string accountName,
- string tableName,
- bool isSuccessful,
- DependencyMeasurement measurement,
- Dictionary context = null)
- {
- Guard.NotNull(logger, nameof(logger), "Requires a logger instance to track telemetry");
- Guard.NotNullOrWhitespace(accountName, nameof(accountName), "Requires a non-blank account name for the Azure Table storage resource to track an Azure Table storage dependency");
- Guard.NotNullOrWhitespace(tableName, nameof(tableName), "Requires a non-blank table name in the Azure Table storage resource to track an Azure Table storage dependency");
- Guard.NotNull(measurement, nameof(measurement), "Requires a dependency measurement instance to track the latency of the Azure Table storage when tracking an Azure Table storage dependency");
-
- LogTableStorageDependency(logger, accountName, tableName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
- }
-
///
/// Logs an Azure Table Storage Dependency.
///
diff --git a/src/Arcus.Observability.Tests.Integration/Serilog/TelemetryTypeFilterTests.cs b/src/Arcus.Observability.Tests.Integration/Serilog/TelemetryTypeFilterTests.cs
index ef14f7fb..4f09f6fc 100644
--- a/src/Arcus.Observability.Tests.Integration/Serilog/TelemetryTypeFilterTests.cs
+++ b/src/Arcus.Observability.Tests.Integration/Serilog/TelemetryTypeFilterTests.cs
@@ -495,10 +495,12 @@ public void LogSqlDependency_WithTelemetryTypeFilterOnDifferentTelemetryType_Doe
public void LogServiceBusTopicDependency_WithTelemetryTypeFilter_IgnoresDependency()
{
// Arrange
+ string serviceBusNamespace = _bogusGenerator.Lorem.Sentence();
string topicName = _bogusGenerator.Commerce.Product();
bool isSuccessful = _bogusGenerator.PickRandom(true, false);
TimeSpan duration = _bogusGenerator.Date.Timespan();
DateTimeOffset startTime = DateTimeOffset.UtcNow;
+ string dependencyId = _bogusGenerator.Random.Guid().ToString();
string propertyName = _bogusGenerator.Random.Word();
string propertyValue = _bogusGenerator.Random.Word();
var properties = new Dictionary { [propertyName] = propertyValue };
@@ -514,7 +516,7 @@ public void LogServiceBusTopicDependency_WithTelemetryTypeFilter_IgnoresDependen
ILogger logger = factory.CreateLogger();
// Act
- logger.LogServiceBusTopicDependency(topicName, isSuccessful, startTime, duration, properties);
+ logger.LogServiceBusTopicDependency(serviceBusNamespace, topicName, isSuccessful, startTime, duration, dependencyId, properties);
// Assert
Assert.Empty(spySink.CurrentLogEmits);
@@ -526,10 +528,12 @@ public void LogServiceBusTopicDependency_WithTelemetryTypeFilter_IgnoresDependen
public void LogServiceBusTopicDependency_WithTelemetryTypeFilterOnDifferentTelemetryType_DoesNotFilterOutEntry(TelemetryType telemetryType)
{
// Arrange
+ string serviceBusNamespace = _bogusGenerator.Lorem.Sentence();
string topicName = _bogusGenerator.Commerce.Product();
bool isSuccessful = _bogusGenerator.PickRandom(true, false);
TimeSpan duration = _bogusGenerator.Date.Timespan();
DateTimeOffset startTime = DateTimeOffset.UtcNow;
+ string dependencyId = _bogusGenerator.Random.Guid().ToString();
string propertyName = _bogusGenerator.Random.Word();
string propertyValue = _bogusGenerator.Random.Word();
var properties = new Dictionary { [propertyName] = propertyValue };
@@ -545,7 +549,7 @@ public void LogServiceBusTopicDependency_WithTelemetryTypeFilterOnDifferentTelem
ILogger logger = factory.CreateLogger();
// Act
- logger.LogServiceBusTopicDependency(topicName, isSuccessful, startTime, duration, properties);
+ logger.LogServiceBusTopicDependency(serviceBusNamespace, topicName, isSuccessful, startTime, duration, dependencyId, properties);
// Assert
LogEvent logEvent = Assert.Single(spySink.CurrentLogEmits);
@@ -566,10 +570,12 @@ public void LogServiceBusTopicDependency_WithTelemetryTypeFilterOnDifferentTelem
public void LogServiceBusQueueDependency_WithTelemetryTypeFilter_IgnoresDependency()
{
// Arrange
+ string serviceBusNamespace = _bogusGenerator.Lorem.Sentence();
string queueName = _bogusGenerator.Commerce.Product();
bool isSuccessful = _bogusGenerator.PickRandom(true, false);
TimeSpan duration = _bogusGenerator.Date.Timespan();
DateTimeOffset startTime = DateTimeOffset.UtcNow;
+ string dependencyId = _bogusGenerator.Random.Guid().ToString();
string propertyName = _bogusGenerator.Random.Word();
string propertyValue = _bogusGenerator.Random.Word();
var properties = new Dictionary { [propertyName] = propertyValue };
@@ -585,7 +591,7 @@ public void LogServiceBusQueueDependency_WithTelemetryTypeFilter_IgnoresDependen
ILogger logger = factory.CreateLogger();
// Act
- logger.LogServiceBusQueueDependency(queueName, isSuccessful, startTime, duration, properties);
+ logger.LogServiceBusQueueDependency(serviceBusNamespace, queueName, isSuccessful, startTime, duration, dependencyId, properties);
// Assert
Assert.Empty(spySink.CurrentLogEmits);
@@ -597,10 +603,12 @@ public void LogServiceBusQueueDependency_WithTelemetryTypeFilter_IgnoresDependen
public void LogServiceBusQueueDependency_WithTelemetryTypeFilterOnDifferentTelemetryType_DoesNotFilterOutEntry(TelemetryType telemetryType)
{
// Arrange
+ string serviceBusNamespace = _bogusGenerator.Lorem.Sentence();
string queueName = _bogusGenerator.Commerce.Product();
bool isSuccessful = _bogusGenerator.PickRandom(true, false);
TimeSpan duration = _bogusGenerator.Date.Timespan();
DateTimeOffset startTime = DateTimeOffset.UtcNow;
+ string dependencyId = _bogusGenerator.Random.Guid().ToString();
string propertyName = _bogusGenerator.Random.Word();
string propertyValue = _bogusGenerator.Random.Word();
var properties = new Dictionary { [propertyName] = propertyValue };
@@ -616,7 +624,7 @@ public void LogServiceBusQueueDependency_WithTelemetryTypeFilterOnDifferentTelem
ILogger logger = factory.CreateLogger();
// Act
- logger.LogServiceBusQueueDependency(queueName, isSuccessful, startTime, duration, properties);
+ logger.LogServiceBusQueueDependency(serviceBusNamespace, queueName, isSuccessful, startTime, duration, dependencyId, properties);
// Assert
LogEvent logEvent = Assert.Single(spySink.CurrentLogEmits);
diff --git a/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs b/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
index 22f99f6e..a43a4415 100644
--- a/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
@@ -91,124 +91,6 @@ private static string SerializeXml(Order order)
}
[Fact]
- public void LogServiceBusDependency_WithServiceBusDependency_CreatesDependencyTelemetry()
- {
- // Arrange
- var spySink = new InMemoryLogSink();
- string operationId = $"operation-id-{Guid.NewGuid()}";
- ILogger logger = CreateLogger(spySink, config => config.Enrich.WithProperty(ContextProperties.Correlation.OperationId, operationId));
- string entityName = $"entity-name-{Guid.NewGuid()}";
- const ServiceBusEntityType entityType = ServiceBusEntityType.Unknown;
- var startTime = DateTimeOffset.UtcNow;
- var duration = TimeSpan.FromSeconds(5);
- var telemetryContext = new Dictionary
- {
- ["Namespace"] = "azure.servicebus.namespace"
- };
- logger.LogServiceBusDependency(entityName, entityType: entityType, isSuccessful: true, startTime: startTime, duration: duration, context: telemetryContext);
- LogEvent logEvent = Assert.Single(spySink.CurrentLogEmits);
- Assert.NotNull(logEvent);
-
- var converter = ApplicationInsightsTelemetryConverter.Create();
-
- // Act
- IEnumerable telemetries = converter.Convert(logEvent, formatProvider: null);
-
- // Assert
- AssertDoesContainLogProperty(logEvent, DependencyTracking.DependencyLogEntry);
- Assert.Collection(telemetries, telemetry =>
- {
- var dependencyTelemetry = Assert.IsType(telemetry);
- Assert.Equal("Azure Service Bus", dependencyTelemetry.Type);
- Assert.Equal(entityName, dependencyTelemetry.Target);
- Assert.Equal(startTime, dependencyTelemetry.Timestamp);
- Assert.Equal(duration, dependencyTelemetry.Duration);
- Assert.True(dependencyTelemetry.Success);
-
- AssertContainsTelemetryProperty(dependencyTelemetry, "Namespace", "azure.servicebus.namespace");
- AssertContainsTelemetryProperty(dependencyTelemetry, DependencyTracking.ServiceBus.EntityType, entityType.ToString());
- });
- }
-
- [Fact]
- public void LogServiceBusQueueDependency_WithServiceBusDependency_CreatesDependencyTelemetry()
- {
- // Arrange
- var spySink = new InMemoryLogSink();
- string operationId = $"operation-id-{Guid.NewGuid()}";
- ILogger logger = CreateLogger(spySink, config => config.Enrich.WithProperty(ContextProperties.Correlation.OperationId, operationId));
- string queueName = $"queue-name-{Guid.NewGuid()}";
- var startTime = DateTimeOffset.UtcNow;
- var duration = TimeSpan.FromSeconds(5);
- var telemetryContext = new Dictionary
- {
- ["Namespace"] = "azure.servicebus.namespace"
- };
- logger.LogServiceBusQueueDependency(queueName, isSuccessful: true, startTime: startTime, duration: duration, context: telemetryContext);
- LogEvent logEvent = Assert.Single(spySink.CurrentLogEmits);
- Assert.NotNull(logEvent);
-
- var converter = ApplicationInsightsTelemetryConverter.Create();
-
- // Act
- IEnumerable telemetries = converter.Convert(logEvent, formatProvider: null);
-
- // Assert
- AssertDoesContainLogProperty(logEvent, DependencyTracking.DependencyLogEntry);
- Assert.Collection(telemetries, telemetry =>
- {
- var dependencyTelemetry = Assert.IsType(telemetry);
- Assert.Equal("Azure Service Bus", dependencyTelemetry.Type);
- Assert.Equal(queueName, dependencyTelemetry.Target);
- Assert.Equal(startTime, dependencyTelemetry.Timestamp);
- Assert.Equal(duration, dependencyTelemetry.Duration);
- Assert.True(dependencyTelemetry.Success);
-
- AssertContainsTelemetryProperty(dependencyTelemetry, "Namespace", "azure.servicebus.namespace");
- AssertContainsTelemetryProperty(dependencyTelemetry, DependencyTracking.ServiceBus.EntityType, ServiceBusEntityType.Queue.ToString());
- });
- }
-
- [Fact]
- public void LogServiceBusTopicDependency_WithServiceBusDependency_CreatesDependencyTelemetry()
- {
- // Arrange
- var spySink = new InMemoryLogSink();
- string operationId = $"operation-id-{Guid.NewGuid()}";
- ILogger logger = CreateLogger(spySink, config => config.Enrich.WithProperty(ContextProperties.Correlation.OperationId, operationId));
- string topicName = $"topic-name-{Guid.NewGuid()}";
- var startTime = DateTimeOffset.UtcNow;
- var duration = TimeSpan.FromSeconds(5);
- var telemetryContext = new Dictionary
- {
- ["Namespace"] = "azure.servicebus.namespace"
- };
- logger.LogServiceBusTopicDependency(topicName, isSuccessful: true, startTime: startTime, duration: duration, context: telemetryContext);
- LogEvent logEvent = Assert.Single(spySink.CurrentLogEmits);
- Assert.NotNull(logEvent);
-
- var converter = ApplicationInsightsTelemetryConverter.Create();
-
- // Act
- IEnumerable telemetries = converter.Convert(logEvent, formatProvider: null);
-
- // Assert
- AssertDoesContainLogProperty(logEvent, DependencyTracking.DependencyLogEntry);
- Assert.Collection(telemetries, telemetry =>
- {
- var dependencyTelemetry = Assert.IsType(telemetry);
- Assert.Equal("Azure Service Bus", dependencyTelemetry.Type);
- Assert.Equal(topicName, dependencyTelemetry.Target);
- Assert.Equal(startTime, dependencyTelemetry.Timestamp);
- Assert.Equal(duration, dependencyTelemetry.Duration);
- Assert.True(dependencyTelemetry.Success);
-
- AssertContainsTelemetryProperty(dependencyTelemetry, "Namespace", "azure.servicebus.namespace");
- AssertContainsTelemetryProperty(dependencyTelemetry, DependencyTracking.ServiceBus.EntityType, ServiceBusEntityType.Topic.ToString());
- });
- }
-
- [Fact]
public void LogServiceBusDependencyWithNamespace_WithServiceBusDependency_CreatesDependencyTelemetry()
{
// Arrange
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureBlobStorageDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureBlobStorageDependencyLoggingTests.cs
index c457f19c..50a5ec46 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureBlobStorageDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureBlobStorageDependencyLoggingTests.cs
@@ -98,35 +98,6 @@ public void LogBlobStorageDependencyWithDependencyId_WithNegativeDuration_Fails(
Assert.ThrowsAny(() => logger.LogBlobStorageDependency(accountName, containerName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogBlobStorageDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string containerName = _bogusGenerator.Commerce.ProductName();
- string accountName = _bogusGenerator.Finance.AccountName();
- bool isSuccessful = _bogusGenerator.Random.Bool();
-
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogBlobStorageDependency(accountName, containerName, isSuccessful, measurement);
-
- // Assert
- var logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(containerName, logMessage);
- Assert.Contains(accountName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = $"{accountName}/{containerName}";
- Assert.Contains("Azure blob " + dependencyName, logMessage);
- }
-
[Fact]
public void LogBlobStorageDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureKeyVaultDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureKeyVaultDependencyLoggingTests.cs
index 0ff2b6fb..3db07ab8 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureKeyVaultDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureKeyVaultDependencyLoggingTests.cs
@@ -134,54 +134,6 @@ public void LogAzureKeyVaultDependency_WithNegativeDuration_Fails()
() => logger.LogAzureKeyVaultDependency("https://my-vault.vault.azure.net", "MySecret", isSuccessful: true, startTime: DateTimeOffset.UtcNow, duration: duration));
}
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogAzureKeyVaultDependencyDependencyMeasurement_WithIdWithoutVaultUri_Fails(string vaultUri)
- {
- // Arrange
- var logger = new TestLogger();
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogAzureKeyVaultDependency(vaultUri, "MySecret", isSuccessful: true, measurement: DependencyMeasurement.Start(), "dependency ID"));
- }
-
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogAzureKeyVaultDependency_WithIdWithoutSecretNameDependencyMeasurement_Fails(string secretName)
- {
- // Arrange
- var logger = new TestLogger();
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogAzureKeyVaultDependency("https://my-vault.vault.azure.net", secretName, isSuccessful: true, measurement: DependencyMeasurement.Start(), "dependency ID"));
- }
-
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogAzureKeyVaultDependencyDependencyMeasurement_WithoutVaultUri_Fails(string vaultUri)
- {
- // Arrange
- var logger = new TestLogger();
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogAzureKeyVaultDependency(vaultUri, "MySecret", isSuccessful: true, measurement: DependencyMeasurement.Start()));
- }
-
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogAzureKeyVaultDependency_WithoutSecretNameDependencyMeasurement_Fails(string secretName)
- {
- // Arrange
- var logger = new TestLogger();
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogAzureKeyVaultDependency("https://my-vault.vault.azure.net", secretName, isSuccessful: true, measurement: DependencyMeasurement.Start()));
- }
-
[Theory]
[ClassData(typeof(Blanks))]
public void LogAzureKeyVaultDependencyDurationMeasurement_WithIdWithoutVaultUri_Fails(string vaultUri)
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureSearchDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureSearchDependencyLoggingTests.cs
index ddad04be..fea10e4f 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureSearchDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureSearchDependencyLoggingTests.cs
@@ -131,34 +131,6 @@ public void LogAzureSearchDependencyWithDependencyId_WithNegativeDuration_Fails(
Assert.ThrowsAny(() => logger.LogAzureSearchDependency(searchServiceName, operationName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogAzureSearchDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string searchServiceName = _bogusGenerator.Commerce.Product();
- string operationName = _bogusGenerator.Commerce.ProductName();
- bool isSuccessful = _bogusGenerator.PickRandom(true, false);
- DependencyMeasurement measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogAzureSearchDependency(searchServiceName, operationName, isSuccessful, measurement);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(searchServiceName, logMessage);
- Assert.Contains(operationName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = searchServiceName;
- Assert.Contains("Azure Search " + dependencyName, logMessage);
- }
-
[Fact]
public void LogAzureSearchDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureServiceBusDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureServiceBusDependencyLoggingTests.cs
index 1ca79af7..5be4e7f5 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureServiceBusDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureServiceBusDependencyLoggingTests.cs
@@ -14,32 +14,6 @@ public class AzureServiceBusDependencyLoggingTests
{
private static readonly Faker BogusGenerator = new Faker();
- [Fact]
- public void LogServiceBusDependency_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- const ServiceBusEntityType entityType = ServiceBusEntityType.Queue;
- string entityName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = BogusGenerator.Date.Timespan();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act
- logger.LogServiceBusDependency(entityName, isSuccessful, startTime, duration, entityType);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(entityType.ToString(), logMessage);
- Assert.Contains(entityName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- string dependencyName = entityName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
[Fact]
public void LogServiceBusDependencyWithDependencyId_ValidArguments_Succeeds()
{
@@ -68,21 +42,6 @@ public void LogServiceBusDependencyWithDependencyId_ValidArguments_Succeeds()
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Fact]
- public void LogServiceBusDependency_WithNegativeDuration_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- const ServiceBusEntityType entityType = ServiceBusEntityType.Queue;
- string entityName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = TimeSpanGenerator.GeneratePositiveDuration().Negate();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act / Assert
- Assert.ThrowsAny(() => logger.LogServiceBusDependency(entityName, isSuccessful, startTime, duration, entityType));
- }
-
[Fact]
public void LogServiceBusDependencyWithDependencyId_WithNegativeDuration_Fails()
{
@@ -100,61 +59,6 @@ public void LogServiceBusDependencyWithDependencyId_WithNegativeDuration_Fails()
Assert.ThrowsAny(() => logger.LogServiceBusDependency(namespaceEndpoint, entityName, isSuccessful, startTime, duration, dependencyId, entityType));
}
- [Fact]
- public void LogServiceBusDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- const ServiceBusEntityType entityType = ServiceBusEntityType.Topic;
- string entityName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusDependency(entityName, isSuccessful, measurement, entityType);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(entityType.ToString(), logMessage);
- Assert.Contains(entityName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- string dependencyName = entityName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
- [Fact]
- public void LogServiceBusDependencyWithDurationMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- var entityType = BogusGenerator.Random.Enum();
- string entityName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusDependency(entityName, isSuccessful, measurement, entityType);
-
- // Assert
- DependencyLogEntry dependency = logger.GetMessageAsDependency();
- Assert.Equal(entityName, dependency.TargetName);
- Assert.Equal("Azure Service Bus", dependency.DependencyType);
- Assert.Equal(entityName, dependency.DependencyName);
- Assert.Equal(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), dependency.StartTime);
- Assert.Equal(duration, dependency.Duration);
- Assert.Equal(isSuccessful, dependency.IsSuccessful);
- Assert.Equal(entityType.ToString(), Assert.Contains(ServiceBus.EntityType, dependency.Context));
- }
-
[Fact]
public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_ValidArguments_Succeeds()
{
@@ -186,22 +90,6 @@ public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_Valid
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogServiceBusDependencyWithDurationMeasurement_WithoutEntityName_Fails(string entityName)
- {
- // Arrange
- var logger = new TestLogger();
- var entityType = BogusGenerator.Random.Enum();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- measurement.Dispose();
-
- // Act
- Assert.ThrowsAny(
- () => logger.LogServiceBusDependency(entityName, isSuccessful, measurement, entityType));
- }
-
[Theory]
[ClassData(typeof(Blanks))]
public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_WithoutNamespaceEndpoint_Fails(string namespaceEndpoint)
@@ -238,22 +126,6 @@ public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_Witho
() => logger.LogServiceBusDependency(namespaceEndpoint, entityName, isSuccessful, measurement, dependencyId, entityType));
}
- [Fact]
- public void LogServiceBusDependencyWithDurationMeasurement_WithoutMeasurement_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- string entityName = BogusGenerator.Commerce.Product();
- var entityType = BogusGenerator.Random.Enum();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- measurement.Dispose();
-
- // Act
- Assert.ThrowsAny(
- () => logger.LogServiceBusDependency(entityName, isSuccessful, measurement: (DurationMeasurement)null, entityType));
- }
-
[Fact]
public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_WithoutMeasurement_Fails()
{
@@ -272,31 +144,6 @@ public void LogServiceBusDependencyWithDependencyIdWithDurationMeasurement_Witho
() => logger.LogServiceBusDependency(namespaceEndpoint, entityName, isSuccessful, measurement: (DurationMeasurement)null, dependencyId, entityType));
}
- [Fact]
- public void LogServiceBusQueueDependency_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string queueName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = BogusGenerator.Date.Timespan();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act
- logger.LogServiceBusQueueDependency(queueName, isSuccessful, startTime, duration);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(ServiceBusEntityType.Queue.ToString(), logMessage);
- Assert.Contains(queueName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- string dependencyName = queueName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
[Fact]
public void LogServiceBusQueueDependencyWithDependencyId_ValidArguments_Succeeds()
{
@@ -325,20 +172,6 @@ public void LogServiceBusQueueDependencyWithDependencyId_ValidArguments_Succeeds
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Fact]
- public void LogServiceBusQueueDependency_WithNegativeDuration_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- string queueName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = TimeSpanGenerator.GeneratePositiveDuration().Negate();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act / Assert
- Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(queueName, isSuccessful, startTime, duration));
- }
-
[Fact]
public void LogServiceBusQueueDependencyWithDependencyId_WithNegativeDuration_Fails()
{
@@ -355,59 +188,6 @@ public void LogServiceBusQueueDependencyWithDependencyId_WithNegativeDuration_Fa
Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(namespaceEndpoint, queueName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogServiceBusQueueDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string queueName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusQueueDependency(queueName, isSuccessful, measurement);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(ServiceBusEntityType.Queue.ToString(), logMessage);
- Assert.Contains(queueName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- string dependencyName = queueName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
- [Fact]
- public void LogServiceBusQueueDependencyWithDurationMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string queueName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusQueueDependency(queueName, isSuccessful, measurement);
-
- // Assert
- DependencyLogEntry dependency = logger.GetMessageAsDependency();
- Assert.Equal(queueName, dependency.TargetName);
- Assert.Equal("Azure Service Bus", dependency.DependencyType);
- Assert.Equal(queueName, dependency.DependencyName);
- Assert.Equal(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), dependency.StartTime);
- Assert.Equal(duration, dependency.Duration);
- Assert.Equal(isSuccessful, dependency.IsSuccessful);
- Assert.Equal(ServiceBusEntityType.Queue.ToString(), Assert.Contains(ServiceBus.EntityType, dependency.Context));
- }
-
[Fact]
public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_ValidArguments_Succeeds()
{
@@ -438,20 +218,6 @@ public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogServiceBusQueueDependencyWithDurationMeasurement_WithoutQueueName_Fails(string queueName)
- {
- // Arrange
- var logger = new TestLogger();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- measurement.Dispose();
-
- // Act
- Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(queueName, isSuccessful, measurement));
- }
-
[Theory]
[ClassData(typeof(Blanks))]
public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_WithoutNamespaceEndpoint_Fails(string namespaceEndpoint)
@@ -484,18 +250,6 @@ public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_
Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(namespaceEndpoint, queueName, isSuccessful, measurement, dependencyId));
}
- [Fact]
- public void LogServiceBusQueueDependencyWithDurationMeasurement_WithoutMeasurement_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- string queueName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
-
- // Act
- Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(queueName, isSuccessful, measurement: (DurationMeasurement)null));
- }
-
[Fact]
public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_WithoutMeasurement_Fails()
{
@@ -510,31 +264,6 @@ public void LogServiceBusQueueDependencyWithDependencyIdWithDurationMeasurement_
Assert.ThrowsAny(() => logger.LogServiceBusQueueDependency(namespaceEndpoint, queueName, isSuccessful, measurement: (DurationMeasurement)null, dependencyId));
}
- [Fact]
- public void LogServiceBusTopicDependency_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string topicName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = BogusGenerator.Date.Timespan();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act
- logger.LogServiceBusTopicDependency(topicName, isSuccessful, startTime, duration);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(ServiceBusEntityType.Topic.ToString(), logMessage);
- Assert.Contains(topicName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- string dependencyName = topicName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
[Fact]
public void LogServiceBusTopicDependencyWithDependencyId_ValidArguments_Succeeds()
{
@@ -563,21 +292,6 @@ public void LogServiceBusTopicDependencyWithDependencyId_ValidArguments_Succeeds
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogServiceBusTopicDependency_WithoutTopicName_Fails(string topicName)
- {
- // Arrange
- var logger = new TestLogger();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = BogusGenerator.Date.Timespan();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogServiceBusTopicDependency(topicName, isSuccessful, startTime, duration));
- }
-
[Theory]
[ClassData(typeof(Blanks))]
public void LogServiceBusTopicDependencyWithDependencyId_WithoutNamespaceEndpoint_Fails(string namespaceEndpoint)
@@ -612,20 +326,6 @@ public void LogServiceBusTopicDependencyWithDependencyId_WithoutTopicName_Fails(
() => logger.LogServiceBusTopicDependency(namespaceEndpoint, topicName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogServiceBusTopicDependency_WithNegativeDuration_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- string topicName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- TimeSpan duration = TimeSpanGenerator.GeneratePositiveDuration().Negate();
- var startTime = DateTimeOffset.UtcNow;
-
- // Act
- Assert.ThrowsAny(() => logger.LogServiceBusTopicDependency(topicName, isSuccessful, startTime, duration));
- }
-
[Fact]
public void LogServiceBusTopicDependencyWithDependencyId_WithNegativeDuration_Fails()
{
@@ -643,59 +343,6 @@ public void LogServiceBusTopicDependencyWithDependencyId_WithNegativeDuration_Fa
() => logger.LogServiceBusTopicDependency(namespaceEndpoint, topicName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogServiceBusTopicDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string topicName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusTopicDependency(topicName, isSuccessful, measurement);
-
- // Assert
- string logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(ServiceBusEntityType.Topic.ToString(), logMessage);
- Assert.Contains(topicName, logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- var dependencyName = topicName;
- Assert.Contains("Azure Service Bus " + dependencyName, logMessage);
- }
-
- [Fact]
- public void LogServiceBusTopicDependencyWithDurationMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string topicName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogServiceBusTopicDependency(topicName, isSuccessful, measurement);
-
- // Assert
- DependencyLogEntry dependency = logger.GetMessageAsDependency();
- Assert.Equal(topicName, dependency.TargetName);
- Assert.Equal("Azure Service Bus", dependency.DependencyType);
- Assert.Equal(topicName, dependency.DependencyName);
- Assert.Equal(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), dependency.StartTime);
- Assert.Equal(duration, dependency.Duration);
- Assert.Equal(isSuccessful, dependency.IsSuccessful);
- Assert.Equal(ServiceBusEntityType.Topic.ToString(), Assert.Contains(ServiceBus.EntityType, dependency.Context));
- }
-
[Fact]
public void LogServiceBusTopicDependencyWithDependencyIdWithDurationMeasurement_ValidArguments_Succeeds()
{
@@ -726,34 +373,6 @@ public void LogServiceBusTopicDependencyWithDependencyIdWithDurationMeasurement_
Assert.Equal(namespaceEndpoint, Assert.Contains(ServiceBus.Endpoint, dependency.Context));
}
- [Theory]
- [ClassData(typeof(Blanks))]
- public void LogServiceBusTopicDependencyWithDurationMeasurement_WithoutTopicName_Fails(string topicName)
- {
- // Arrange
- var logger = new TestLogger();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
- var measurement = DurationMeasurement.Start();
- measurement.Dispose();
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogServiceBusTopicDependency(topicName, isSuccessful, measurement));
- }
-
- [Fact]
- public void LogServiceBusTopicDependencyWithDurationMeasurement_WithoutMeasurement_Fails()
- {
- // Arrange
- var logger = new TestLogger();
- string topicName = BogusGenerator.Commerce.Product();
- bool isSuccessful = BogusGenerator.PickRandom(true, false);
-
- // Act / Assert
- Assert.ThrowsAny(
- () => logger.LogServiceBusTopicDependency(topicName, isSuccessful, measurement: (DurationMeasurement) null));
- }
-
[Theory]
[ClassData(typeof(Blanks))]
public void LogServiceBusTopicDependencyWithDependencyIdWithDurationMeasurement_WithoutNamespaceEndpoint_Fails(string namespaceEndpoint)
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureTableStorageDependencyTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureTableStorageDependencyTests.cs
index 3a97d10a..d25bb280 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureTableStorageDependencyTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/AzureTableStorageDependencyTests.cs
@@ -98,35 +98,6 @@ public void LogTableStorageDependencyWithDependencyId_WithNegativeDuration_Fails
Assert.ThrowsAny(() => logger.LogTableStorageDependency(accountName, tableName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogTableStorageDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string tableName = _bogusGenerator.Commerce.ProductName();
- string accountName = _bogusGenerator.Finance.AccountName();
- bool isSuccessful = _bogusGenerator.Random.Bool();
-
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogTableStorageDependency(accountName, tableName, isSuccessful, measurement);
-
- // Assert
- var logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(tableName, logMessage);
- Assert.Contains(accountName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = $"{accountName}/{tableName}";
- Assert.Contains("Azure table " + dependencyName, logMessage);
- }
-
[Fact]
public void LogTableStorageDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/CosmosSqlDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/CosmosSqlDependencyLoggingTests.cs
index e3dae30f..5c8df5ba 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/CosmosSqlDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/CosmosSqlDependencyLoggingTests.cs
@@ -106,37 +106,6 @@ public void LogCosmosSqlDependencyWithDependencyId_WithNegativeDuration_Fails()
Assert.ThrowsAny(() => logger.LogCosmosSqlDependency(accountName, database, container, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogCosmosSqlDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string container = BogusGenerator.Commerce.ProductName();
- string database = BogusGenerator.Commerce.ProductName();
- string accountName = BogusGenerator.Finance.AccountName();
- bool isSuccessful = BogusGenerator.Random.Bool();
-
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogCosmosSqlDependency(accountName, database, container, isSuccessful, measurement);
-
- // Assert
- var logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(container, logMessage);
- Assert.Contains(database, logMessage);
- Assert.Contains(accountName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = $"{database}/{container}";
- Assert.Contains("Azure DocumentDB " + dependencyName, logMessage);
- }
-
[Fact]
public void LogCosmosSqlDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/EventHubsDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/EventHubsDependencyLoggingTests.cs
index d812c76c..97199d4e 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/EventHubsDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/EventHubsDependencyLoggingTests.cs
@@ -170,35 +170,6 @@ public void LogEventHubsDependencyWithDependencyId_WithNegativeDuration_Fails()
Assert.ThrowsAny(() => logger.LogEventHubsDependency(namespaceName, eventHubName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogEventHubsDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string eventHubName = BogusGenerator.Commerce.ProductName();
- string namespaceName = BogusGenerator.Finance.AccountName();
- bool isSuccessful = BogusGenerator.Random.Bool();
-
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogEventHubsDependency(namespaceName, eventHubName, isSuccessful, measurement);
-
- // Assert
- var logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(namespaceName, logMessage);
- Assert.Contains(eventHubName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = eventHubName;
- Assert.Contains("Azure Event Hubs " + dependencyName, logMessage);
- }
-
[Fact]
public void LogEventHubsDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
diff --git a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/IoTHubDependencyLoggingTests.cs b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/IoTHubDependencyLoggingTests.cs
index 64a9cf8d..6b234196 100644
--- a/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/IoTHubDependencyLoggingTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Telemetry/Logging/IoTHubDependencyLoggingTests.cs
@@ -130,34 +130,6 @@ public void LogIoTHubDependencyWithDependencyId_WithNegativeDuration_Fails()
Assert.ThrowsAny(() => logger.LogIotHubDependency(iotHubName: iotHubName, isSuccessful, startTime, duration, dependencyId));
}
- [Fact]
- public void LogIotHubDependencyWithDependencyMeasurement_ValidArguments_Succeeds()
- {
- // Arrange
- var logger = new TestLogger();
- string iotHubName = BogusGenerator.Commerce.ProductName();
- bool isSuccessful = BogusGenerator.Random.Bool();
-
- var measurement = DependencyMeasurement.Start();
- DateTimeOffset startTime = measurement.StartTime;
- measurement.Dispose();
- TimeSpan duration = measurement.Elapsed;
-
- // Act
- logger.LogIotHubDependency(iotHubName: iotHubName, isSuccessful: isSuccessful, measurement: measurement);
-
- // Assert
- var logMessage = logger.WrittenMessage;
- Assert.Contains(TelemetryType.Dependency.ToString(), logMessage);
- Assert.Contains(iotHubName, logMessage);
- Assert.Contains(iotHubName, logMessage);
- Assert.Contains(isSuccessful.ToString(), logMessage);
- Assert.Contains(startTime.ToString(FormatSpecifiers.InvariantTimestampFormat), logMessage);
- Assert.Contains(duration.ToString(), logMessage);
- string dependencyName = iotHubName;
- Assert.Contains("Azure IoT Hub " + dependencyName, logMessage);
- }
-
[Fact]
public void LogIotHubDependencyWithDurationMeasurement_ValidArguments_Succeeds()
{
From bc92831e453e39aac3b5245c19b373bcb4370bcd Mon Sep 17 00:00:00 2001
From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:21:47 +0100
Subject: [PATCH 2/2] pr-follow-up: telemetry filter tests
---
.../Serilog/ApplicationInsightsTelemetryConverterTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs b/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
index a43a4415..fe7a862c 100644
--- a/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
+++ b/src/Arcus.Observability.Tests.Unit/Serilog/ApplicationInsightsTelemetryConverterTests.cs
@@ -91,7 +91,7 @@ private static string SerializeXml(Order order)
}
[Fact]
- public void LogServiceBusDependencyWithNamespace_WithServiceBusDependency_CreatesDependencyTelemetry()
+ public void LogServiceBusDependencyWithNamespace_WithServiceBusDependency_CreatesDependencyTelemetry()
{
// Arrange
var spySink = new InMemoryLogSink();