Skip to content

Commit

Permalink
chore: remove obsolete az dependency telemetry (#551)
Browse files Browse the repository at this point in the history
* chore: remove obsolete az dependency telemetry

* pr-follow-up: telemetry filter tests
  • Loading branch information
stijnmoreels authored Nov 16, 2023
1 parent 7d40eee commit 6886358
Show file tree
Hide file tree
Showing 18 changed files with 13 additions and 1,211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs an Azure Key Vault dependency.
/// </summary>
/// <param name="logger">The logger to use.</param>
/// <param name="vaultUri">The URI pointing to the Azure Key Vault resource.</param>
/// <param name="secretName">The secret that is being used within the Azure Key Vault resource.</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="vaultUri"/> or <paramref name="secretName"/> is blank.</exception>
/// <exception cref="FormatException">Thrown when the <paramref name="secretName"/> is not in the correct format.</exception>
/// <exception cref="UriFormatException">Thrown when the <paramref name="vaultUri"/> is not in the correct format.</exception>
[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<string, object> 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<string, object>();
LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement, dependencyId: null, context);
}

/// <summary>
/// Logs an Azure Key Vault dependency.
/// </summary>
Expand Down Expand Up @@ -73,39 +42,6 @@ public static void LogAzureKeyVaultDependency(
LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement, dependencyId: null, context);
}

/// <summary>
/// Logs an Azure Key Vault dependency.
/// </summary>
/// <param name="logger">The logger to use.</param>
/// <param name="vaultUri">The URI pointing to the Azure Key Vault resource.</param>
/// <param name="secretName">The secret that is being used within the Azure Key Vault resource.</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="dependencyId">The ID of the dependency to link as parent ID.</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="vaultUri"/> or <paramref name="secretName"/> is blank.</exception>
/// <exception cref="FormatException">Thrown when the <paramref name="secretName"/> is not in the correct format.</exception>
/// <exception cref="UriFormatException">Thrown when the <paramref name="vaultUri"/> is not in the correct format.</exception>
[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<string, object> 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<string, object>();
LogAzureKeyVaultDependency(logger, vaultUri, secretName, isSuccessful, measurement.StartTime, measurement.Elapsed, dependencyId, context);
}

/// <summary>
/// Logs an Azure Key Vault dependency.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs an Azure Search Dependency.
/// </summary>
/// <param name="logger">The logger to track the telemetry.</param>
/// <param name="searchServiceName">Name of the Azure Search service</param>
/// <param name="operationName">Name of the operation to execute on the Azure Search service</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="searchServiceName"/> or <paramref name="operationName"/> is blank.</exception>
[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<string, object> 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<string, object>();

LogAzureSearchDependency(logger, searchServiceName, operationName, isSuccessful, measurement.StartTime, measurement.Elapsed, context);
}

/// <summary>
/// Logs an Azure Search Dependency.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs an Azure Blob Storage Dependency.
/// </summary>
/// <param name="logger">The logger to track the telemetry.</param>
/// <param name="accountName">Account of the storage resource</param>
/// <param name="containerName">Name of the Blob Container resource</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="accountName"/> or <paramref name="containerName"/> is blank.</exception>
[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<string, object> 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);
}

/// <summary>
/// Logs an Azure Blob Storage Dependency.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs a Cosmos SQL dependency.
/// </summary>
/// <param name="logger">The logger to track the telemetry.</param>
/// <param name="accountName">Name of the storage resource</param>
/// <param name="database">Name of the database</param>
/// <param name="container">Name of the container</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency of the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="accountName"/>, <paramref name="database"/>, or <paramref name="container"/> is blank.</exception>
[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<string, object> 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);
}

/// <summary>
/// Logs a Cosmos SQL dependency.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs an Azure Event Hub Dependency.
/// </summary>
/// <param name="logger">The logger to track the telemetry.</param>
/// <param name="namespaceName">Namespace of the resource</param>
/// <param name="eventHubName">Name of the Event Hub resource</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="namespaceName"/> or <paramref name="eventHubName"/> is blank.</exception>
[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<string, object> 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);
}

/// <summary>
/// Logs an Azure Event Hub Dependency.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,6 @@ namespace Microsoft.Extensions.Logging
// ReSharper disable once InconsistentNaming
public static partial class ILoggerExtensions
{
/// <summary>
/// Logs an Azure Iot Hub Dependency.
/// </summary>
/// <param name="logger">The logger to track the telemetry.</param>
/// <param name="iotHubName">Name of the IoT Hub resource</param>
/// <param name="isSuccessful">Indication whether or not the operation was successful</param>
/// <param name="measurement">Measuring the latency to call the dependency</param>
/// <param name="context">Context that provides more insights on the dependency that was measured</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="logger"/> or <paramref name="measurement"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="iotHubName"/> is blank.</exception>
[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<string, object> 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);
}

/// <summary>
/// Logs an Azure Iot Hub Dependency.
/// </summary>
Expand Down
Loading

0 comments on commit 6886358

Please sign in to comment.