Skip to content

Commit fb685d4

Browse files
authored
fix: send identify event on client creation (#54)
1 parent 1df9646 commit fb685d4

File tree

3 files changed

+96
-60
lines changed

3 files changed

+96
-60
lines changed

apps/sdk-contract-tests/test-suppressions.txt

Lines changed: 91 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,108 @@
1-
events/requests/method and headers
2-
events/requests/URL path is computed correctly/base URI has no trailing slash
3-
events/requests/URL path is computed correctly/base URI has a trailing slash
4-
events/requests/new payload ID for each post
51
events/summary events/basic counter behavior
62
events/summary events/context kinds
73
events/summary events/unknown flag
84
events/summary events/reset after each flush
9-
events/feature events
10-
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time
11-
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate
12-
events/debug events/should not see debug event/debugEventsUntilDate is before SDK time/SDK does not know LD time
13-
events/debug events/should not see debug event/debugEventsUntilDate is before SDK time/SDK knows LD time is before debugEventsUntilDate
14-
events/debug events/should not see debug event/debugEventsUntilDate is before SDK time/SDK knows LD time is after debugEventsUntilDate
15-
events/debug events/should not see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is after debugEventsUntilDate
5+
events/feature events/full feature event for tracked flag/without reason/type: bool
6+
events/feature events/full feature event for tracked flag/without reason/type: int
7+
events/feature events/full feature event for tracked flag/without reason/type: double
8+
events/feature events/full feature event for tracked flag/without reason/type: string
9+
events/feature events/full feature event for tracked flag/without reason/type: any
10+
events/feature events/full feature event for tracked flag/with reason/type: bool
11+
events/feature events/full feature event for tracked flag/with reason/type: int
12+
events/feature events/full feature event for tracked flag/with reason/type: double
13+
events/feature events/full feature event for tracked flag/with reason/type: string
14+
events/feature events/full feature event for tracked flag/with reason/type: any
15+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/without reasons/type: bool
16+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/without reasons/type: int
17+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/without reasons/type: double
18+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/without reasons/type: string
19+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/without reasons/type: any
20+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/with reasons/type: bool
21+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/with reasons/type: int
22+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/with reasons/type: double
23+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/with reasons/type: string
24+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK does not know LD time/with reasons/type: any
25+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/without reasons/type: bool
26+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/without reasons/type: int
27+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/without reasons/type: double
28+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/without reasons/type: string
29+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/without reasons/type: any
30+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/with reasons/type: bool
31+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/with reasons/type: int
32+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/with reasons/type: double
33+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/with reasons/type: string
34+
events/debug events/should see debug event/debugEventsUntilDate is after SDK time/SDK knows LD time is before debugEventsUntilDate/with reasons/type: any
1635
events/experimentation/FALLTHROUGH
1736
events/experimentation/RULE_MATCH
1837
events/identify events/basic properties/single kind default
1938
events/identify events/basic properties/single kind non-default
2039
events/identify events/basic properties/multi-kind
21-
events/custom events/data and metricValue parameters
2240
events/custom events/basic properties/single kind default
2341
events/custom events/basic properties/single kind non-default
2442
events/custom events/basic properties/multi-kind
25-
events/context properties/single-kind minimal
26-
events/context properties/multi-kind minimal
27-
events/context properties/single-kind with attributes, nothing private
28-
events/context properties/single-kind, allAttributesPrivate
29-
events/context properties/single-kind, specific private attributes
30-
events/context properties/single-kind, private attribute nested property
31-
events/context properties/custom attribute with value false
32-
events/context properties/custom attribute with value true
33-
events/context properties/custom attribute with value -1000
34-
events/context properties/custom attribute with value 0
35-
events/context properties/custom attribute with value 1000
36-
events/context properties/custom attribute with value -1000.5
37-
events/context properties/custom attribute with value 1000.5
38-
events/context properties/custom attribute with value ""
39-
events/context properties/custom attribute with value "abc"
40-
events/context properties/custom attribute with value "has \"escaped\" characters"
41-
events/context properties/custom attribute with value []
42-
events/context properties/custom attribute with value ["a","b"]
43-
events/context properties/custom attribute with value {}
44-
events/context properties/custom attribute with value {"a":1}
45-
events/event capacity/capacity is enforced
46-
events/event capacity/buffer is reset after flush
47-
events/event capacity/summary event is still included even if buffer was full
43+
events/context properties/single-kind minimal/initial identify event
44+
events/context properties/single-kind minimal/debug event
45+
events/context properties/single-kind minimal/identify event
46+
events/context properties/multi-kind minimal/initial identify event
47+
events/context properties/multi-kind minimal/debug event
48+
events/context properties/multi-kind minimal/identify event
49+
events/context properties/single-kind with attributes, nothing private/initial identify event
50+
events/context properties/single-kind with attributes, nothing private/debug event
51+
events/context properties/single-kind with attributes, nothing private/identify event
52+
events/context properties/single-kind, allAttributesPrivate/initial identify event
53+
events/context properties/single-kind, allAttributesPrivate/debug event
54+
events/context properties/single-kind, allAttributesPrivate/identify event
55+
events/context properties/single-kind, specific private attributes/initial identify event
56+
events/context properties/single-kind, specific private attributes/debug event
57+
events/context properties/single-kind, specific private attributes/identify event
58+
events/context properties/single-kind, private attribute nested property/initial identify event
59+
events/context properties/single-kind, private attribute nested property/debug event
60+
events/context properties/single-kind, private attribute nested property/identify event
61+
events/context properties/custom attribute with value false/initial identify event
62+
events/context properties/custom attribute with value false/debug event
63+
events/context properties/custom attribute with value false/identify event
64+
events/context properties/custom attribute with value true/initial identify event
65+
events/context properties/custom attribute with value true/debug event
66+
events/context properties/custom attribute with value true/identify event
67+
events/context properties/custom attribute with value -1000/initial identify event
68+
events/context properties/custom attribute with value -1000/debug event
69+
events/context properties/custom attribute with value -1000/identify event
70+
events/context properties/custom attribute with value 0/initial identify event
71+
events/context properties/custom attribute with value 0/debug event
72+
events/context properties/custom attribute with value 0/identify event
73+
events/context properties/custom attribute with value 1000/initial identify event
74+
events/context properties/custom attribute with value 1000/debug event
75+
events/context properties/custom attribute with value 1000/identify event
76+
events/context properties/custom attribute with value -1000.5/initial identify event
77+
events/context properties/custom attribute with value -1000.5/debug event
78+
events/context properties/custom attribute with value -1000.5/identify event
79+
events/context properties/custom attribute with value 1000.5/initial identify event
80+
events/context properties/custom attribute with value 1000.5/debug event
81+
events/context properties/custom attribute with value 1000.5/identify event
82+
events/context properties/custom attribute with value ""/initial identify event
83+
events/context properties/custom attribute with value ""/debug event
84+
events/context properties/custom attribute with value ""/identify event
85+
events/context properties/custom attribute with value "abc"/initial identify event
86+
events/context properties/custom attribute with value "abc"/debug event
87+
events/context properties/custom attribute with value "abc"/identify event
88+
events/context properties/custom attribute with value "has \"escaped\" characters"/initial identify event
89+
events/context properties/custom attribute with value "has \"escaped\" characters"/debug event
90+
events/context properties/custom attribute with value "has \"escaped\" characters"/identify event
91+
events/context properties/custom attribute with value []/initial identify event
92+
events/context properties/custom attribute with value []/debug event
93+
events/context properties/custom attribute with value []/identify event
94+
events/context properties/custom attribute with value ["a","b"]/initial identify event
95+
events/context properties/custom attribute with value ["a","b"]/debug event
96+
events/context properties/custom attribute with value ["a","b"]/identify event
97+
events/context properties/custom attribute with value {}/initial identify event
98+
events/context properties/custom attribute with value {}/debug event
99+
events/context properties/custom attribute with value {}/identify event
100+
events/context properties/custom attribute with value {"a":1}/initial identify event
101+
events/context properties/custom attribute with value {"a":1}/debug event
102+
events/context properties/custom attribute with value {"a":1}/identify event
48103
events/disabling/evaluation
49104
events/disabling/identify event
105+
events/disabling/custom event
50106
streaming/requests/query parameters/evaluationReasons set to true/GET
51107
streaming/requests/query parameters/evaluationReasons set to true/REPORT
52108
streaming/requests/context properties/single kind minimal/GET
@@ -55,34 +111,12 @@ streaming/requests/context properties/single kind with all attributes/GET
55111
streaming/requests/context properties/single kind with all attributes/REPORT
56112
streaming/requests/context properties/multi-kind/GET
57113
streaming/requests/context properties/multi-kind/REPORT
58-
streaming/updates/flag patch with higher version is applied
59-
streaming/updates/flag patch with same version is not applied
60-
streaming/updates/flag patch with lower version is not applied
61-
streaming/updates/flag delete with higher version is applied
62-
streaming/updates/flag delete with same version is not applied
63-
streaming/updates/flag delete with lower version is not applied
64114
polling/requests/context properties/single kind minimal/GET
65115
polling/requests/context properties/single kind minimal/REPORT
66116
polling/requests/context properties/single kind with all attributes/GET
67117
polling/requests/context properties/single kind with all attributes/REPORT
68118
polling/requests/context properties/multi-kind/GET
69119
polling/requests/context properties/multi-kind/REPORT
70-
tags/event posts/{"applicationId":null,"applicationVersion":null}
71-
tags/event posts/{"applicationId":null,"applicationVersion":""}
72-
tags/event posts/{"applicationId":null,"applicationVersion":""}
73-
tags/event posts/{"applicationId":null,"applicationVersion":""}
74-
tags/event posts/{"applicationId":"","applicationVersion":null}
75-
tags/event posts/{"applicationId":"","applicationVersion":""}
76-
tags/event posts/{"applicationId":"","applicationVersion":""}
77-
tags/event posts/{"applicationId":"","applicationVersion":""}
78-
tags/event posts/{"applicationId":"","applicationVersion":null}
79-
tags/event posts/{"applicationId":"","applicationVersion":""}
80-
tags/event posts/{"applicationId":"","applicationVersion":""}
81-
tags/event posts/{"applicationId":"","applicationVersion":""}
82-
tags/event posts/{"applicationId":"","applicationVersion":null}
83-
tags/event posts/{"applicationId":"","applicationVersion":""}
84-
tags/event posts/{"applicationId":"","applicationVersion":""}
85-
tags/event posts/{"applicationId":"","applicationVersion":""}
86120
tags/disallowed characters
87121
context type/build/valid/{"single":{"key":"a"}}
88122
context type/build/valid/{"single":{"kind":"org","key":"a"}}

libs/client-sdk/src/api.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ Client::Client(Config config, Context context)
6666
data_source_->Start();
6767

6868
run_thread_ = std::move(std::thread([&]() { ioc_.run(); }));
69+
70+
AsyncIdentify(context_);
6971
}
7072

7173
bool Client::Initialized() const {

libs/common/src/events/asio_event_processor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ void AsioEventProcessor<SDK>::AsyncClose() {
188188

189189
template <typename SDK>
190190
std::optional<EventBatch> AsioEventProcessor<SDK>::CreateBatch() {
191-
auto events = boost::json::value_from(outbox_.Consume());
191+
auto events = boost::json::value_from(outbox_.Consume()).as_array();
192192

193193
bool has_summary =
194194
!summarizer_.Finish(std::chrono::system_clock::now()).Empty();
195195

196196
if (has_summary) {
197-
events.as_array().push_back(boost::json::value_from(summarizer_));
198-
} else if (outbox_.Empty()) {
197+
events.push_back(boost::json::value_from(summarizer_));
198+
} else if (events.empty()) {
199199
return std::nullopt;
200200
}
201201

0 commit comments

Comments
 (0)