Exemplo n.º 1
0
 /// <summary>
 /// This constructor passes in the support types for the collector.
 /// </summary>
 protected DataCollectorBase(EncryptionHandlerId encryptionId   = null
                             , ResourceProfile resourceProfile  = null
                             , DataCollectionSupport?supportMap = null
                             , P policy = null) : base(policy)
 {
     mResourceProfile     = resourceProfile;
     mSupportMapSubmitted = supportMap;
     mEncryption          = encryptionId;
 }
        /// <summary>
        /// This extension method can be used to quickly add a debug memory based data collector.
        /// </summary>
        /// <typeparam name="P">The pipeline type.</typeparam>
        /// <param name="pipeline">The pipeline.</param>
        /// <param name="action">This action is called to allow the collector to be assigned externally.</param>
        /// <param name="supportMap">The support map can be used to filter the types of events that you wish to filter. Leave this null to support all types.</param>
        /// <returns>Returns the pipeline.</returns>
        public static P AddDebugMemoryDataCollector <P>(this P pipeline
                                                        , Action <DebugMemoryDataCollector> action
                                                        , DataCollectionSupport?supportMap = null)
            where P : IPipeline
        {
            DebugMemoryDataCollector collector = new DebugMemoryDataCollector(supportMap);

            pipeline.AddDataCollector(collector);
            action?.Invoke(collector);
            return(pipeline);
        }
        /// <summary>
        /// This extension method can be used to quickly add a debug memory based data collector.
        /// </summary>
        /// <typeparam name="P">The pipeline type.</typeparam>
        /// <param name="pipeline">The pipeline.</param>
        /// <param name="collector">The collector as an output parameter.</param>
        /// <param name="supportMap">The support map can be used to filter the types of events that you wish to filter. Leave this null to support all types.</param>
        /// <returns>Returns the pipeline.</returns>
        public static P AddDebugMemoryDataCollector <P>(this P pipeline
                                                        , out DebugMemoryDataCollector collector
                                                        , DataCollectionSupport?supportMap = null)
            where P : IPipeline
        {
            DebugMemoryDataCollector collectorInt = null;

            pipeline.AddDataCollector((c) => collectorInt = new DebugMemoryDataCollector(supportMap));
            collector = collectorInt;
            return(pipeline);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="credentials"></param>
        /// <param name="policy"></param>
        /// <param name="context"></param>
        /// <param name="resourceProfile"></param>
        /// <param name="encryptionId"></param>
        /// <param name="supportMap"></param>
        public AzureStorageDataCollector(StorageCredentials credentials
                                         , AzureStorageDataCollectorPolicy policy = null
                                         , OperationContext context         = null
                                         , ResourceProfile resourceProfile  = null
                                         , EncryptionHandlerId encryptionId = null
                                         , DataCollectionSupport?supportMap = null) : base(encryptionId, resourceProfile, supportMap, policy)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException($"{nameof(AzureStorageDataCollector)}: credentials cannot be null.");
            }

            mCredentails = credentials;

            mContext = context;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="connection">Connection string to Event Hub including the entity path</param>
        /// <param name="entityPath">Entity path if not supplied in the connection string</param>
        /// <param name="policy">Policy</param>
        /// <param name="resourceProfile">Resource Profile</param>
        /// <param name="encryptionId">Encryption Id</param>
        /// <param name="supportMap">Support Map</param>
        public EventHubsDataCollector(string connection
                                      , string entityPath
                                      , EventHubsDataCollectorPolicy policy = null
                                      , ResourceProfile resourceProfile     = null
                                      , EncryptionHandlerId encryptionId    = null
                                      , DataCollectionSupport?supportMap    = null) : base(encryptionId, resourceProfile, supportMap, policy)
        {
            var connectionStringBuilder = new EventHubsConnectionStringBuilder(connection);

            if (!string.IsNullOrWhiteSpace(entityPath))
            {
                connectionStringBuilder.EntityPath = entityPath;
            }

            mConnection = connectionStringBuilder.ToString();
        }
Exemplo n.º 6
0
        /// <summary>
        /// This extension allows for specific data collection events to be inspected.
        /// </summary>
        /// <param name="pipeline">The incoming pipeline.</param>
        /// <param name="action">An action to process the event.</param>
        /// <param name="supported">A flags enumeration to filter the specific event types that you wish to process. Leave this null to process all event types.</param>
        /// <returns>The pass-through of the pipeline.</returns>
        public static P OnDataCollection <P>(this P pipeline
                                             , Action <OnDataCollectionContext, EventHolder> action
                                             , DataCollectionSupport?supported = null)
            where P : IPipeline
        {
            if (action == null)
            {
                throw new ArgumentNullException("action", "'action' cannot be null for OnEvent");
            }

            var ms = pipeline.ToMicroservice();

            var comp = pipeline.Service.DataCollection.Register(new OnEventDataCollectionComponent(supported, action, () => ms.Dispatch));

            return(pipeline);
        }
 /// <summary>
 /// This is the default constructor.
 /// </summary>
 /// <param name="supportMap">The support map can be used to filter the types of events that you wish to filter. Leave this null to support all types.</param>
 public DebugMemoryDataCollector(DataCollectionSupport?supportMap = null) : base(supportMap: supportMap)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OnEventDataCollectionComponent"/> class.
 /// </summary>
 /// <param name="supported">The supported event types.</param>
 /// <param name="action">The action to process a supported event.</param>
 /// <param name="dispatcher">The dispatcher function.</param>
 internal OnEventDataCollectionComponent(DataCollectionSupport?supported, Action <OnDataCollectionContext, EventHolder> action, Func <IMicroserviceDispatch> dispatcher)
 {
     mSupportedFilter    = supported;
     mAction             = action;
     mDispatcherFunction = dispatcher;
 }