Exemplo n.º 1
0
        /// <summary>
        /// Add unique event to next Backtrace Metrics request
        /// </summary>
        /// <param name="attributeName">attribute name</param>
        /// <param name="attributes">Event attributes</param>
        public bool AddUniqueEvent(string attributeName, IDictionary <string, string> attributes = null)
        {
            if (!_uniqueEventsSubmissionQueue.ShouldProcessEvent(attributeName))
            {
                return(false);
            }

            // add to event attributes, attribute provider attributes
            if (attributes == null)
            {
                attributes = new Dictionary <string, string>();
            }
            _attributeProvider.AddAttributes(attributes);

            // validate if unique event attribute is available and
            // prevent undefined attributes
            if (attributes.TryGetValue(attributeName, out string attributeValue) == false || string.IsNullOrEmpty(attributeValue))
            {
                Debug.LogWarning("Attribute name is not available in attribute scope. Please define attribute to set unique event.");
                return(false);
            }
            // skip already defined unique events
            if (UniqueEvents.Any(n => n.Name == attributeName))
            {
                return(false);
            }
            var @event = new UniqueEvent(attributeName, DateTimeHelper.Timestamp(), attributes);

            _uniqueEventsSubmissionQueue.Events.AddLast(@event);
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Collect additional report information from client and convert report to backtrace data
        /// </summary>
        /// <param name="report">Backtrace report</param>
        /// <returns>Backtrace data</returns>
        private BacktraceData SetupBacktraceData(BacktraceReport report)
        {
            // apply _mod fingerprint attribute when client should use
            // normalized exception message instead environment stack trace
            // for exceptions without stack trace.
            report.SetReportFingerprint(Configuration.UseNormalizedExceptionMessage);
            report.AttachmentPaths.AddRange(_clientReportAttachments);

            // pass copy of dictionary to prevent overriding client attributes
            var result = report.ToBacktraceData(null, GameObjectDepth);

            AttributeProvider.AddAttributes(result.Attributes.Attributes);

            return(result);
        }