add mem-leak api

This commit is contained in:
Jiaxuan-Yang
2021-02-22 14:35:41 -05:00
parent 80616f0090
commit f07213185f

View File

@@ -2,6 +2,7 @@ package com.instana.robotshop.shipping;
import java.util.List;
import java.util.Map;
import java.util.Arrays;
import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,6 +23,8 @@ public class Controller {
private String CART_URL = String.format("http://%s/shipping/", getenv("CART_ENDPOINT", "cart"));
public static ArrayList bytesGlobal = new ArrayList<byte[]>();
@Autowired
private CityRepository cityrepo;
@@ -35,6 +38,14 @@ public class Controller {
return val;
}
@GetMapping(path = "/memory")
public int memory() {
byte[] bytes = new byte[1024 * 1024 * 25];
Arrays.fill(bytes,(byte)8);
bytesGlobal.add(bytes);
return bytesGlobal.size();
}
@GetMapping("/health")
public String health() {
return "OK";