eppo-server-sdk 3.3.0-x86_64-linux → 3.4.1-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +32 -0
 - data/lib/eppo_client/3.0/eppo_client.so +0 -0
 - data/lib/eppo_client/3.1/eppo_client.so +0 -0
 - data/lib/eppo_client/3.2/eppo_client.so +0 -0
 - data/lib/eppo_client/3.3/eppo_client.so +0 -0
 - data/lib/eppo_client/client.rb +12 -14
 - data/lib/eppo_client/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7ffa66fe576accc114e301a157f48f49448f1d3a2103788cb509cc1a04453193
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 88bf14a58c758a9d3a01ceb2ca2d570850c3f3a4440a24b97c5af7e841dbdea4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 348c33c2a8baa6ea3d6b66c02f2f0cbb1888b89c5cc159e12e64892c1333fa4a7fcc5228ce9e59cd767c24b2468ced055e69641194286cbb68c729b13a981aa0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f8ebc0bf91aaad3ce8724b2a06c9f7962e0a8b899b1c44aa00885f74c54a6188a10d0923ef67de934cf29ee3cf3eabab4cb39d8335e9d26c3adaee99a77489fc
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -38,8 +38,40 @@ eppo_core = { path = '../eppo_core' } 
     | 
|
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
            Make sure you remove the override before updating `Cargo.lock`. Otherwise, the lock file will be missing `eppo_core` checksum and will be unsuitable for release. (CI will warn you if you do this accidentally.)
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
            ## Build locally
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            Install all dependencies:
         
     | 
| 
      
 44 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 45 
     | 
    
         
            +
            bundle install
         
     | 
| 
      
 46 
     | 
    
         
            +
            ```
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            Build native extension:
         
     | 
| 
      
 49 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 50 
     | 
    
         
            +
            bundle exec rake build
         
     | 
| 
      
 51 
     | 
    
         
            +
            ```
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            Run tests:
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 55 
     | 
    
         
            +
            bundle exec rspec
         
     | 
| 
      
 56 
     | 
    
         
            +
            ```
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       41 
58 
     | 
    
         
             
            ## Releasing
         
     | 
| 
       42 
59 
     | 
    
         | 
| 
       43 
60 
     | 
    
         
             
            * Bump versions in `ruby-sdk/lib/eppo_client/version.rb` and `ruby-sdk/ext/eppo_client/Cargo.toml`
         
     | 
| 
       44 
61 
     | 
    
         
             
            * Run `cargo update --workspace --verbose` to update `Cargo.lock`
         
     | 
| 
       45 
62 
     | 
    
         
             
            * Run `bundle` to update `Gemfile.lock`
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ## Building Ruby native lib
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            1. Clone this repository at the desired Ruby SDK tag, eg.: `git clone --depth 1 --branch ruby-sdk@x.y.z https://github.com/Eppo-exp/eppo-multiplatform.git`
         
     | 
| 
      
 68 
     | 
    
         
            +
            2. Open `build.sh` and update `rb-sys-dock --platform <platform>` with the desired platform, eg.: `rb-sys-dock --platform x86_64-linux`
         
     | 
| 
      
 69 
     | 
    
         
            +
            3. Run `docker build --build-arg WORKDIR=$(pwd) -f Dockerfile.ruby.build -t ruby-sdk-builder .` to build the builder docker image
         
     | 
| 
      
 70 
     | 
    
         
            +
            4. Run the following command to build the gem with native lib:
         
     | 
| 
      
 71 
     | 
    
         
            +
            ```
         
     | 
| 
      
 72 
     | 
    
         
            +
            mkdir -p rust/cargo/registry && docker run --rm -it \
         
     | 
| 
      
 73 
     | 
    
         
            +
              -v /var/run/docker.sock:/var/run/docker.sock \
         
     | 
| 
      
 74 
     | 
    
         
            +
              -v /tmp:/tmp -v \
         
     | 
| 
      
 75 
     | 
    
         
            +
              $(pwd)/rust:$(pwd)/rust ruby-sdk-builder
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```
         
     | 
| 
      
 77 
     | 
    
         
            +
            5. The gem will be available at `ruby-sdk/pkg/eppo-server-sdk-x.y.z-arch.gem`
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
    
        data/lib/eppo_client/client.rb
    CHANGED
    
    | 
         @@ -22,7 +22,7 @@ module EppoClient 
     | 
|
| 
       22 
22 
     | 
    
         
             
                def init(config)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  config.validate
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  if  
     | 
| 
      
 25 
     | 
    
         
            +
                  if @core
         
     | 
| 
       26 
26 
     | 
    
         
             
                    STDERR.puts "Eppo Warning: multiple initialization of the client"
         
     | 
| 
       27 
27 
     | 
    
         
             
                    @core.shutdown
         
     | 
| 
       28 
28 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -91,7 +91,10 @@ module EppoClient 
     | 
|
| 
       91 
91 
     | 
    
         
             
                  log_assignment(result[:assignment_event])
         
     | 
| 
       92 
92 
     | 
    
         
             
                  log_bandit_action(result[:bandit_event])
         
     | 
| 
       93 
93 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
                   
     | 
