package com.elab.spring.monitor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 监控收集器
 *
 * @author liukaixiong
 * @Email liukx@elab-plus.com
 * @date 2021/9/26 - 15:11
 */
public class MonitorCollect {
    private static Logger logger = LoggerFactory.getLogger(MonitorCollect.class);
    private static MonitorCollect INSTANCE = new MonitorCollect();

    public static MonitorCollect getINSTANCE() {
        return INSTANCE;
    }

    /**
     * 业务数据收集器
     */
    public static ServiceMonitorDataCollect SERVICE = new ServiceMonitorDataCollect() {
        @Override
        public Object send(String[] author, String methodName, String groupName, String key, String dataId,
            Object request, MonitorSupplier process) throws Exception {
            return process.get();
        }
    };

    /**
     * 默认注册的值
     *
     * @param serviceMonitorDataCollect
     */
    public void register(ServiceMonitorDataCollect serviceMonitorDataCollect) {
        MonitorCollect.SERVICE = serviceMonitorDataCollect;
    }

}
