@@ -390,8 +390,7 @@ module LaunchDarkly
390390
391391 output = flush_and_get_events ( ep , sender )
392392 expect ( output ) . to contain_exactly (
393- eq ( index_event ( default_config , context ) ) ,
394- eq ( custom_event ( context , 'eventkey' , { thing : 'stuff' } , 1.5 ) )
393+ eq ( custom_event ( default_config , context , 'eventkey' , { thing : 'stuff' } , 1.5 ) )
395394 )
396395 end
397396 end
@@ -403,8 +402,7 @@ module LaunchDarkly
403402
404403 output = flush_and_get_events ( ep , sender )
405404 expect ( output ) . to contain_exactly (
406- eq ( index_event ( config , context ) ) ,
407- eq ( custom_event ( context , 'eventkey' , nil , nil ) )
405+ eq ( custom_event ( config , context , 'eventkey' , nil , nil ) )
408406 )
409407 end
410408 end
@@ -476,7 +474,7 @@ module LaunchDarkly
476474
477475 output = flush_and_get_events ( ep , sender )
478476 expect ( output ) . to contain_exactly (
479- eq ( migration_op_event ( flag , context , 0 , true , LaunchDarkly ::Migrations ::STAGE_OFF , reason , starting_timestamp +1 ) )
477+ eq ( migration_op_event ( default_config , flag , context , 0 , true , LaunchDarkly ::Migrations ::STAGE_OFF , reason , starting_timestamp +1 ) )
480478 )
481479 end
482480 end
@@ -786,6 +784,7 @@ def feature_event(config, flag, context, variation, value, timestamp = starting_
786784 end
787785
788786 #
787+ # @param config [Config]
789788 # @param flag [LaunchDarkly::Impl::Models::FeatureFlag]
790789 # @param context [LDContext]
791790 # @param variation [Integer]
@@ -795,12 +794,15 @@ def feature_event(config, flag, context, variation, value, timestamp = starting_
795794 # @param timestamp [Integer]
796795 # @return [Hash]
797796 #
798- def migration_op_event ( flag , context , variation , value , default , reason , timestamp = starting_timestamp )
797+ def migration_op_event ( config , flag , context , variation , value , default , reason , timestamp = starting_timestamp )
798+ context_filter = Impl ::ContextFilter . new ( config . all_attributes_private , config . private_attributes )
799+ redacted_context = context_filter . filter_redact_anonymous ( context )
800+
799801 out = {
800802 kind : 'migration_op' ,
801803 operation : 'read' ,
802804 creationDate : timestamp ,
803- contextKeys : context . keys ,
805+ context : redacted_context ,
804806 evaluation : {
805807 default : default . to_s ,
806808 key : flag . key ,
@@ -836,17 +838,21 @@ def debug_event(config, flag, context, variation, value, timestamp = starting_ti
836838 end
837839
838840 #
841+ # @param config [Config]
839842 # @param context [LDContext]
840843 # @param key [String]
841844 # @param data [any]
842845 # @param metric_value [any]
843846 # @return [Hash]
844847 #
845- def custom_event ( context , key , data , metric_value )
848+ def custom_event ( config , context , key , data , metric_value )
849+ context_filter = Impl ::ContextFilter . new ( config . all_attributes_private , config . private_attributes )
850+ redacted_context = context_filter . filter_redact_anonymous ( context )
851+
846852 out = {
847853 kind : "custom" ,
848854 creationDate : starting_timestamp ,
849- contextKeys : context . keys ,
855+ context : redacted_context ,
850856 key : key ,
851857 }
852858 out [ :data ] = data unless data . nil?
0 commit comments