Skip to content

Commit e218270

Browse files
authored
Merge branch 'master' into sid-dahiya/TestUpdatesForImprovedIpAddressFiltering
2 parents c1bb5b8 + c4dbfef commit e218270

File tree

9 files changed

+72
-7
lines changed

9 files changed

+72
-7
lines changed

lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/Constants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ private Constants() { }
1515

1616
public static final String COMMONFIELDS_APP_EXPERIMENTIDS = "AppInfo.ExperimentIds";
1717
public static final String COMMONFIELDS_APP_EXPERIMENTETAG = "AppInfo.ETag";
18-
public static final String COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID = "AppInfo.ImpressionId";
1918

2019
public static final String COMMONFIELDS_DEVICE_ID = "DeviceInfo.Id";
2120
public static final String COMMONFIELDS_DEVICE_MAKE = "DeviceInfo.Make";
@@ -58,6 +57,7 @@ private Constants() { }
5857
public static final String SESSION_FIRST_TIME = "Session.FirstLaunchTime";
5958
public static final String SESSION_STATE = "Session.State";
6059
public static final String SESSION_ID = "Session.Id";
60+
public static final String SESSION_IMPRESSION_ID = "Session.ImpressionId";
6161
public static final String SESSION_DURATION = "Session.Duration";
6262
public static final String SESSION_DURATION_BUCKET = "Session.DurationBucket";
6363
public static final String SESSION_ID_LEGACY = "act_session_id";

lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/SemanticContext.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void setAppExperimentETag(final String appExperimentETag) {
104104
*/
105105
@Override
106106
public void setAppExperimentImpressionId(final String appExperimentImpressionId) {
107-
setCommonField(Constants.COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID, appExperimentImpressionId);
107+
setCommonField(Constants.SESSION_IMPRESSION_ID, appExperimentImpressionId);
108108
}
109109

110110
private native void nativeSetEventExperimentIds(long nativeISemanticContextPtr, String eventName, String experimentIds);

lib/api/ContextFieldsProvider.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ namespace ARIASDK_NS_BEGIN
125125

126126
if (!m_commonContextFields.empty())
127127
{
128-
if (m_commonContextFields.find(COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID) != m_commonContextFields.end())
128+
if (m_commonContextFields.find(SESSION_IMPRESSION_ID) != m_commonContextFields.end())
129129
{
130130
CsProtocol::Value temp;
131-
EventProperty prop = m_commonContextFields[COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID];
131+
EventProperty prop = m_commonContextFields[SESSION_IMPRESSION_ID];
132132
temp.stringValue = prop.as_string;
133133

134-
ext[COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID] = temp;
134+
ext[SESSION_IMPRESSION_ID] = temp;
135135
}
136136

137137
if (m_commonContextFields.find(COMMONFIELDS_APP_EXPERIMENTETAG) != m_commonContextFields.end())

lib/include/public/CommonFields.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#define COMMONFIELDS_APP_EXPERIMENTIDS "AppInfo.ExperimentIds"
1616
#define COMMONFIELDS_APP_EXPERIMENTETAG "AppInfo.ETag"
17-
#define COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID "AppInfo.ImpressionId"
1817

1918
#define COMMONFIELDS_DEVICE_ID "DeviceInfo.Id"
2019
#define COMMONFIELDS_DEVICE_MAKE "DeviceInfo.Make"
@@ -57,6 +56,7 @@
5756
#define SESSION_FIRST_TIME "Session.FirstLaunchTime"
5857
#define SESSION_STATE "Session.State"
5958
#define SESSION_ID "Session.Id"
59+
#define SESSION_IMPRESSION_ID "Session.ImpressionId"
6060
#define SESSION_DURATION "Session.Duration"
6161
#define SESSION_DURATION_BUCKET "Session.DurationBucket"
6262
#define SESSION_ID_LEGACY "act_session_id"

lib/include/public/ISemanticContext.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace ARIASDK_NS_BEGIN
7171
/// Set the application experimentation impression id information of telemetry event.
7272
/// </summary>
7373
/// <param name="appExperimentIds">List of expementation IDs which are app/platform specific</param>
74-
DECLARE_COMMONFIELD(AppExperimentImpressionId, COMMONFIELDS_APP_EXPERIMENT_IMPRESSION_ID);
74+
DECLARE_COMMONFIELD(AppExperimentImpressionId, SESSION_IMPRESSION_ID);
7575

7676
/// <summary>
7777
/// Set the experiment IDs information of the specified telemetry event.

lib/include/public/LogManagerBase.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,16 @@ namespace ARIASDK_NS_BEGIN
676676
return nullLogManager.GetDataViewerCollection();
677677
#endif
678678
}
679+
680+
/// <summary>
681+
/// Obtain a raw pointer to the ILogManager singleton instance.
682+
/// NOTE: this API should not be used concurrently with Initialize or FlushAndTeardown API calls.
683+
/// </summary>
684+
static ILogManager* GetInstance() noexcept
685+
{
686+
LM_LOCKGUARD(stateLock());
687+
return instance;
688+
}
679689
};
680690

