Exemple #1
0
        protected Guid ChronoDetailAddStart(string actionDescription)
        {
            ChronoModel detail = new ChronoModel();

            detail.Id                = Guid.NewGuid();
            detail.StartTime         = _lastChronoEnded == null ? DateTime.Now : _lastChronoEnded.Value;
            detail.EndTime           = DateTime.Now;
            detail.MSecDuration      = (detail.EndTime - detail.StartTime).TotalMilliseconds;
            detail.ActionDescription = actionDescription;
            detail.Parameters        = "";
            _chronoModelDetails.Add(detail);
            _lastChronoEnded = detail.EndTime;
            return(detail.Id);
        }
Exemple #2
0
        protected void ChronoStart(DateTime createdAt, string parameters)
        {
            _chronoModelMaster = new ChronoModel()
            {
                Id                = Guid.NewGuid(),
                ParentId          = Guid.Empty,
                ActionDescription = this.GetType().FullName,
                ScheduledTime     = createdAt,
                StartTime         = DateTime.Now,
                Parameters        = parameters,
            };

            var indexResponse = _elasticClient.Index(_chronoModelMaster, i => i.Index(IndexName));

            if (!indexResponse.IsValid)
            {
                throw new Exception(string.Format("Error during save in Elastic Chrono", indexResponse.OriginalException));
            }
            _chronoModelMaster.StartTime = DateTime.Now; //non mi interessa la latenza della insert
            _lastChronoEnded             = _chronoModelMaster.StartTime;
        }