@@ -391,7 +391,7 @@ module LaunchDarkly
391391 output = flush_and_get_events ( ep , sender )
392392 expect ( output ) . to contain_exactly (
393393 eq ( index_event ( default_config , context ) ) ,
394- eq ( custom_event ( context , 'eventkey' , { thing : 'stuff' } , 1.5 ) )
394+ eq ( custom_event ( default_config , context , 'eventkey' , { thing : 'stuff' } , 1.5 ) )
395395 )
396396 end
397397 end
@@ -404,7 +404,7 @@ module LaunchDarkly
404404 output = flush_and_get_events ( ep , sender )
405405 expect ( output ) . to contain_exactly (
406406 eq ( index_event ( config , context ) ) ,
407- eq ( custom_event ( context , 'eventkey' , nil , nil ) )
407+ eq ( custom_event ( config , context , 'eventkey' , nil , nil ) )
408408 )
409409 end
410410 end
@@ -476,7 +476,7 @@ module LaunchDarkly
476476
477477 output = flush_and_get_events ( ep , sender )
478478 expect ( output ) . to contain_exactly (
479- eq ( migration_op_event ( flag , context , 0 , true , LaunchDarkly ::Migrations ::STAGE_OFF , reason , starting_timestamp +1 ) )
479+ eq ( migration_op_event ( default_config , flag , context , 0 , true , LaunchDarkly ::Migrations ::STAGE_OFF , reason , starting_timestamp +1 ) )
480480 )
481481 end
482482 end
@@ -786,6 +786,7 @@ def feature_event(config, flag, context, variation, value, timestamp = starting_
786786 end
787787
788788 #
789+ # @param config [Config]
789790 # @param flag [LaunchDarkly::Impl::Models::FeatureFlag]
790791 # @param context [LDContext]
791792 # @param variation [Integer]
@@ -795,12 +796,15 @@ def feature_event(config, flag, context, variation, value, timestamp = starting_
795796 # @param timestamp [Integer]
796797 # @return [Hash]
797798 #
798- def migration_op_event ( flag , context , variation , value , default , reason , timestamp = starting_timestamp )
799+ def migration_op_event ( config , flag , context , variation , value , default , reason , timestamp = starting_timestamp )
800+ context_filter = Impl ::ContextFilter . new ( config . all_attributes_private , config . private_attributes )
801+ redacted_context = context_filter . filter_redact_anonymous ( context )
802+
799803 out = {
800804 kind : 'migration_op' ,
801805 operation : 'read' ,
802806 creationDate : timestamp ,
803- contextKeys : context . keys ,
807+ context : redacted_context ,
804808 evaluation : {
805809 default : default . to_s ,
806810 key : flag . key ,
@@ -836,17 +840,21 @@ def debug_event(config, flag, context, variation, value, timestamp = starting_ti
836840 end
837841
838842 #
843+ # @param config [Config]
839844 # @param context [LDContext]
840845 # @param key [String]
841846 # @param data [any]
842847 # @param metric_value [any]
843848 # @return [Hash]
844849 #
845- def custom_event ( context , key , data , metric_value )
850+ def custom_event ( config , context , key , data , metric_value )
851+ context_filter = Impl ::ContextFilter . new ( config . all_attributes_private , config . private_attributes )
852+ redacted_context = context_filter . filter_redact_anonymous ( context )
853+
846854 out = {
847855 kind : "custom" ,
848856 creationDate : starting_timestamp ,
849- contextKeys : context . keys ,
857+ context : redacted_context ,
850858 key : key ,
851859 }
852860 out [ :data ] = data unless data . nil?
0 commit comments