| 
      
 94 
     | 
    
         
            +
                  {
         
     | 
| 
      
 95 
     | 
    
         
            +
                    :variation => result[:variation],
         
     | 
| 
      
 96 
     | 
    
         
            +
                    :action => result[:action]
         
     | 
| 
      
 97 
     | 
    
         
            +
                  }
         
     | 
| 
       95 
98 
     | 
    
         
             
                end
         
     | 
| 
       96 
99 
     | 
    
         | 
| 
       97 
100 
     | 
    
         
             
                def get_bandit_action_details(flag_key, subject_key, subject_attributes, actions, default_variation)
         
     | 
| 
         @@ -102,7 +105,7 @@ module EppoClient 
     | 
|
| 
       102 
105 
     | 
    
         
             
                  log_assignment(result[:assignment_event])
         
     | 
| 
       103 
106 
     | 
    
         
             
                  log_bandit_action(result[:bandit_event])
         
     | 
| 
       104 
107 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                   
     | 
| 
      
 108 
     | 
    
         
            +
                  {
         
     | 
| 
       106 
109 
     | 
    
         
             
                    :variation => result[:variation],
         
     | 
| 
       107 
110 
     | 
    
         
             
                    :action => result[:action],
         
     | 
| 
       108 
111 
     | 
    
         
             
                    :evaluationDetails => details
         
     | 
| 
         @@ -116,13 +119,11 @@ module EppoClient 
     | 
|
| 
       116 
119 
     | 
    
         
             
                  logger = Logger.new($stdout)
         
     | 
| 
       117 
120 
     | 
    
         
             
                  begin
         
     | 
| 
       118 
121 
     | 
    
         
             
                    assignment = @core.get_assignment(flag_key, subject_key, subject_attributes, expected_type)
         
     | 
| 
       119 
     | 
    
         
            -
                     
     | 
| 
       120 
     | 
    
         
            -
                      return default_value
         
     | 
| 
       121 
     | 
    
         
            -
                    end
         
     | 
| 
      
 122 
     | 
    
         
            +
                    return default_value unless assignment
         
     | 
| 
       122 
123 
     | 
    
         | 
| 
       123 
124 
     | 
    
         
             
                    log_assignment(assignment[:event])
         
     | 
| 
       124 
125 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
                    return assignment[:value] 
     | 
| 
      
 126 
     | 
    
         
            +
                    return assignment[:value]
         
     | 
| 
       126 
127 
     | 
    
         
             
                  rescue StandardError => error
         
     | 
| 
       127 
128 
     | 
    
         
             
                    logger.debug("[Eppo SDK] Failed to get assignment: #{error}")
         
     | 
| 
       128 
129 
     | 
    
         | 
| 
         @@ -137,19 +138,16 @@ module EppoClient 
     | 
|
| 
       137 
138 
     | 
    
         
             
                  result, event = @core.get_assignment_details(flag_key, subject_key, subject_attributes, expected_type)
         
     | 
| 
       138 
139 
     | 
    
         
             
                  log_assignment(event)
         
     | 
| 
       139 
140 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
                  if  
     | 
| 
      
 141 
     | 
    
         
            +
                  if !result[:variation]
         
     | 
| 
       141 
142 
     | 
    
         
             
                    result[:variation] = default_value
         
     | 
| 
       142 
     | 
    
         
            -
                  else
         
     | 
| 
       143 
     | 
    
         
            -
                    # unwrap from AssignmentValue to untyped value
         
     | 
| 
       144 
     | 
    
         
            -
                    result[:variation] = result[:variation][:value]
         
     | 
| 
       145 
143 
     | 
    
         
             
                  end
         
     | 
| 
       146 
144 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
                   
     | 
| 
      
 145 
     | 
    
         
            +
                  result
         
     | 
| 
       148 
146 
     | 
    
         
             
                end
         
     | 
| 
       149 
147 
     | 
    
         
             
                # rubocop:enable Metrics/MethodLength
         
     | 
| 
       150 
148 
     | 
    
         | 
| 
       151 
149 
     | 
    
         
             
                def log_assignment(event)
         
     | 
| 
       152 
     | 
    
         
            -
                   
     | 
| 
      
 150 
     | 
    
         
            +
                  return unless event
         
     | 
| 
       153 
151 
     | 
    
         | 
| 
       154 
152 
     | 
    
         
             
                  # Because rust's AssignmentEvent has a #[flatten] extra_logging
         
     | 
| 
       155 
153 
     | 
    
         
             
                  # field, serde_magnus serializes it as a normal HashMap with
         
     | 
| 
         @@ -170,7 +168,7 @@ module EppoClient 
     | 
|
| 
       170 
168 
     | 
    
         
             
                end
         
     | 
| 
       171 
169 
     | 
    
         | 
| 
       172 
170 
     | 
    
         
             
                def log_bandit_action(event)
         
     | 
| 
       173 
     | 
    
         
            -
                   
     | 
| 
      
 171 
     | 
    
         
            +
                  return unless event
         
     | 
| 
       174 
172 
     | 
    
         | 
| 
       175 
173 
     | 
    
         
             
                  begin
         
     | 
| 
       176 
174 
     | 
    
         
             
                    @assignment_logger.log_bandit_action(event)
         
     | 
    
        data/lib/eppo_client/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: eppo-server-sdk
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: x86_64-linux
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Eppo
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-01-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     |