681691
// Implements LogManager<T> singleton template static members

tests/functests/BasicFuncTests.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,20 @@ TEST_F(BasicFuncTests, raceBetweenUploadAndShutdownMultipleLogManagers)
14431443
}
14441444
#endif
14451445

1446+
TEST_F(BasicFuncTests, logManager_getLogManagerInstance_uninitializedReturnsNull)
1447+
{
1448+
auto lm = LogManager::GetInstance();
1449+
EXPECT_EQ(lm,nullptr);
1450+
}
1451+
1452+
TEST_F(BasicFuncTests, logManager_getLogManagerInstance_initializedReturnsNonnull)
1453+
{
1454+
LogManager::Initialize();
1455+
auto lm = LogManager::GetInstance();
1456+
EXPECT_NE(lm,nullptr);
1457+
LogManager::FlushAndTeardown();
1458+
}
1459+
14461460
#if 0 // XXX: [MG] - This test was never supposed to work! Because the URL is invalid, we won't get anything in receivedRequests
14471461

14481462
TEST_F(BasicFuncTests, networkProblemsDoNotDropEvents)

wrappers/obj-c/ODWSemanticContext.h

+21
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,34 @@ NS_ASSUME_NONNULL_BEGIN
2525
*/
2626
-(void)setUserAdvertisingId:(nonnull NSString *)userAdvertisingId;
2727

28+
/*!
29+
@brief Sets the experimentation IDs for determining the deployment configuration.
30+
@param experimentIds A string that contains the experimentation IDs.
31+
*/
32+
-(void)setAppExperimentIds:(nonnull NSString*)experimentIds;
33+
34+
/*!
35+
@brief Sets the experimentation IDs for the specified telemetry event.
36+
@param experimentIds A string that contains the experimentation IDs.
37+
@param eventName A string that contains the name of the event.
38+
*/
39+
-(void)setAppExperimentIds:(nonnull NSString*)experimentIds
40+
forEvent:(nonnull NSString*)eventName;
41+
2842
/*!
2943
@brief Sets the experiment tag (experiment configuration) context information for telemetry events.
3044
<b>Note:</b> This method removes any previously stored experiment IDs that were set using setAppExperimentETag.
3145
@param eTag A string that contains the ETag which is a hash of the set of experiments.
3246
*/
3347
-(void)setAppExperimentETag:(nonnull NSString *)eTag;
3448

49+
/*!
50+
@brief Sets the impression ID (an identifier of the currently running flights) for an experiment.
51+
@details Calling this method removes the previously stored experimentation IDs and flight IDs.
52+
@param impressionId A string that contains the impression ID for the currently active configuration.
53+
*/
54+
-(void)setAppExperimentImpressionId:(nonnull NSString*)impressionId;
55+
3556
@end
3657

3758
NS_ASSUME_NONNULL_END

wrappers/obj-c/ODWSemanticContext.mm

+20
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,30 @@ -(void)setUserAdvertisingId:(nonnull NSString *)userAdvertisingId
3737
_wrappedSemanticContext->SetUserAdvertisingId(strUserAdvertisingId);
3838
}
3939

40+
-(void)setAppExperimentIds:(nonnull NSString*)experimentIds
41+
{
42+
std::string strAppExperimentIds = std::string([experimentIds UTF8String]);
43+
_wrappedSemanticContext->SetAppExperimentIds(strAppExperimentIds);
44+
}
45+
46+
-(void)setAppExperimentIds:(nonnull NSString*)experimentIds
47+
forEvent:(nonnull NSString*)eventName
48+
{
49+
std::string strAppExperimentIds = std::string([experimentIds UTF8String]);
50+
std::string stEventName = std::string([eventName UTF8String]);
51+
_wrappedSemanticContext->SetEventExperimentIds(stEventName, strAppExperimentIds);
52+
}
53+
4054
-(void)setAppExperimentETag:(nonnull NSString *)eTag
4155
{
4256
std::string strETag = std::string([eTag UTF8String]);
4357
_wrappedSemanticContext->SetAppExperimentETag(strETag);
4458
}
4559

60+
-(void)setAppExperimentImpressionId:(nonnull NSString*)impressionId
61+
{
62+
std::string strImpressionId = std::string([impressionId UTF8String]);
63+
_wrappedSemanticContext->SetAppExperimentImpressionId(strImpressionId);
64+
}
65+
4666
@end

0 commit comments

Comments
 (0)