Skip to content

Commit 1cd2357

Browse files
feat: Inline context for custom events (#147)
1 parent 226348f commit 1cd2357

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/ldclient_event_process_server.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ format_event_set_context(<<"index">>, Context, OutputEvent, GlobalPrivateAttribu
254254
OutputEvent#{
255255
<<"context">> => ldclient_context_filter:format_context_for_event(GlobalPrivateAttributes, Context)
256256
};
257-
format_event_set_context(<<"custom">>, Context, OutputEvent, _) ->
258-
OutputEvent#{<<"contextKeys">> => ldclient_context:get_keys_and_kinds(Context)}.
257+
format_event_set_context(<<"custom">>, Context, OutputEvent, GlobalPrivateAttributes) ->
258+
OutputEvent#{<<"context">> => ldclient_context_filter:format_context_for_event(GlobalPrivateAttributes, Context)}.
259259

260260
-spec maybe_set_metric_value(ldclient_event:event(), map()) -> map().
261261
maybe_set_metric_value(#{metric_value := MetricValue}, OutputEvent) ->

test-service/src/ts_service_request_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ get_service_detail(Req, State) ->
7474
<<"tags">>,
7575
<<"server-side-polling">>,
7676
<<"user-type">>,
77-
<<"inline-context">>,
77+
<<"inline-context-all">>,
7878
<<"anonymous-redaction">>,
7979
<<"tls:custom-ca">>,
8080
<<"tls:skip-verify-peer">>,

test/ldclient_events_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ add_custom_events(_) ->
786786
#{
787787
<<"key">> := <<"event-foo">>,
788788
<<"kind">> := <<"custom">>,
789-
<<"contextKeys">> := #{<<"user">> := <<"123456">>},
789+
<<"context">> := #{<<"key">> := <<"123456">>, <<"kind">> := <<"user">>, <<"firstName">> := <<"Tester">>, <<"lastName">> := <<"Testerson">>},
790790
<<"data">> := #{<<"k1">> := <<"v1">>},
791791
<<"creationDate">> := _
792792
},
@@ -798,7 +798,7 @@ add_custom_events(_) ->
798798
#{
799799
<<"key">> := <<"event-bar">>,
800800
<<"kind">> := <<"custom">>,
801-
<<"contextKeys">> := #{<<"user">> := <<"abcdef">>},
801+
<<"context">> := #{<<"key">> := <<"abcdef">>, <<"kind">> := <<"user">>, <<"firstName">> := <<"Tester">>, <<"lastName">> := <<"Testerson">>},
802802
<<"data">> := #{<<"k2">> := <<"v2">>},
803803
<<"creationDate">> := _
804804
},
@@ -810,7 +810,7 @@ add_custom_events(_) ->
810810
#{
811811
<<"key">> := <<"event-baz">>,
812812
<<"kind">> := <<"custom">>,
813-
<<"contextKeys">> := #{<<"user">> := <<"987656">>},
813+
<<"context">> := #{<<"key">> := <<"987656">>, <<"kind">> := <<"user">>, <<"firstName">> := <<"Tester">>, <<"lastName">> := <<"Testerson">>},
814814
<<"data">> := #{<<"k3">> := <<"v3">>},
815815
<<"metricValue">> := 123,
816816
<<"creationDate">> := _

0 commit comments

Comments
 (0)