Coder Social home page Coder Social logo

flagsmith / flagsmith-ruby-client Goto Github PK

View Code? Open in Web Editor NEW
11.0 14.0 6.0 233 KB

Ruby Client for Flagsmith. Ship features with confidence using feature flags and remote config. Host yourself or use our hosted version at https://www.flagsmith.com/

Home Page: https://www.flagsmith.com/

License: BSD 3-Clause "New" or "Revised" License

Ruby 99.86% Shell 0.14%
feature-flags feature-flag feature-flagging feature-flaggers feature-toggles feature-toggle ci cd continuous-integration continous-integration continous-deployment

flagsmith-ruby-client's Issues

v4 Dependency Issues

Hello! I'm struggling to use version 4 of this gem.
I'm somewhat newish to ruby so please excuse me if I missed something.

I've added the gem to my application using bundle add flagsmith.
Afterwards the application fails to launch because the gem pry can't be found.

Looking the gemspec it seems that pry and pry-byebug are only defined as a dev dependency and thus should not be required.
However both gems are required in a way that seems like they are not optional by lib/flagsmith.rb

Calls to environment_data_polling_manager cause unintended network requests

We wanted to call client.environment_data_polling_manager.stop manually in our code to prevent networking requests during tests. Doing this though causes networking requests do to the line at https://github.com/Flagsmith/flagsmith-ruby-client/blob/main/lib/flagsmith.rb#L106. This seems to make sense for initial calls to environment_data_polling_manager but I would expect subsequent calls to environment_data_polling_manager to return the initialized manager.

Identity overrides in local evaluation mode

  1. Extend the Environment model with the identity_overrides: List[IdentityModel] field.
  2. On environment update in local evaluation mode, store overrides so they're efficiently accessed by identifier.
  3. For build_indentity_model interface (it's now more appropriate to call it get_identity_model so please rename it to that to match the other changes in the other sdks), use the storage above to retrieve the identity overrides. Fall back to a new IdentityModel instance if not found. If found, update traits with user-provided traits.

Refer to the following existing implementations:

Flagsmith/flagsmith-python-client#72
Flagsmith/flagsmith-java-client#142
Flagsmith/flagsmith-nodejs-client#143

Support transient identities and traits

Update the get_identity_flags interface to support

  • An optional boolean transient argument to denote a transient identity
  • An optional string list transient_traits argument when supplying traits

Update the SDK API calls to add values according to updated schema here Flagsmith/flagsmith#4279

Multivariate evaluations not working in local evaluation

Given an environment with a flag titled test_mv which has a control value and a variation which has a weighting of 100% running the following script should return the variation value each time, but seemingly returns the control value.

require "flagsmith"

flagsmith = Flagsmith::Client.new(
  environment_key: "<key>",
  enable_local_evaluation: true,
)

identifier = "{Random.rand}"
flags = flagsmith.get_identity_flags(identifier)

puts flags.get_feature_value("test_mv")

Rename

Are there plans to publish a version of the gem with the new name?

Rails apps with puma on cluster mode not catching up flag changes when local evaluation is enabled

Context

When the following conditions are met, the local environment of the rails server does not refresh the flag states...the environment document request actually happens, tough.

  • rails app
  • puma (on cluster mode - even with 1 worker 1 thread)
  • local evaluation enabled
  • booting with rails s command

Steps to reproduce

  • Create a new rails app
  • Configure puma with cluster mode (set a value above zero for workers on config/puma.rb)
  • Create an initializer, defining the global variable, just like the documentation shows. Local evaluation must be enabled
  • boot the server with rails s
  • check if the flagsmith client is responding to flag state changes on the flagsmith dashboard between every environment document request

Useful info

  • Works normally with puma on single mode
  • Puma worker and thread count does not matter to the issue
  • On puma cluster mode, it seems like there is something wrong with the puma boot using the bundle exec rails s command, since running bundle exec puma -t 1:1 -w 1:1 looks fine
  • Worth mentioning that the local evaluation on the rails c console, the normal behavior occurs
  • Tested on macOs Ventura 13.6.7 (M1 chip) and Ubuntu 22 (x64)

Example project

https://github.com/Guilherme2112/flagsmith-rails-example

(basic instructions at README)

TypeError (superclass mismatch for class RetriableResponse)

Hi, I'm trying to use flagsmith but when I call Flagsmith::Client.new(....) throws me the next error

Traceback (most recent call last):
16: from (irb):8
15: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in require' 14: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in load_dependency'
13: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in block in require' 12: from /bundle/ruby/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in require'
11: from /bundle/ruby/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in require' 10: from /bundle/ruby/2.7.0/gems/flagsmith-3.1.1/lib/flagsmith.rb:4:in <top (required)>'
9: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in require' 8: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in load_dependency'
7: from /bundle/ruby/2.7.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in block in require' 6: from /bundle/ruby/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in require'
5: from /bundle/ruby/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in require' 4: from /bundle/ruby/2.7.0/gems/faraday-retry-1.0.3/lib/faraday/retry.rb:3:in <top (required)>'
3: from /bundle/ruby/2.7.0/gems/faraday-retry-1.0.3/lib/faraday/retry.rb:3:in require_relative' 2: from /bundle/ruby/2.7.0/gems/faraday-retry-1.0.3/lib/faraday/retriable_response.rb:4:in <top (required)>'
1: from /bundle/ruby/2.7.0/gems/faraday-retry-1.0.3/lib/faraday/retriable_response.rb:6:in `module:Faraday'
TypeError (superclass mismatch for class RetriableResponse)

Any thoughts? Thank you in advance for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.