コード例 #1
0
        private PerformanceHint GetOrCreateSlowWrites(out SlowWritesDetails details)
        {
            const string source = "slow-writes";

            var id = PerformanceHint.GetKey(PerformanceHintType.SlowIO, source);

            using (_notificationsStorage.Read(id, out var ntv))
            {
                if (ntv == null || ntv.Json.TryGet(nameof(PerformanceHint.Details), out BlittableJsonReaderObject detailsJson) == false || detailsJson == null)
                {
                    details = new SlowWritesDetails();
                }
                else
                {
                    details = DocumentConventions.DefaultForServer.Serialization.DefaultConverter.FromBlittable <SlowWritesDetails>(detailsJson);
                }

                return(PerformanceHint.Create(
                           _database,
                           "An extremely slow write to disk",
                           "We have detected very slow writes",
                           PerformanceHintType.SlowIO,
                           NotificationSeverity.Info,
                           source,
                           details
                           ));
            }
        }
コード例 #2
0
        public bool Update(UpdateStep step)
        {
            var table = step.WriteTx.OpenTable(step.ConfigurationStorage.NotificationsStorage._actionsSchema, NotificationsStorage.NotificationsSchema.NotificationsTree);

            using (Slice.From(step.WriteTx.Allocator, PerformanceHint.GetKey(PerformanceHintType.SlowIO, string.Empty), out Slice slowIoHintPrefix))
            {
                table.DeleteByPrimaryKeyPrefix(slowIoHintPrefix);
            }

            return(true);
        }
コード例 #3
0
        private PerformanceHint GetOrCreatePerformanceHint <T>(string processTag, string processName, PerformanceHintType etlHintType, string message, out T details) where T : INotificationDetails, new()
        {
            Debug.Assert(etlHintType == PerformanceHintType.SqlEtl_SlowSql);

            var key = $"{processTag}/{processName}";

            var id = PerformanceHint.GetKey(etlHintType, key);

            using (_notificationsStorage.Read(id, out NotificationTableValue ntv))
            {
                details = GetDetails <T>(ntv);

                return(PerformanceHint.Create(
                           _databaseName,
                           $"{processTag}: '{processName}'",
                           message,
                           etlHintType,
                           NotificationSeverity.Warning,
                           source: key,
                           details: details));
            }
        }