Exemple #1
0
        public override async Task <WriteReply> WritePerformance(Performance performance, ServerCallContext context)
        {
            Core.Models.Performance model = new Core.Models.Performance()
            {
                Id                 = performance.Id,
                CreateTime         = new System.DateTime(performance.CreateTimeStamp),
                GCGen0             = performance.GCGen0,
                GCGen1             = performance.GCGen1,
                GCGen2             = performance.GCGen2,
                HeapMemory         = performance.HeapMemory,
                Service            = performance.Service,
                Instance           = performance.Instance,
                PendingThreadCount = performance.PendingThreadCount,
                ProcessCPU         = performance.ProcessCPU,
                ProcessMemory      = performance.ProcessMemory,
                ThreadCount        = performance.ThreadCount
            };

            await _storage.AddPerformanceAsync(model);

            return(new WriteReply()
            {
                Code = 0
            });
        }
Exemple #2
0
        public void JsonTest()
        {
            var user = new {
                FirstName  = "张三",
                CreateTime = DateTime.Now
            };

            var model1 = new Core.Models.Performance()
            {
                Id         = 1222222222243243232L,
                Instance   = "",
                Service    = "测试",
                CreateTime = DateTime.Now
            };

            var model3 = new Collector.Grpc.Performance();

            var str2 = JsonSerializer.Serialize(model1);

            var model2 = JsonSerializer.Deserialize <Collector.Grpc.Performance>(str2);
        }