Skip to content

feat(di): HedgeDefinition in ShieldDefinition for configuration-bound hedging #517

Description

@thomhurst

Problem

ShieldDefinition (src/Kevlar.Extensions.DependencyInjection/ShieldDefinition.cs:25-40) binds Timeout, Retry, CircuitBreaker, RateLimit, ConcurrencyLimit, and AttemptTimeout. Hedging cannot be expressed from configuration even though HedgeOptions has only scalar settings (MaxHedgedAttempts, Delay). Applications using AddShield(name, IConfiguration) therefore cannot hedge without dropping to code.

Proposed fix

  • HedgeDefinition { MaxHedgedAttempts, Delay } bound at ShieldDefinition.Hedge.
  • Fixed pipeline position documented; Retry and Hedge both set is a KevlarConfigurationException at build time.
  • Fallback stays out of configuration because it needs a delegate; document that.
  • ReloadingShieldOptions covers the new field automatically.

Tests

  • Binding from JSON produces the expected Describe() string.
  • Validation error when both Retry and Hedge are set.
  • Reload picks up a changed hedge delay.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions