Elastic APM

ddatsh

dev #apm

在 es apm 强制 fleet 前就用了

UI

网关

用在网关如zuul里,需要注意 transaction name的解析,如

import co.elastic.apm.api.ElasticApm;
import co.elastic.apm.api.Transaction;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;

@Component
public class PostLoggerFilter extends ZuulFilter {
	
	@Override
	public String filterType() {

		return FilterConstants.POST_TYPE;
	}

	@Override
	public int filterOrder() {

		return FilterConstants.SEND_RESPONSE_FILTER_ORDER - 1;
	}

	@Override
	public boolean shouldFilter() {

		return true;
	}

	@Override
	public Object run() {

		Transaction transaction = ElasticApm.currentTransaction();

		RequestContext context     = RequestContext.getCurrentContext();
		String         proxy       = (String) context.getOrDefault("proxy", "");
	
		transaction.setName(proxy);
		
		return null;
	}
}

运维

Index lifecycle policy 防止 disk full