TraceStoreUtils.java 678 Bytes
package com.yoho.trace.sleuth.util;

import com.yoho.trace.sleuth.Spans;
import com.yoho.trace.sleuth.ZipkinESStoreConfiguration;
import com.yoho.trace.sleuth.ZipkinMessageListener;
import org.apache.commons.collections.CollectionUtils;

/**
 * Created by markeloff on 2017/7/26.
 */
public class TraceStoreUtils {
    private static ZipkinMessageListener zipkinMessageListener;

    static {
        zipkinMessageListener = ZipkinESStoreConfiguration.createZipkinMessageListener();
    }

    public static void store(Spans spans) {
        if (spans != null && CollectionUtils.isNotEmpty(spans.getSpans())) {
            zipkinMessageListener.sink(spans);
        }
    }


}