Beispiel #1
0
 public static ContextStore CreateContextStore(
     TelemetryAudienceType audienceType,
     string appName,
     string appVersion,
     string dptiInternal,
     string deviceNetworkState,
     string sessionId,
     int platform)
 {
     if (!Guid.TryParse(sessionId, out Guid result))
     {
         sessionId = MatsId.Create();
     }
     return(new ContextStore(audienceType, appName, appVersion, dptiInternal, deviceNetworkState, sessionId, platform));
 }
Beispiel #2
0
        public MatsScenario CreateScenario()
        {
            string scenarioId = MatsId.Create();

            var propertyBag = new PropertyBag(EventType.Scenario, _errorStore);

            propertyBag.Add(ScenarioPropertyNames.UploadIdConstStrKey, MatsId.Create());
            propertyBag.Add(ScenarioPropertyNames.IdConstStrKey, scenarioId);

            lock (_lockScenarioIdToPropertyBag)
            {
                _scenarioIdToPropertyBag[scenarioId] = new ScenarioHolder(propertyBag);
            }

            return(new MatsScenario(scenarioId, 0));
        }
        private ActionArtifacts CreateGenericAction(MatsScenario scenario, string correlationId, ActionType actionType)
        {
            string     actionId = MatsId.Create();
            MatsAction action   = new MatsAction(actionId, scenario, correlationId);

            string corrIdTrim = correlationId.TrimCurlyBraces();

            var propertyBag    = new ActionPropertyBag(_errorStore);
            var startTimePoint = DateTime.UtcNow;

            propertyBag.Add(ActionPropertyNames.UploadIdConstStrKey, MatsId.Create());
            propertyBag.Add(ActionPropertyNames.ActionTypeConstStrKey, MatsConverter.AsString(actionType));
            propertyBag.Add(ScenarioPropertyNames.IdConstStrKey, scenario?.ScenarioId);
            propertyBag.Add(ActionPropertyNames.CorrelationIdConstStrKey, corrIdTrim);
            propertyBag.Add(ActionPropertyNames.StartTimeConstStrKey, DateTimeUtils.GetMillisecondsSinceEpoch(startTimePoint));

            lock (_lockActionIdToPropertyBag)
            {
                _actionIdToPropertyBag[actionId] = propertyBag;
            }

            return(new ActionArtifacts(action, propertyBag));
        }