Cześć, mam kontroler jak poniżej. Problem polega na zliczeniu ilości wywołań api dla kazdego produktu oddzielnie w danej sesji, tj. produkt/1, produkt/2.
Próbowałem wyciągnać te dane z actuator/metrics/http.server.requests, aczkolwiek tutaj zliczane są wywołania wszytskich adresów. Docelowo potrzebuje metody, która w kontrolerze zwróci ilość wywołań danego api w zalezności od id.
@RestController
@RequestMapping("")
public class ProductController {
private ProductService productService;
@Autowired
public ProductController(ProductService productService) {
this.productService = productService;
}
@GetMapping("/product/{id}")
public Product findByid(@PathVariable Long id){
return productService.findById(id);
}
@PatchMapping("/product/{id}")
public Product getProductWithDiscountById(@PathVariable Long id){
return productService.changePriceProductById(id);
}
}