sls报表监控代码段运行时效

本地配置

如果LogMonitor下AppId为空,则读取外层

  "LogMonitor": {

    //"AppId": "",
    "LogPath": "D:\\logmonitor"
  },
  "AppId": "KeyingPlatform.Api",
//ConfigureServices
    
//注册日志监控中间件
services.AddKeyingLogMonitorMiddleware(Configuration);


//framework
MonitorCenter.Instance.Register("AppId", "LogPath");
public static class KeyingLogMonitorMiddleware
{
    public static void AddKeyingLogMonitorMiddleware(this IServiceCollection services, IConfiguration configuration)
    {
        var logMonitor = configuration.GetSection("LogMonitor").Get<LogMonitor>();
        if (string.IsNullOrWhiteSpace(logMonitor.AppId))
        {
            logMonitor.AppId = configuration.GetValue<string>("AppId");
        }
        MonitorCenter.Instance.Register(logMonitor.AppId, logMonitor.LogPath);
    }
}

public class LogMonitor
{
    public string AppId { get; set; }

    public string LogPath { get; set; }

}

线上配置

image-20220124113529896

D:\logmonitor

sls配置

-- AppId
*  | select DISTINCT  lower(AppId) where AppId<>'null' LIMIT 100

-- Name
*|select DISTINCT name where name is not null

-- 百分比位图
 *|select k, v from(select map(array [0.50,0.75,0.90,0.95,0.99], p) as m from( select approx_percentile(spend, array [0.50,0.75,0.90,0.95,0.99]) as p  FROM log)), unnest(m) as t(k, v)


-- 最大最小分析
*  | select appId,name,max(spend) maxspend,avg(spend) avgSpend where name is not null group by appId,name order by maxspend desc

-- 趋势图
*|select date_format(date_trunc('minute', __time__),'%m-%d %H:%i') as t, name, spend where name is not null order by t

posted on 2022-01-24 11:37  隨風.NET  阅读(47)  评论(0编辑  收藏  举报

导航