public HttpEndpointHealthCheck(
     HttpHealthCheckParameters parameters,
     IHttpClientFactory httpClientFactory,
     IAccessor <ServiceContext> accessor,
     ILogger <HttpEndpointHealthCheck> logger,
     ITimedScopeProvider scopeProvider)
     : base(logger, scopeProvider)
 {
     Parameters          = parameters;
     m_httpClientFactory = httpClientFactory;
     m_accessor          = accessor;
 }
Beispiel #2
0
 /// <summary>
 /// Base constructor with scope provider that would be removed after .NET 5 move
 /// </summary>
 protected AbstractHealthCheck(ILogger logger, ITimedScopeProvider scopeProvider)
 {
     Logger          = logger;
     m_scopeProvider = scopeProvider;
 }
 public OmexCompatibilityIntializerService(ITimedScopeProvider timedScopeProvider, ILoggerFactory loggerFactory) =>
 (m_timedScopeProvider, m_loggerFactory) = (timedScopeProvider, loggerFactory);
Beispiel #4
0
 /// <summary>
 /// Starts TimedScopes before task execution and finish after it's completion
 /// </summary>
 public static ValueTask WithTimedScope(this Task task, ITimedScopeProvider provider, TimedScopeDefinition definition) =>
 new ValueTask(task).WithTimedScope(provider, definition);
Beispiel #5
0
 /// <summary>
 /// Starts TimedScopes before task execution and finish after it's completion
 /// </summary>
 public static ValueTask <TResult> WithTimedScope <TResult>(this Task <TResult> task, ITimedScopeProvider provider, TimedScopeDefinition definition) =>
 new ValueTask <TResult>(task).WithTimedScope(provider, definition);
Beispiel #6
0
 /// <summary>
 /// Starts TimedScopes before task execution and finish after it's completion
 /// </summary>
 public static async ValueTask WithTimedScope(this ValueTask task, ITimedScopeProvider provider, TimedScopeDefinition definition) =>
 // await required to convert ValueTask<T> to ValueTask https://github.com/microsoft/Omex/pull/153#discussion_r389761929
 await ConvertToTaskWithResultValue(task).WithTimedScope(provider, definition).ConfigureAwait(false);
Beispiel #7
0
        /// <summary>
        /// Starts TimedScopes before task execution and finish after it's completion
        /// </summary>
        public static async ValueTask <TResult> WithTimedScope <TResult>(this ValueTask <TResult> task, ITimedScopeProvider provider, TimedScopeDefinition definition)
        {
            using TimedScope timedScope = provider.CreateAndStart(definition, TimedScopeResult.SystemError);
            TResult result = await task.ConfigureAwait(false);

            timedScope.SetResult(TimedScopeResult.Success);             // set TimedScope result to success in case if task completed properly (without exception)
            return(result);
        }
 /// <summary>
 /// Initialize compatibility classes with provided instances
 /// </summary>
 public static void Initialize(ILoggerFactory factory, ITimedScopeProvider scopeProvider)
 {
     TimedScopeDefinitionExtensions.Initialize(scopeProvider);
     Code.Initialize(factory);
     ULSLogging.Initialize(factory);
 }
 internal static void Initialize(ITimedScopeProvider provider) => s_timedScopeProvider = provider;