using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
namespace Grpc.Extension.Abstract.Model
{
///
/// 日志监控实体
///
[Serializable]
public class MonitorModel
{
///
/// MonitorModel
///
public MonitorModel()
{
RequestId = Guid.NewGuid().ToString();
RequestTime = DateTime.Now;
}
///
/// 请求Id
///
public string RequestId { get; set; }
///
/// 客户端Ip
///
public string ClientIp { get; set; }
///
/// 请求时间
///
public DateTime RequestTime { get; set; }
///
/// 请求Url
///
public string RequestUrl { get; set; }
///
/// 请求参数
///
public string RequestData { get; set; }
///
/// 请求头
///
public Dictionary RequestHeaders { get; set; }
///
/// 多层调用的追踪id
///
public string TraceId { get; set; }
///
/// ok | error
///
public string Status { get; set; }
///
/// 响应时间
///
public DateTime ResponseTime { get; set; }
///
/// 响应数据
///
public string ResponseData { get; set; }
///
/// 异常信息
///
public string Exception { get; set; }
///
/// 总耗时
///
public double TotalElapsed => (ResponseTime - RequestTime).TotalMilliseconds;
///
/// 访问上下信息的预留属性
///
public ConcurrentDictionary Items { get; set; } = new ConcurrentDictionary();
}
}