/// <summary> /// This method writes the event data to the underlying storage. /// </summary> /// <param name="connector">The generic connector.</param> /// <param name="e">The event to write.</param> /// <returns>This is an async process.</returns> protected virtual async Task WriteConnector(IAzureStorageConnectorBase connector, EventHolder e) { int start = StatisticsInternal.ActiveIncrement(connector.Support); Guid?traceId = connector.Options.ShouldProfile ? (ProfileStart($"Azure{connector.Support}_{e.Data.TraceId}")) : default(Guid?); var result = ResourceRequestResult.Unknown; try { await connector.Write(e, OriginatorId); result = ResourceRequestResult.Success; } catch (StorageThrottlingException) { result = ResourceRequestResult.Exception; throw; } catch (Exception ex) { result = ResourceRequestResult.Exception; //Collector?.LogException(string.Format("Unable to output {0} to {1} for {2}", id, directory, typeof(E).Name), ex); StatisticsInternal.ErrorIncrement(connector.Support); throw; } finally { StatisticsInternal.ActiveDecrement(connector.Support, start); if (traceId.HasValue) { ProfileEnd(traceId.Value, start, result); } } }
/// <summary> /// This method validates the encryption policy. /// </summary> /// <param name="connector">The connector to validate.</param> protected virtual void ValidateEncryptionPolicy(IAzureStorageConnectorBase connector) { if (connector.EncryptionPolicy == AzureStorageEncryption.BlobAlwaysWithException && connector.Encryptor == null) { throw new AzureStorageDataCollectorEncryptionPolicyException(connector.Support); } }