public static IMatsTelemetryClient CreateMats(IApplicationConfiguration applicationConfiguration, IPlatformProxy platformProxy, IMatsConfig matsConfig) { string dpti = platformProxy.GetDevicePlatformTelemetryId(); if (!IsDeviceEnabled(matsConfig.AudienceType, dpti)) { return(null); } string deviceNetworkState = platformProxy.GetDeviceNetworkState(); int osPlatformCode = platformProxy.GetMatsOsPlatformCode(); bool enableAggregation = true; IEventFilter eventFilter = new EventFilter(enableAggregation); var errorStore = new ErrorStore(); var scenarioStore = new ScenarioStore(TimeConstants.ScenarioTimeoutMilliseconds, errorStore); var allowedScopes = new HashSet <string>(); if (matsConfig.AllowedScopes != null) { foreach (string s in matsConfig.AllowedScopes) { allowedScopes.Add(s); } } var actionStore = new ActionStore( TimeConstants.ActionTimeoutMilliseconds, TimeConstants.AggregationWindowMilliseconds, errorStore, eventFilter, allowedScopes); var contextStore = ContextStore.CreateContextStore( matsConfig.AudienceType, applicationConfiguration.ClientName, applicationConfiguration.ClientVersion, dpti, deviceNetworkState, matsConfig.SessionId, osPlatformCode); IUploader uploader = new TelemetryUploader(matsConfig.DispatchAction, platformProxy, applicationConfiguration.ClientName); // it's this way in mats c++ bool isScenarioUploadDisabled = true; return(new MatsTelemetryClient( applicationConfiguration, platformProxy, errorStore, uploader, actionStore, scenarioStore, contextStore, isScenarioUploadDisabled)); }
public static ITelemetryClient CreateMats( IApplicationConfiguration applicationConfiguration, IPlatformProxy platformProxy, ITelemetryConfig telemetryConfig) { string dpti = platformProxy.GetDevicePlatformTelemetryId(); if (!IsDeviceEnabled(telemetryConfig.AudienceType, dpti)) { return(null); } string deviceNetworkState = platformProxy.GetDeviceNetworkState(); int osPlatformCode = platformProxy.GetMatsOsPlatformCode(); bool enableAggregation = true; IEventFilter eventFilter = new EventFilter(enableAggregation); var errorStore = new ErrorStore(); var scenarioStore = new ScenarioStore(TimeConstants.ScenarioTimeoutMilliseconds, errorStore); var allowedScopes = new HashSet <string>(); // TODO: need to determine what MATS was doing with the AllowedScopes and DeniedScopes values in the C++ impl // and possibly expose this value in the ITelemetryConfig interface. //if (telemetryConfig.AllowedScopes != null) //{ // foreach (string s in telemetryConfig.AllowedScopes) // { // allowedScopes.Add(s); // } //} var actionStore = new ActionStore( TimeConstants.ActionTimeoutMilliseconds, TimeConstants.AggregationWindowMilliseconds, errorStore, eventFilter, allowedScopes); var contextStore = ContextStore.CreateContextStore( telemetryConfig.AudienceType, applicationConfiguration.ClientName, applicationConfiguration.ClientVersion, dpti, deviceNetworkState, telemetryConfig.SessionId, osPlatformCode); IUploader uploader = new TelemetryUploader(telemetryConfig.DispatchAction, platformProxy, applicationConfiguration.ClientName); // it's this way in mats c++ bool isScenarioUploadDisabled = true; return(new TelemetryClient( applicationConfiguration, platformProxy, errorStore, uploader, actionStore, scenarioStore, contextStore, isScenarioUploadDisabled)); }