Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Unleash Feature Flags into Traefik AB Testing Middleware #1

Open
daemonp opened this issue Sep 13, 2024 · 0 comments
Open

Comments

@daemonp
Copy link
Owner

daemonp commented Sep 13, 2024

We currently have a robust AB testing middleware for Traefik that allows for dynamic routing based on various conditions. We want to explore integrating Unleash feature flags into the middleware to enhance its functionality and provide more flexible and real-time control over feature rollouts.

Proposed Integration:

  1. Introduce Unleash client:

    • Initialize an Unleash client within the middleware to communicate with the Unleash server.
    • Use the official Unleash Go SDK (github.com/Unleash/unleash-client-go/v3).
  2. Feature flag mapping:

    • Extend the middleware configuration to include feature flag names associated with routing rules.
    • Example:
      rules:
        - path: "/new-feature"
          method: "GET"
          featureFlag: "new-feature-enabled"
          backend: "http://v2-service"
  3. Feature flag evaluation:

    • During request processing, evaluate the relevant Unleash feature flags for each rule.
    • Use the Unleash client's IsEnabled method to check the status of feature flags.
  4. Conditional routing:

    • Modify the existing routing logic to incorporate feature flag evaluation results.
    • Route traffic based on both the current rule conditions and the feature flag state.
  5. Caching:

    • Implement caching for feature flag evaluations to minimize Unleash server requests.
    • Use a local cache with a configurable TTL.
  6. Fail-open behavior:

    • In case the Unleash server is unreachable, implement a fail-open strategy.
    • Use default rules or cached values until the server becomes available again.
  7. Error handling:

    • Gracefully handle potential errors during communication with the Unleash server.
    • Log errors and fall back to default behavior when necessary.
  8. Performance monitoring:

    • Track the performance impact of feature flag evaluations.
    • Add metrics for feature flag evaluation times and cache hit rates.

Implementation Considerations:

  • Direct integration: Embed Unleash client directly within the middleware.
  • External service: Create a separate service that interacts with Unleash and provides a simplified API for the middleware.

Next Steps:

  1. Evaluate the Unleash Go SDK and its compatibility with our current middleware structure.
  2. Design the extended configuration format to include feature flag mappings.
  3. Implement a proof-of-concept integration in a separate branch.
  4. Conduct performance testing to ensure the integration doesn't introduce significant overhead.
  5. Update documentation and provide examples of using Unleash feature flags with the middleware.

By integrating Unleash feature flags, we can provide more dynamic and fine-grained control over feature rollouts and A/B testing, enhancing the flexibility and power of our Traefik middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant