Elastic APM

在 es apm 强制 fleet 前就用了

UI

网关

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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