public static IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { if (commandKey == null) { throw new ArgumentNullException("commandKey"); } IHystrixPropertiesStrategy strategy = HystrixPlugins.Instance.PropertiesStrategy; string cacheKey = strategy.GetCommandPropertiesCacheKey(commandKey, setter); if (String.IsNullOrEmpty(cacheKey)) { return(strategy.GetCommandProperties(commandKey, setter)); } else { return(commandProperties.GetOrAdd(cacheKey, w => { if (setter == null) { setter = new HystrixCommandPropertiesSetter(); } return strategy.GetCommandProperties(commandKey, setter); })); } }
public IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { if (setter == null) { setter = UnitTestSetterFactory.GetCommandPropertiesSetter(); } return(new MockingHystrixCommandProperties(setter)); }
public DynamicOwnerAndKeyTestCommand(HystrixCommandGroupKey owner, HystrixCommandKey key) : base(new TestCommandBuilder() { Owner = owner, DependencyKey = key, CircuitBreaker = null, Metrics = null, }) { // we specifically are NOT passing in a circuit breaker here so we test that it creates a new one correctly based on the dynamic key }
public HystrixServoMetricsPublisherCommand( HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { this.commandKey = commandKey; this.commandGroupKey = commandGroupKey; this.metrics = metrics; this.circuitBreaker = circuitBreaker; this.properties = properties; this.servoInstanceTag = new BasicTag("instance", commandKey.Name); this.servoTypeTag = new BasicTag("origin", "HystrixCommand"); }
public static IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { if (commandKey == null) throw new ArgumentNullException("commandKey"); IHystrixPropertiesStrategy strategy = HystrixPlugins.Instance.PropertiesStrategy; string cacheKey = strategy.GetCommandPropertiesCacheKey(commandKey, setter); if (String.IsNullOrEmpty(cacheKey)) { return strategy.GetCommandProperties(commandKey, setter); } else { return commandProperties.GetOrAdd(cacheKey, w => { if (setter == null) { setter = new HystrixCommandPropertiesSetter(); } return strategy.GetCommandProperties(commandKey, setter); }); } }
public virtual void MarkEvent(HystrixEventType eventType, HystrixCommandKey key) { // do nothing }
public virtual void MarkCommandExecution(HystrixCommandKey key, ExecutionIsolationStrategy isolationStrategy, TimeSpan duration, IEnumerable<HystrixEventType> eventsDuringExecution) { // do nothing }
/// <summary> /// Gets the <see cref="IHystrixCircuitBreaker"/> instance for a given <see cref="HystrixCommandKey"/> or null if none exists. /// </summary> /// <param name="key">The key of the command requesting the circuit breaker.</param> /// <returns>The circuit breaker instance of the command or null if none exists.</returns> public static IHystrixCircuitBreaker GetInstance(HystrixCommandKey key) { return(Instances.GetOrDefault(key)); }
/// <summary> /// Gets the <see cref="IHystrixCircuitBreaker"/> instance for a given <see cref="HystrixCommandKey"/>. /// If no circuit breaker exists for the specified command key, a new one will be created using the properties and metrics parameters. /// If a circuit breaker already exists, those parameters will be ignored. /// </summary> /// <param name="commandKey">Command key of command instance requesting the circuit breaker.</param> /// <param name="properties">The properties of the specified command.</param> /// <param name="metrics">The metrics of the specified command.</param> /// <returns>A new or an existing circuit breaker instance.</returns> public static IHystrixCircuitBreaker GetInstance(HystrixCommandKey commandKey, IHystrixCommandProperties properties, HystrixCommandMetrics metrics) { return(Instances.GetOrAdd(commandKey, w => new HystrixCircuitBreakerImpl(properties, metrics))); }
public virtual string GetCommandPropertiesCacheKey(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { return(commandKey.Name); }
public virtual string GetCommandPropertiesCacheKey(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { return commandKey.Name; }
private static IHystrixCircuitBreaker GetCircuitBreaker(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixCommandMetrics metrics, HystrixCommandPropertiesSetter properties) { return(new HystrixCircuitBreakerImpl(new MockingHystrixCommandProperties(properties), metrics)); }
public virtual IHystrixMetricsPublisherCommand GetMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return new HystrixMetricsPublisherCommandDefault(commandKey, commandGroupKey, metrics, circuitBreaker, properties); }
public static IHystrixMetricsPublisherCommand CreateOrRetrievePublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return(instance.GetPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties)); }
public IHystrixMetricsPublisherCommand GetPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return(this.commandPublishers.GetOrAdd(commandKey.Name, w => this.strategy.GetMetricsPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties), w => w.Initialize())); }
public virtual IHystrixMetricsPublisherCommand GetMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return(new HystrixMetricsPublisherCommandDefault(commandKey, commandGroupKey, metrics, circuitBreaker, properties)); }
public static IHystrixMetricsPublisherCommand CreateOrRetrievePublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return instance.GetPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); }
public IHystrixMetricsPublisherCommand GetPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { return this.commandPublishers.GetOrAdd(commandKey.Name, w => this.strategy.GetMetricsPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties), w => w.Initialize()); }
public string GetCommandPropertiesCacheKey(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { return(null); }
public virtual void MarkCommandExecution(HystrixCommandKey key, ExecutionIsolationStrategy isolationStrategy, TimeSpan duration, IEnumerable <HystrixEventType> eventsDuringExecution) { // do nothing }
public virtual IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { return new HystrixPropertiesCommandDefault(setter); }
public HystrixMetricsPublisherCommandDefault(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties) { // do nothing by default }
public virtual IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter) { return(new HystrixPropertiesCommandDefault(setter)); }